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 // 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/render_process_host_impl.h" | 8 #include "content/browser/renderer_host/render_process_host_impl.h" |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 #include "ppapi/shared_impl/ppapi_switches.h" | 122 #include "ppapi/shared_impl/ppapi_switches.h" |
123 #include "ui/base/ui_base_switches.h" | 123 #include "ui/base/ui_base_switches.h" |
124 #include "ui/gl/gl_switches.h" | 124 #include "ui/gl/gl_switches.h" |
125 #include "webkit/fileapi/sandbox_mount_point_provider.h" | 125 #include "webkit/fileapi/sandbox_mount_point_provider.h" |
126 #include "webkit/glue/resource_type.h" | 126 #include "webkit/glue/resource_type.h" |
127 #include "webkit/plugins/plugin_switches.h" | 127 #include "webkit/plugins/plugin_switches.h" |
128 | 128 |
129 #if defined(OS_WIN) | 129 #if defined(OS_WIN) |
130 #include "base/win/scoped_com_initializer.h" | 130 #include "base/win/scoped_com_initializer.h" |
131 #include "content/common/font_cache_dispatcher_win.h" | 131 #include "content/common/font_cache_dispatcher_win.h" |
| 132 #include "content/common/sandbox_win.h" |
| 133 #include "content/public/common/sandboxed_process_launcher_delegate.h" |
132 #endif | 134 #endif |
133 | 135 |
134 #include "third_party/skia/include/core/SkBitmap.h" | 136 #include "third_party/skia/include/core/SkBitmap.h" |
135 | 137 |
136 extern bool g_exited_main_message_loop; | 138 extern bool g_exited_main_message_loop; |
137 | 139 |
138 static const char* kSiteProcessMapKeyName = "content_site_process_map"; | 140 static const char* kSiteProcessMapKeyName = "content_site_process_map"; |
139 | 141 |
140 namespace content { | 142 namespace content { |
141 namespace { | 143 namespace { |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 DCHECK(context); | 279 DCHECK(context); |
278 SiteProcessMap* map = static_cast<SiteProcessMap*>( | 280 SiteProcessMap* map = static_cast<SiteProcessMap*>( |
279 context->GetUserData(kSiteProcessMapKeyName)); | 281 context->GetUserData(kSiteProcessMapKeyName)); |
280 if (!map) { | 282 if (!map) { |
281 map = new SiteProcessMap(); | 283 map = new SiteProcessMap(); |
282 context->SetUserData(kSiteProcessMapKeyName, map); | 284 context->SetUserData(kSiteProcessMapKeyName, map); |
283 } | 285 } |
284 return map; | 286 return map; |
285 } | 287 } |
286 | 288 |
| 289 #if defined(OS_WIN) |
| 290 // NOTE: changes to this class need to be reviewed by the security team. |
| 291 class RendererSandboxedProcessLauncherDelegate |
| 292 : public content::SandboxedProcessLauncherDelegate { |
| 293 public: |
| 294 RendererSandboxedProcessLauncherDelegate() {} |
| 295 virtual ~RendererSandboxedProcessLauncherDelegate() {} |
| 296 |
| 297 virtual void PreSpawnTarget(sandbox::TargetPolicy* policy, |
| 298 bool* success) { |
| 299 AddBaseHandleClosePolicy(policy); |
| 300 GetContentClient()->browser()->PreSpawnRenderer(policy, success); |
| 301 } |
| 302 }; |
| 303 #endif // OS_WIN |
| 304 |
287 } // namespace | 305 } // namespace |
288 | 306 |
289 // Stores the maximum number of renderer processes the content module can | 307 // Stores the maximum number of renderer processes the content module can |
290 // create. | 308 // create. |
291 static size_t g_max_renderer_count_override = 0; | 309 static size_t g_max_renderer_count_override = 0; |
292 | 310 |
293 // static | 311 // static |
294 size_t RenderProcessHost::GetMaxRendererProcessCount() { | 312 size_t RenderProcessHost::GetMaxRendererProcessCount() { |
295 if (g_max_renderer_count_override) | 313 if (g_max_renderer_count_override) |
296 return g_max_renderer_count_override; | 314 return g_max_renderer_count_override; |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
481 if (!renderer_prefix.empty()) | 499 if (!renderer_prefix.empty()) |
482 cmd_line->PrependWrapper(renderer_prefix); | 500 cmd_line->PrependWrapper(renderer_prefix); |
483 AppendRendererCommandLine(cmd_line); | 501 AppendRendererCommandLine(cmd_line); |
484 cmd_line->AppendSwitchASCII(switches::kProcessChannelID, channel_id); | 502 cmd_line->AppendSwitchASCII(switches::kProcessChannelID, channel_id); |
485 | 503 |
486 // Spawn the child process asynchronously to avoid blocking the UI thread. | 504 // Spawn the child process asynchronously to avoid blocking the UI thread. |
487 // As long as there's no renderer prefix, we can use the zygote process | 505 // As long as there's no renderer prefix, we can use the zygote process |
488 // at this stage. | 506 // at this stage. |
489 child_process_launcher_.reset(new ChildProcessLauncher( | 507 child_process_launcher_.reset(new ChildProcessLauncher( |
490 #if defined(OS_WIN) | 508 #if defined(OS_WIN) |
491 base::FilePath(), | 509 new RendererSandboxedProcessLauncherDelegate, |
492 #elif defined(OS_POSIX) | 510 #elif defined(OS_POSIX) |
493 renderer_prefix.empty(), | 511 renderer_prefix.empty(), |
494 base::EnvironmentVector(), | 512 base::EnvironmentVector(), |
495 channel_->TakeClientFileDescriptor(), | 513 channel_->TakeClientFileDescriptor(), |
496 #endif | 514 #endif |
497 cmd_line, | 515 cmd_line, |
498 GetID(), | 516 GetID(), |
499 this)); | 517 this)); |
500 | 518 |
501 fast_shutdown_started_ = false; | 519 fast_shutdown_started_ = false; |
(...skipping 1177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1679 TRACE_EVENT0("renderer_host", | 1697 TRACE_EVENT0("renderer_host", |
1680 "RenderWidgetHostImpl::OnCompositorSurfaceBuffersSwappedNoHost"); | 1698 "RenderWidgetHostImpl::OnCompositorSurfaceBuffersSwappedNoHost"); |
1681 AcceleratedSurfaceMsg_BufferPresented_Params ack_params; | 1699 AcceleratedSurfaceMsg_BufferPresented_Params ack_params; |
1682 ack_params.sync_point = 0; | 1700 ack_params.sync_point = 0; |
1683 RenderWidgetHostImpl::AcknowledgeBufferPresent(route_id, | 1701 RenderWidgetHostImpl::AcknowledgeBufferPresent(route_id, |
1684 gpu_process_host_id, | 1702 gpu_process_host_id, |
1685 ack_params); | 1703 ack_params); |
1686 } | 1704 } |
1687 | 1705 |
1688 } // namespace content | 1706 } // namespace content |
OLD | NEW |