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

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

Issue 115773: Prototype implementation of zygotes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 6 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 | « chrome/app/chrome_dll_main.cc ('k') | chrome/common/ipc_channel_posix.cc » ('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) 2006-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2009 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"
11 11
12 #include <algorithm> 12 #include <algorithm>
13 13
14 #include "app/app_switches.h" 14 #include "app/app_switches.h"
15 #if defined(OS_WIN) 15 #if defined(OS_WIN)
16 #include "app/win_util.h" 16 #include "app/win_util.h"
17 #endif 17 #endif
18 #include "base/command_line.h" 18 #include "base/command_line.h"
19 #include "base/field_trial.h" 19 #include "base/field_trial.h"
20 #include "base/linked_ptr.h" 20 #include "base/linked_ptr.h"
21 #include "base/logging.h" 21 #include "base/logging.h"
22 #include "base/path_service.h" 22 #include "base/path_service.h"
23 #include "base/process_util.h" 23 #include "base/process_util.h"
24 #include "base/rand_util.h" 24 #include "base/rand_util.h"
25 #include "base/reserved_file_descriptors.h"
25 #include "base/scoped_ptr.h" 26 #include "base/scoped_ptr.h"
26 #include "base/shared_memory.h" 27 #include "base/shared_memory.h"
27 #include "base/singleton.h" 28 #include "base/singleton.h"
28 #include "base/string_util.h" 29 #include "base/string_util.h"
29 #include "base/thread.h" 30 #include "base/thread.h"
30 #include "chrome/browser/browser_process.h" 31 #include "chrome/browser/browser_process.h"
31 #include "chrome/browser/child_process_security_policy.h" 32 #include "chrome/browser/child_process_security_policy.h"
32 #include "chrome/browser/extensions/extension_message_service.h" 33 #include "chrome/browser/extensions/extension_message_service.h"
33 #include "chrome/browser/extensions/user_script_master.h" 34 #include "chrome/browser/extensions/user_script_master.h"
34 #include "chrome/browser/history/history.h" 35 #include "chrome/browser/history/history.h"
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 // there's not a good place to de-duplicate it. 338 // there's not a good place to de-duplicate it.
338 base::file_handle_mapping_vector fds_to_map; 339 base::file_handle_mapping_vector fds_to_map;
339 int src_fd = -1, dest_fd = -1; 340 int src_fd = -1, dest_fd = -1;
340 channel_->GetClientFileDescriptorMapping(&src_fd, &dest_fd); 341 channel_->GetClientFileDescriptorMapping(&src_fd, &dest_fd);
341 if (src_fd > -1) 342 if (src_fd > -1)
342 fds_to_map.push_back(std::pair<int, int>(src_fd, dest_fd)); 343 fds_to_map.push_back(std::pair<int, int>(src_fd, dest_fd));
343 #if defined(OS_LINUX) 344 #if defined(OS_LINUX)
344 const int crash_signal_fd = 345 const int crash_signal_fd =
345 Singleton<RenderCrashHandlerHostLinux>()->GetDeathSignalSocket(); 346 Singleton<RenderCrashHandlerHostLinux>()->GetDeathSignalSocket();
346 if (crash_signal_fd >= 0) 347 if (crash_signal_fd >= 0)
347 fds_to_map.push_back(std::make_pair(crash_signal_fd, 4)); 348 fds_to_map.push_back(std::make_pair(crash_signal_fd, kMagicCrashSignalFd)) ;
349 base::ForkApp(cmd_line.argv(), fds_to_map, &process);
350 #else
351 base::LaunchApp(cmd_line.argv(), fds_to_map, false, &process);
348 #endif 352 #endif
349 base::LaunchApp(cmd_line.argv(), fds_to_map, false, &process);
350 #endif 353 #endif
351 if (!process) { 354 if (!process) {
352 channel_.reset(); 355 channel_.reset();
353 return false; 356 return false;
354 } 357 }
355 process_.set_handle(process); 358 process_.set_handle(process);
356 SetProcessID(process_.pid()); 359 SetProcessID(process_.pid());
357 } 360 }
358 361
359 resource_message_filter->Init(pid()); 362 resource_message_filter->Init(pid());
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after
814 ExtensionMessageService* ems = ExtensionMessageService::GetInstance(context); 817 ExtensionMessageService* ems = ExtensionMessageService::GetInstance(context);
815 ems->AddEventListener(event_name, pid()); 818 ems->AddEventListener(event_name, pid());
816 } 819 }
817 820
818 void BrowserRenderProcessHost::OnExtensionRemoveListener( 821 void BrowserRenderProcessHost::OnExtensionRemoveListener(
819 const std::string& event_name) { 822 const std::string& event_name) {
820 URLRequestContext* context = profile()->GetRequestContext(); 823 URLRequestContext* context = profile()->GetRequestContext();
821 ExtensionMessageService* ems = ExtensionMessageService::GetInstance(context); 824 ExtensionMessageService* ems = ExtensionMessageService::GetInstance(context);
822 ems->RemoveEventListener(event_name, pid()); 825 ems->RemoveEventListener(event_name, pid());
823 } 826 }
OLDNEW
« no previous file with comments | « chrome/app/chrome_dll_main.cc ('k') | chrome/common/ipc_channel_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698