| OLD | NEW | 
|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be | 
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. | 
| 4 | 4 | 
| 5 #include "chromeos/process_proxy/process_proxy_registry.h" | 5 #include "chromeos/process_proxy/process_proxy_registry.h" | 
| 6 | 6 | 
| 7 #include "base/bind.h" | 7 #include "base/bind.h" | 
| 8 | 8 | 
| 9 namespace chromeos { | 9 namespace chromeos { | 
| 10 | 10 | 
| 11 namespace { | 11 namespace { | 
| 12 | 12 | 
| 13 const char kWatcherThreadName[] = "ProcessWatcherThread"; | 13 const char kWatcherThreadName[] = "ProcessWatcherThread"; | 
| 14 | 14 | 
| 15 const char kStdoutOutputType[] = "stdout"; | 15 const char kStdoutOutputType[] = "stdout"; | 
| 16 const char kExitOutputType[] = "exit"; | 16 const char kExitOutputType[] = "exit"; | 
| 17 | 17 | 
| 18 const char* ProcessOutputTypeToString(ProcessOutputType type) { | 18 const char* ProcessOutputTypeToString(ProcessOutputType type) { | 
| 19   switch (type) { | 19   switch (type) { | 
| 20     case PROCESS_OUTPUT_TYPE_OUT: | 20     case PROCESS_OUTPUT_TYPE_OUT: | 
| 21       return kStdoutOutputType; | 21       return kStdoutOutputType; | 
| 22     case PROCESS_OUTPUT_TYPE_EXIT: | 22     case PROCESS_OUTPUT_TYPE_EXIT: | 
| 23       return kExitOutputType; | 23       return kExitOutputType; | 
| 24     default: | 24     default: | 
| 25       return NULL; | 25       return NULL; | 
| 26   } | 26   } | 
| 27 } | 27 } | 
| 28 | 28 | 
| 29 static base::LazyInstance<ProcessProxyRegistry> g_process_proxy_registry = | 29 static base::LazyInstance<ProcessProxyRegistry>::DestructorAtExit | 
| 30     LAZY_INSTANCE_INITIALIZER; | 30     g_process_proxy_registry = LAZY_INSTANCE_INITIALIZER; | 
| 31 | 31 | 
| 32 }  // namespace | 32 }  // namespace | 
| 33 | 33 | 
| 34 ProcessProxyRegistry::ProcessProxyInfo::ProcessProxyInfo() { | 34 ProcessProxyRegistry::ProcessProxyInfo::ProcessProxyInfo() { | 
| 35 } | 35 } | 
| 36 | 36 | 
| 37 ProcessProxyRegistry::ProcessProxyInfo::ProcessProxyInfo( | 37 ProcessProxyRegistry::ProcessProxyInfo::ProcessProxyInfo( | 
| 38     const ProcessProxyInfo& other) { | 38     const ProcessProxyInfo& other) { | 
| 39   // This should be called with empty info only. | 39   // This should be called with empty info only. | 
| 40   DCHECK(!other.proxy.get()); | 40   DCHECK(!other.proxy.get()); | 
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 168 | 168 | 
| 169   // TODO(tbarzic): Change process output watcher to watch for fd readability on | 169   // TODO(tbarzic): Change process output watcher to watch for fd readability on | 
| 170   //    FILE thread, and move output reading to worker thread instead of | 170   //    FILE thread, and move output reading to worker thread instead of | 
| 171   //    spinning a new thread. | 171   //    spinning a new thread. | 
| 172   watcher_thread_.reset(new base::Thread(kWatcherThreadName)); | 172   watcher_thread_.reset(new base::Thread(kWatcherThreadName)); | 
| 173   return watcher_thread_->StartWithOptions( | 173   return watcher_thread_->StartWithOptions( | 
| 174       base::Thread::Options(base::MessageLoop::TYPE_IO, 0)); | 174       base::Thread::Options(base::MessageLoop::TYPE_IO, 0)); | 
| 175 } | 175 } | 
| 176 | 176 | 
| 177 }  // namespace chromeos | 177 }  // namespace chromeos | 
| OLD | NEW | 
|---|