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 // Represents the browser side of the browser <--> renderer communication | 5 // Represents the browser side of the browser <--> renderer communication |
6 // channel. There will be one RenderProcessHost per renderer process. | 6 // channel. There will be one RenderProcessHost per renderer process. |
7 | 7 |
8 #include "content/browser/renderer_host/render_process_host_impl.h" | 8 #include "content/browser/renderer_host/render_process_host_impl.h" |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 1274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1285 std::string value = | 1285 std::string value = |
1286 browser_cmd.GetSwitchValueASCII(switches::kWaitForDebuggerChildren); | 1286 browser_cmd.GetSwitchValueASCII(switches::kWaitForDebuggerChildren); |
1287 if (value.empty() || value == switches::kRendererProcess) { | 1287 if (value.empty() || value == switches::kRendererProcess) { |
1288 renderer_cmd->AppendSwitch(switches::kWaitForDebugger); | 1288 renderer_cmd->AppendSwitch(switches::kWaitForDebugger); |
1289 } | 1289 } |
1290 } | 1290 } |
1291 } | 1291 } |
1292 | 1292 |
1293 base::ProcessHandle RenderProcessHostImpl::GetHandle() const { | 1293 base::ProcessHandle RenderProcessHostImpl::GetHandle() const { |
1294 if (run_renderer_in_process()) | 1294 if (run_renderer_in_process()) |
1295 return base::Process::Current().handle(); | 1295 return base::GetCurrentProcessHandle(); |
1296 | 1296 |
1297 if (!child_process_launcher_.get() || child_process_launcher_->IsStarting()) | 1297 if (!child_process_launcher_.get() || child_process_launcher_->IsStarting()) |
1298 return base::kNullProcessHandle; | 1298 return base::kNullProcessHandle; |
1299 | 1299 |
1300 return child_process_launcher_->GetHandle(); | 1300 return child_process_launcher_->GetProcess().Handle(); |
1301 } | 1301 } |
1302 | 1302 |
1303 bool RenderProcessHostImpl::FastShutdownIfPossible() { | 1303 bool RenderProcessHostImpl::FastShutdownIfPossible() { |
1304 if (run_renderer_in_process()) | 1304 if (run_renderer_in_process()) |
1305 return false; // Single process mode never shutdown the renderer. | 1305 return false; // Single process mode never shutdown the renderer. |
1306 | 1306 |
1307 if (!GetContentClient()->browser()->IsFastShutdownPossible()) | 1307 if (!GetContentClient()->browser()->IsFastShutdownPossible()) |
1308 return false; | 1308 return false; |
1309 | 1309 |
1310 if (!child_process_launcher_.get() || | 1310 if (!child_process_launcher_.get() || |
(...skipping 768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2079 | 2079 |
2080 void RenderProcessHostImpl::OnProcessLaunched() { | 2080 void RenderProcessHostImpl::OnProcessLaunched() { |
2081 // No point doing anything, since this object will be destructed soon. We | 2081 // No point doing anything, since this object will be destructed soon. We |
2082 // especially don't want to send the RENDERER_PROCESS_CREATED notification, | 2082 // especially don't want to send the RENDERER_PROCESS_CREATED notification, |
2083 // since some clients might expect a RENDERER_PROCESS_TERMINATED afterwards to | 2083 // since some clients might expect a RENDERER_PROCESS_TERMINATED afterwards to |
2084 // properly cleanup. | 2084 // properly cleanup. |
2085 if (deleting_soon_) | 2085 if (deleting_soon_) |
2086 return; | 2086 return; |
2087 | 2087 |
2088 if (child_process_launcher_) { | 2088 if (child_process_launcher_) { |
2089 if (!child_process_launcher_->GetHandle()) { | 2089 DCHECK(child_process_launcher_->GetProcess().IsValid()); |
2090 OnChannelError(); | |
2091 return; | |
2092 } | |
2093 | |
2094 SetBackgrounded(backgrounded_); | 2090 SetBackgrounded(backgrounded_); |
2095 } | 2091 } |
2096 | 2092 |
2097 // NOTE: This needs to be before sending queued messages because | 2093 // NOTE: This needs to be before sending queued messages because |
2098 // ExtensionService uses this notification to initialize the renderer process | 2094 // ExtensionService uses this notification to initialize the renderer process |
2099 // with state that must be there before any JavaScript executes. | 2095 // with state that must be there before any JavaScript executes. |
2100 // | 2096 // |
2101 // The queued messages contain such things as "navigate". If this notification | 2097 // The queued messages contain such things as "navigate". If this notification |
2102 // was after, we can end up executing JavaScript before the initialization | 2098 // was after, we can end up executing JavaScript before the initialization |
2103 // happens. | 2099 // happens. |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2252 if (worker_ref_count_ == 0) | 2248 if (worker_ref_count_ == 0) |
2253 Cleanup(); | 2249 Cleanup(); |
2254 } | 2250 } |
2255 | 2251 |
2256 void RenderProcessHostImpl::EnsureMojoActivated() { | 2252 void RenderProcessHostImpl::EnsureMojoActivated() { |
2257 mojo_activation_required_ = true; | 2253 mojo_activation_required_ = true; |
2258 MaybeActivateMojo(); | 2254 MaybeActivateMojo(); |
2259 } | 2255 } |
2260 | 2256 |
2261 } // namespace content | 2257 } // namespace content |
OLD | NEW |