Gov. Gavin Newsom on Wednesday signed legislation launching a court- and county-based program aimed at getting severely mentally ill Californians into treatment before they succumb to the dangers of homelessness.