| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "content/browser/utility_process_host.h" | 5 #include "content/browser/utility_process_host.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 #else | 46 #else |
| 47 child_flags_(ChildProcessHost::CHILD_NORMAL), | 47 child_flags_(ChildProcessHost::CHILD_NORMAL), |
| 48 #endif | 48 #endif |
| 49 use_linux_zygote_(false), | 49 use_linux_zygote_(false), |
| 50 started_(false) { | 50 started_(false) { |
| 51 process_.reset( | 51 process_.reset( |
| 52 new BrowserChildProcessHostImpl(content::PROCESS_TYPE_UTILITY, this)); | 52 new BrowserChildProcessHostImpl(content::PROCESS_TYPE_UTILITY, this)); |
| 53 } | 53 } |
| 54 | 54 |
| 55 UtilityProcessHost::~UtilityProcessHost() { | 55 UtilityProcessHost::~UtilityProcessHost() { |
| 56 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 56 DCHECK(!is_batch_mode_); | 57 DCHECK(!is_batch_mode_); |
| 57 } | 58 } |
| 58 | 59 |
| 59 bool UtilityProcessHost::Send(IPC::Message* message) { | 60 bool UtilityProcessHost::Send(IPC::Message* message) { |
| 60 if (!StartProcess()) | 61 if (!StartProcess()) |
| 61 return false; | 62 return false; |
| 62 | 63 |
| 63 return process_->Send(message); | 64 return process_->Send(message); |
| 64 } | 65 } |
| 65 | 66 |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 } | 152 } |
| 152 | 153 |
| 153 bool UtilityProcessHost::OnMessageReceived(const IPC::Message& message) { | 154 bool UtilityProcessHost::OnMessageReceived(const IPC::Message& message) { |
| 154 BrowserThread::PostTask( | 155 BrowserThread::PostTask( |
| 155 client_thread_id_, FROM_HERE, | 156 client_thread_id_, FROM_HERE, |
| 156 base::Bind(base::IgnoreResult(&Client::OnMessageReceived), | 157 base::Bind(base::IgnoreResult(&Client::OnMessageReceived), |
| 157 client_.get(), message)); | 158 client_.get(), message)); |
| 158 return true; | 159 return true; |
| 159 } | 160 } |
| 160 | 161 |
| 161 void UtilityProcessHost::OnProcessCrashed(int exit_code) { | 162 void UtilityProcessHost::OnProcessCrashedOrWasKilled(int exit_code) { |
| 162 BrowserThread::PostTask( | 163 BrowserThread::PostTask( |
| 163 client_thread_id_, FROM_HERE, | 164 client_thread_id_, FROM_HERE, |
| 164 base::Bind(&Client::OnProcessCrashed, client_.get(), exit_code)); | 165 base::Bind(&Client::OnProcessCrashed, client_.get(), exit_code)); |
| 165 } | 166 } |
| OLD | NEW |