OLD | NEW |
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 #include "content/browser/worker_host/worker_process_host.h" | 5 #include "content/browser/worker_host/worker_process_host.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 17 matching lines...) Expand all Loading... |
28 #include "content/browser/renderer_host/database_message_filter.h" | 28 #include "content/browser/renderer_host/database_message_filter.h" |
29 #include "content/browser/renderer_host/file_utilities_message_filter.h" | 29 #include "content/browser/renderer_host/file_utilities_message_filter.h" |
30 #include "content/browser/renderer_host/render_view_host_delegate.h" | 30 #include "content/browser/renderer_host/render_view_host_delegate.h" |
31 #include "content/browser/renderer_host/render_view_host_impl.h" | 31 #include "content/browser/renderer_host/render_view_host_impl.h" |
32 #include "content/browser/renderer_host/socket_stream_dispatcher_host.h" | 32 #include "content/browser/renderer_host/socket_stream_dispatcher_host.h" |
33 #include "content/browser/resource_context_impl.h" | 33 #include "content/browser/resource_context_impl.h" |
34 #include "content/browser/worker_host/message_port_service.h" | 34 #include "content/browser/worker_host/message_port_service.h" |
35 #include "content/browser/worker_host/worker_message_filter.h" | 35 #include "content/browser/worker_host/worker_message_filter.h" |
36 #include "content/browser/worker_host/worker_service_impl.h" | 36 #include "content/browser/worker_host/worker_service_impl.h" |
37 #include "content/common/child_process_host_impl.h" | 37 #include "content/common/child_process_host_impl.h" |
38 #include "content/common/debug_flags.h" | |
39 #include "content/common/view_messages.h" | 38 #include "content/common/view_messages.h" |
40 #include "content/common/worker_messages.h" | 39 #include "content/common/worker_messages.h" |
41 #include "content/public/browser/browser_thread.h" | 40 #include "content/public/browser/browser_thread.h" |
42 #include "content/public/browser/content_browser_client.h" | 41 #include "content/public/browser/content_browser_client.h" |
43 #include "content/public/browser/user_metrics.h" | 42 #include "content/public/browser/user_metrics.h" |
44 #include "content/public/common/content_switches.h" | 43 #include "content/public/common/content_switches.h" |
45 #include "content/public/common/result_codes.h" | 44 #include "content/public/common/result_codes.h" |
46 #include "ipc/ipc_switches.h" | 45 #include "ipc/ipc_switches.h" |
47 #include "net/base/mime_util.h" | 46 #include "net/base/mime_util.h" |
48 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" | 47 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" |
49 #include "net/url_request/url_request_context_getter.h" | 48 #include "net/url_request/url_request_context_getter.h" |
50 #include "ui/base/ui_base_switches.h" | 49 #include "ui/base/ui_base_switches.h" |
51 #include "webkit/fileapi/file_system_context.h" | 50 #include "webkit/fileapi/file_system_context.h" |
52 #include "webkit/fileapi/sandbox_mount_point_provider.h" | 51 #include "webkit/fileapi/sandbox_mount_point_provider.h" |
53 #include "webkit/glue/resource_type.h" | 52 #include "webkit/glue/resource_type.h" |
54 | 53 |
| 54 #if defined(OS_WIN) |
| 55 #include "content/common/sandbox_win.h" |
| 56 #include "content/public/common/sandboxed_process_launcher_delegate.h" |
| 57 #endif |
| 58 |
55 namespace content { | 59 namespace content { |
56 namespace { | 60 namespace { |
57 | 61 |
| 62 #if defined(OS_WIN) |
| 63 class WorkerSandboxedProcessLauncherDelegate |
| 64 : public content::SandboxedProcessLauncherDelegate { |
| 65 public: |
| 66 WorkerSandboxedProcessLauncherDelegate() {} |
| 67 virtual ~WorkerSandboxedProcessLauncherDelegate() {} |
| 68 |
| 69 virtual void PreSpawnTarget(sandbox::TargetPolicy* policy, |
| 70 bool* success) { |
| 71 AddBaseHandleClosePolicy(policy); |
| 72 } |
| 73 }; |
| 74 #endif // OS_WIN |
| 75 |
58 // Helper class that we pass to SocketStreamDispatcherHost so that it can find | 76 // Helper class that we pass to SocketStreamDispatcherHost so that it can find |
59 // the right net::URLRequestContext for a request. | 77 // the right net::URLRequestContext for a request. |
60 class URLRequestContextSelector | 78 class URLRequestContextSelector |
61 : public ResourceMessageFilter::URLRequestContextSelector { | 79 : public ResourceMessageFilter::URLRequestContextSelector { |
62 public: | 80 public: |
63 explicit URLRequestContextSelector( | 81 explicit URLRequestContextSelector( |
64 net::URLRequestContextGetter* url_request_context, | 82 net::URLRequestContextGetter* url_request_context, |
65 net::URLRequestContextGetter* media_url_request_context) | 83 net::URLRequestContextGetter* media_url_request_context) |
66 : url_request_context_(url_request_context), | 84 : url_request_context_(url_request_context), |
67 media_url_request_context_(media_url_request_context) { | 85 media_url_request_context_(media_url_request_context) { |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 // launches a new xterm, and runs the worker process in gdb, reading | 202 // launches a new xterm, and runs the worker process in gdb, reading |
185 // optional commands from gdb_chrome file in the working directory. | 203 // optional commands from gdb_chrome file in the working directory. |
186 cmd_line->PrependWrapper("xterm -e gdb -x gdb_chrome --args"); | 204 cmd_line->PrependWrapper("xterm -e gdb -x gdb_chrome --args"); |
187 use_zygote = false; | 205 use_zygote = false; |
188 } | 206 } |
189 } | 207 } |
190 #endif | 208 #endif |
191 | 209 |
192 process_->Launch( | 210 process_->Launch( |
193 #if defined(OS_WIN) | 211 #if defined(OS_WIN) |
194 base::FilePath(), | 212 new WorkerSandboxedProcessLauncherDelegate, |
195 #elif defined(OS_POSIX) | 213 #elif defined(OS_POSIX) |
196 use_zygote, | 214 use_zygote, |
197 base::EnvironmentVector(), | 215 base::EnvironmentVector(), |
198 #endif | 216 #endif |
199 cmd_line); | 217 cmd_line); |
200 | 218 |
201 ChildProcessSecurityPolicyImpl::GetInstance()->AddWorker( | 219 ChildProcessSecurityPolicyImpl::GetInstance()->AddWorker( |
202 process_->GetData().id, render_process_id); | 220 process_->GetData().id, render_process_id); |
203 CreateMessageFilters(render_process_id); | 221 CreateMessageFilters(render_process_id); |
204 | 222 |
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
667 return false; | 685 return false; |
668 } | 686 } |
669 | 687 |
670 WorkerProcessHost::WorkerInstance::FilterInfo | 688 WorkerProcessHost::WorkerInstance::FilterInfo |
671 WorkerProcessHost::WorkerInstance::GetFilter() const { | 689 WorkerProcessHost::WorkerInstance::GetFilter() const { |
672 DCHECK(NumFilters() == 1); | 690 DCHECK(NumFilters() == 1); |
673 return *filters_.begin(); | 691 return *filters_.begin(); |
674 } | 692 } |
675 | 693 |
676 } // namespace content | 694 } // namespace content |
OLD | NEW |