Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(289)

Side by Side Diff: content/browser/renderer_host/render_process_host_impl.cc

Issue 651253002: Enforce handle ownership in base::Process (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1276 matching lines...) Expand 10 before | Expand all | Expand 10 after
1287 } 1287 }
1288 } 1288 }
1289 1289
1290 base::ProcessHandle RenderProcessHostImpl::GetHandle() const { 1290 base::ProcessHandle RenderProcessHostImpl::GetHandle() const {
1291 if (run_renderer_in_process()) 1291 if (run_renderer_in_process())
1292 return base::Process::Current().handle(); 1292 return base::Process::Current().handle();
1293 1293
1294 if (!child_process_launcher_.get() || child_process_launcher_->IsStarting()) 1294 if (!child_process_launcher_.get() || child_process_launcher_->IsStarting())
1295 return base::kNullProcessHandle; 1295 return base::kNullProcessHandle;
1296 1296
1297 return child_process_launcher_->GetHandle(); 1297 return child_process_launcher_->GetProcess().Handle();
1298 } 1298 }
1299 1299
1300 bool RenderProcessHostImpl::FastShutdownIfPossible() { 1300 bool RenderProcessHostImpl::FastShutdownIfPossible() {
1301 if (run_renderer_in_process()) 1301 if (run_renderer_in_process())
1302 return false; // Single process mode never shutdown the renderer. 1302 return false; // Single process mode never shutdown the renderer.
1303 1303
1304 if (!GetContentClient()->browser()->IsFastShutdownPossible()) 1304 if (!GetContentClient()->browser()->IsFastShutdownPossible())
1305 return false; 1305 return false;
1306 1306
1307 if (!child_process_launcher_.get() || 1307 if (!child_process_launcher_.get() ||
(...skipping 768 matching lines...) Expand 10 before | Expand all | Expand 10 after
2076 2076
2077 void RenderProcessHostImpl::OnProcessLaunched() { 2077 void RenderProcessHostImpl::OnProcessLaunched() {
2078 // No point doing anything, since this object will be destructed soon. We 2078 // No point doing anything, since this object will be destructed soon. We
2079 // especially don't want to send the RENDERER_PROCESS_CREATED notification, 2079 // especially don't want to send the RENDERER_PROCESS_CREATED notification,
2080 // since some clients might expect a RENDERER_PROCESS_TERMINATED afterwards to 2080 // since some clients might expect a RENDERER_PROCESS_TERMINATED afterwards to
2081 // properly cleanup. 2081 // properly cleanup.
2082 if (deleting_soon_) 2082 if (deleting_soon_)
2083 return; 2083 return;
2084 2084
2085 if (child_process_launcher_) { 2085 if (child_process_launcher_) {
2086 if (!child_process_launcher_->GetHandle()) { 2086 DCHECK(child_process_launcher_->GetProcess().IsValid());
2087 OnChannelError();
2088 return;
2089 }
2090
2091 SetBackgrounded(backgrounded_); 2087 SetBackgrounded(backgrounded_);
2092 } 2088 }
2093 2089
2094 // NOTE: This needs to be before sending queued messages because 2090 // NOTE: This needs to be before sending queued messages because
2095 // ExtensionService uses this notification to initialize the renderer process 2091 // ExtensionService uses this notification to initialize the renderer process
2096 // with state that must be there before any JavaScript executes. 2092 // with state that must be there before any JavaScript executes.
2097 // 2093 //
2098 // The queued messages contain such things as "navigate". If this notification 2094 // The queued messages contain such things as "navigate". If this notification
2099 // was after, we can end up executing JavaScript before the initialization 2095 // was after, we can end up executing JavaScript before the initialization
2100 // happens. 2096 // happens.
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
2249 if (worker_ref_count_ == 0) 2245 if (worker_ref_count_ == 0)
2250 Cleanup(); 2246 Cleanup();
2251 } 2247 }
2252 2248
2253 void RenderProcessHostImpl::EnsureMojoActivated() { 2249 void RenderProcessHostImpl::EnsureMojoActivated() {
2254 mojo_activation_required_ = true; 2250 mojo_activation_required_ = true;
2255 MaybeActivateMojo(); 2251 MaybeActivateMojo();
2256 } 2252 }
2257 2253
2258 } // namespace content 2254 } // namespace content
OLDNEW
« content/browser/child_process_launcher.cc ('K') | « content/browser/child_process_launcher.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698