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

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

Issue 7712022: This patch caused Chrome to be unable to load any web pages on Chrome OS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 4 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 | « content/browser/browser_child_process_host.cc ('k') | ipc/ipc_channel.h » ('j') | 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) 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 // 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/browser_render_process_host.h" 8 #include "content/browser/renderer_host/browser_render_process_host.h"
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 // Find the renderer before creating the channel so if this fails early we 273 // Find the renderer before creating the channel so if this fails early we
274 // return without creating the channel. 274 // return without creating the channel.
275 FilePath renderer_path = 275 FilePath renderer_path =
276 ChildProcessHost::GetChildPath(renderer_prefix.empty()); 276 ChildProcessHost::GetChildPath(renderer_prefix.empty());
277 if (renderer_path.empty()) 277 if (renderer_path.empty())
278 return false; 278 return false;
279 279
280 // Setup the IPC channel. 280 // Setup the IPC channel.
281 const std::string channel_id = 281 const std::string channel_id =
282 ChildProcessInfo::GenerateRandomChannelID(this); 282 ChildProcessInfo::GenerateRandomChannelID(this);
283 #if defined(OS_LINUX)
284 // See IPC::Channel::SetNeedsOverridePeerPid() for details.
285 const bool needs_override_peer_pid = true;
286 #else
287 const bool needs_override_peer_pid = false;
288 #endif
289 channel_.reset(new IPC::ChannelProxy( 283 channel_.reset(new IPC::ChannelProxy(
290 channel_id, IPC::Channel::MODE_SERVER, this, 284 channel_id, IPC::Channel::MODE_SERVER, this,
291 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), 285 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)));
292 needs_override_peer_pid));
293 286
294 // Call the embedder first so that their IPC filters have priority. 287 // Call the embedder first so that their IPC filters have priority.
295 content::GetContentClient()->browser()->BrowserRenderProcessHostCreated(this); 288 content::GetContentClient()->browser()->BrowserRenderProcessHostCreated(this);
296 289
297 CreateMessageFilters(); 290 CreateMessageFilters();
298 291
299 if (run_renderer_in_process()) { 292 if (run_renderer_in_process()) {
300 // Crank up a thread and run the initialization there. With the way that 293 // Crank up a thread and run the initialization there. With the way that
301 // messages flow between the browser and renderer, this thread is required 294 // messages flow between the browser and renderer, this thread is required
302 // to prevent a deadlock in single-process mode. Since the primordial 295 // to prevent a deadlock in single-process mode. Since the primordial
(...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after
891 } 884 }
892 885
893 void BrowserRenderProcessHost::OnProcessLaunched() { 886 void BrowserRenderProcessHost::OnProcessLaunched() {
894 // No point doing anything, since this object will be destructed soon. We 887 // No point doing anything, since this object will be destructed soon. We
895 // especially don't want to send the RENDERER_PROCESS_CREATED notification, 888 // especially don't want to send the RENDERER_PROCESS_CREATED notification,
896 // since some clients might expect a RENDERER_PROCESS_TERMINATED afterwards to 889 // since some clients might expect a RENDERER_PROCESS_TERMINATED afterwards to
897 // properly cleanup. 890 // properly cleanup.
898 if (deleting_soon_) 891 if (deleting_soon_)
899 return; 892 return;
900 893
901 if (child_process_launcher_.get()) { 894 if (child_process_launcher_.get())
902 child_process_launcher_->SetProcessBackgrounded(backgrounded_); 895 child_process_launcher_->SetProcessBackgrounded(backgrounded_);
903 #if defined(OS_LINUX)
904 // Inform the IPC subsystem of the global PID for this sandboxed renderer.
905 if (channel_.get()) {
906 base::ProcessHandle child_handle = child_process_launcher_->GetHandle();
907 base::ProcessId child_pid = base::GetProcId(child_handle);
908 channel_->OverridePeerPid(child_pid);
909 }
910 #endif
911 }
912 896
913 if (max_page_id_ != -1) 897 if (max_page_id_ != -1)
914 Send(new ViewMsg_SetNextPageID(max_page_id_ + 1)); 898 Send(new ViewMsg_SetNextPageID(max_page_id_ + 1));
915 899
916 // NOTE: This needs to be before sending queued messages because 900 // NOTE: This needs to be before sending queued messages because
917 // ExtensionService uses this notification to initialize the renderer process 901 // ExtensionService uses this notification to initialize the renderer process
918 // with state that must be there before any JavaScript executes. 902 // with state that must be there before any JavaScript executes.
919 // 903 //
920 // The queued messages contain such things as "navigate". If this notification 904 // The queued messages contain such things as "navigate". If this notification
921 // was after, we can end up executing JavaScript before the initialization 905 // was after, we can end up executing JavaScript before the initialization
(...skipping 16 matching lines...) Expand all
938 void BrowserRenderProcessHost::OnRevealFolderInOS(const FilePath& path) { 922 void BrowserRenderProcessHost::OnRevealFolderInOS(const FilePath& path) {
939 // Only honor the request if appropriate persmissions are granted. 923 // Only honor the request if appropriate persmissions are granted.
940 if (ChildProcessSecurityPolicy::GetInstance()->CanReadFile(id(), path)) 924 if (ChildProcessSecurityPolicy::GetInstance()->CanReadFile(id(), path))
941 content::GetContentClient()->browser()->OpenItem(path); 925 content::GetContentClient()->browser()->OpenItem(path);
942 } 926 }
943 927
944 void BrowserRenderProcessHost::OnSavedPageAsMHTML(int job_id, bool success) { 928 void BrowserRenderProcessHost::OnSavedPageAsMHTML(int job_id, bool success) {
945 content::GetContentClient()->browser()->GetMHTMLGenerationManager()-> 929 content::GetContentClient()->browser()->GetMHTMLGenerationManager()->
946 MHTMLGenerated(job_id, success); 930 MHTMLGenerated(job_id, success);
947 } 931 }
OLDNEW
« no previous file with comments | « content/browser/browser_child_process_host.cc ('k') | ipc/ipc_channel.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698