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

Side by Side Diff: chrome/browser/renderer_host/browser_render_process_host.cc

Issue 18810: Close the handle to the child process after terminating it. This avoids... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 "chrome/browser/renderer_host/browser_render_process_host.h" 8 #include "chrome/browser/renderer_host/browser_render_process_host.h"
9 9
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after
564 // TODO(port): the above is the only reason this file pulls in 564 // TODO(port): the above is the only reason this file pulls in
565 // RenderWidgetHost and RenderViewHost. 565 // RenderWidgetHost and RenderViewHost.
566 // Perhaps IPC::Channel::Listener needs another method like CanTerminate()? 566 // Perhaps IPC::Channel::Listener needs another method like CanTerminate()?
567 // No matter what, some abstractions are getting broken here... 567 // No matter what, some abstractions are getting broken here...
568 NOTIMPLEMENTED(); 568 NOTIMPLEMENTED();
569 #endif 569 #endif
570 570
571 // Otherwise, we're allowed to just terminate the process. Using exit code 0 571 // Otherwise, we're allowed to just terminate the process. Using exit code 0
572 // means that UMA won't treat this as a renderer crash. 572 // means that UMA won't treat this as a renderer crash.
573 process_.Terminate(ResultCodes::NORMAL_EXIT); 573 process_.Terminate(ResultCodes::NORMAL_EXIT);
574 process_.Close();
574 return true; 575 return true;
575 } 576 }
576 577
577 bool BrowserRenderProcessHost::Send(IPC::Message* msg) { 578 bool BrowserRenderProcessHost::Send(IPC::Message* msg) {
578 if (!channel_.get()) { 579 if (!channel_.get()) {
579 delete msg; 580 delete msg;
580 return false; 581 return false;
581 } 582 }
582 return channel_->Send(msg); 583 return channel_->Send(msg);
583 } 584 }
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
782 // child processes determine the pid of the parent. 783 // child processes determine the pid of the parent.
783 // Build the channel ID. This is composed of a unique identifier for the 784 // Build the channel ID. This is composed of a unique identifier for the
784 // parent browser process, an identifier for the renderer/plugin instance, 785 // parent browser process, an identifier for the renderer/plugin instance,
785 // and a random component. We use a random component so that a hacked child 786 // and a random component. We use a random component so that a hacked child
786 // process can't cause denial of service by causing future named pipe creation 787 // process can't cause denial of service by causing future named pipe creation
787 // to fail. 788 // to fail.
788 return StringPrintf(L"%d.%x.%d", 789 return StringPrintf(L"%d.%x.%d",
789 base::GetCurrentProcId(), instance, 790 base::GetCurrentProcId(), instance,
790 base::RandInt(0, std::numeric_limits<int>::max())); 791 base::RandInt(0, std::numeric_limits<int>::max()));
791 } 792 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698