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.h" | 5 #include "chromeos/process_proxy/process_proxy.h" |
6 | 6 |
7 #include <fcntl.h> | 7 #include <fcntl.h> |
8 #include <stdlib.h> | 8 #include <stdlib.h> |
9 #include <sys/ioctl.h> | 9 #include <sys/ioctl.h> |
10 | 10 |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 // |watch| thread is blocked by |output_watcher| from now on. | 98 // |watch| thread is blocked by |output_watcher| from now on. |
99 watch_thread->message_loop()->PostTask(FROM_HERE, | 99 watch_thread->message_loop()->PostTask(FROM_HERE, |
100 base::Bind(&ProcessOutputWatcher::Start, | 100 base::Bind(&ProcessOutputWatcher::Start, |
101 base::Unretained(output_watcher))); | 101 base::Unretained(output_watcher))); |
102 watcher_started_ = true; | 102 watcher_started_ = true; |
103 return true; | 103 return true; |
104 } | 104 } |
105 | 105 |
106 void ProcessProxy::OnProcessOutput(ProcessOutputType type, | 106 void ProcessProxy::OnProcessOutput(ProcessOutputType type, |
107 const std::string& output) { | 107 const std::string& output) { |
108 if (!callback_runner_) | 108 if (!callback_runner_.get()) |
109 return; | 109 return; |
110 | 110 |
111 callback_runner_->PostTask( | 111 callback_runner_->PostTask( |
112 FROM_HERE, | 112 FROM_HERE, |
113 base::Bind(&ProcessProxy::CallOnProcessOutputCallback, | 113 base::Bind(&ProcessProxy::CallOnProcessOutputCallback, |
114 this, type, output)); | 114 this, type, output)); |
115 } | 115 } |
116 | 116 |
117 void ProcessProxy::CallOnProcessOutputCallback(ProcessOutputType type, | 117 void ProcessProxy::CallOnProcessOutputCallback(ProcessOutputType type, |
118 const std::string& output) { | 118 const std::string& output) { |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 ClearFdPair(pt_pair_); | 256 ClearFdPair(pt_pair_); |
257 ClearFdPair(shutdown_pipe_); | 257 ClearFdPair(shutdown_pipe_); |
258 } | 258 } |
259 | 259 |
260 void ProcessProxy::ClearFdPair(int* pipe) { | 260 void ProcessProxy::ClearFdPair(int* pipe) { |
261 pipe[PIPE_END_READ] = kInvalidFd; | 261 pipe[PIPE_END_READ] = kInvalidFd; |
262 pipe[PIPE_END_WRITE] = kInvalidFd; | 262 pipe[PIPE_END_WRITE] = kInvalidFd; |
263 } | 263 } |
264 | 264 |
265 } // namespace chromeos | 265 } // namespace chromeos |
OLD | NEW |