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