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

Side by Side Diff: chrome/browser/worker_host/worker_process_host.cc

Issue 155015: Make workers functional on OSX and Linux. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 5 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/chrome.gyp » ('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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 #include "chrome/browser/worker_host/worker_process_host.h" 5 #include "chrome/browser/worker_host/worker_process_host.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug_util.h" 10 #include "base/debug_util.h"
11 #if defined(OS_POSIX)
12 #include "base/global_descriptors_posix.h"
13 #endif
11 #include "base/message_loop.h" 14 #include "base/message_loop.h"
12 #include "base/path_service.h" 15 #include "base/path_service.h"
13 #include "base/process_util.h" 16 #include "base/process_util.h"
14 #include "base/string_util.h" 17 #include "base/string_util.h"
15 #include "chrome/browser/browser_process.h" 18 #include "chrome/browser/browser_process.h"
16 #include "chrome/browser/child_process_security_policy.h" 19 #include "chrome/browser/child_process_security_policy.h"
17 #include "chrome/browser/renderer_host/render_view_host.h" 20 #include "chrome/browser/renderer_host/render_view_host.h"
18 #include "chrome/browser/worker_host/worker_service.h" 21 #include "chrome/browser/worker_host/worker_service.h"
22 #include "chrome/common/chrome_descriptors.h"
19 #include "chrome/common/chrome_switches.h" 23 #include "chrome/common/chrome_switches.h"
20 #include "chrome/common/debug_flags.h" 24 #include "chrome/common/debug_flags.h"
21 #include "chrome/common/process_watcher.h" 25 #include "chrome/common/process_watcher.h"
22 #include "chrome/common/render_messages.h" 26 #include "chrome/common/render_messages.h"
23 #include "chrome/common/worker_messages.h" 27 #include "chrome/common/worker_messages.h"
24 #include "net/base/registry_controlled_domain.h" 28 #include "net/base/registry_controlled_domain.h"
25 29
26 #if defined(OS_WIN) 30 #if defined(OS_WIN)
27 #include "chrome/browser/sandbox_policy.h" 31 #include "chrome/browser/sandbox_policy.h"
28 #endif 32 #endif
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 95
92 if (CommandLine::ForCurrentProcess()->HasSwitch( 96 if (CommandLine::ForCurrentProcess()->HasSwitch(
93 switches::kWebWorkerShareProcesses)) { 97 switches::kWebWorkerShareProcesses)) {
94 cmd_line.AppendSwitch(switches::kWebWorkerShareProcesses); 98 cmd_line.AppendSwitch(switches::kWebWorkerShareProcesses);
95 } 99 }
96 100
97 base::ProcessHandle process; 101 base::ProcessHandle process;
98 #if defined(OS_WIN) 102 #if defined(OS_WIN)
99 process = sandbox::StartProcess(&cmd_line); 103 process = sandbox::StartProcess(&cmd_line);
100 #else 104 #else
101 base::LaunchApp(cmd_line, false, false, &process); 105 // This code is duplicated with browser_render_process_host.cc, but
106 // there's not a good place to de-duplicate it.
107 base::file_handle_mapping_vector fds_to_map;
108 const int ipcfd = channel().GetClientFileDescriptor();
109 if (ipcfd > -1) {
110 fds_to_map.push_back(std::pair<int, int>(
111 ipcfd, kPrimaryIPCChannel + base::GlobalDescriptors::kBaseDescriptor));
jam 2009/07/13 23:30:22 nit: sorry I wasn't clear least time, two spaces o
112 }
113 base::LaunchApp(cmd_line.argv(), fds_to_map, false, &process);
102 #endif 114 #endif
103 if (!process) 115 if (!process)
104 return false; 116 return false;
105 SetHandle(process); 117 SetHandle(process);
106 118
107 ChildProcessSecurityPolicy::GetInstance()->Add(GetProcessId()); 119 ChildProcessSecurityPolicy::GetInstance()->Add(GetProcessId());
108 120
109 return true; 121 return true;
110 } 122 }
111 123
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 } 231 }
220 232
221 void WorkerProcessHost::OnCancelCreateDedicatedWorker(int route_id) { 233 void WorkerProcessHost::OnCancelCreateDedicatedWorker(int route_id) {
222 WorkerService::GetInstance()->CancelCreateDedicatedWorker( 234 WorkerService::GetInstance()->CancelCreateDedicatedWorker(
223 GetProcessId(), route_id); 235 GetProcessId(), route_id);
224 } 236 }
225 237
226 void WorkerProcessHost::OnForwardToWorker(const IPC::Message& message) { 238 void WorkerProcessHost::OnForwardToWorker(const IPC::Message& message) {
227 WorkerService::GetInstance()->ForwardMessage(message, GetProcessId()); 239 WorkerService::GetInstance()->ForwardMessage(message, GetProcessId());
228 } 240 }
OLDNEW
« no previous file with comments | « chrome/app/chrome_dll_main.cc ('k') | chrome/chrome.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698