| 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 class RendererSandboxedProcessLauncherDelegate |
| 290 : public content::SandboxedProcessLauncherDelegate { |
| 291 public: |
| 292 RendererSandboxedProcessLauncherDelegate() {} |
| 293 virtual ~RendererSandboxedProcessLauncherDelegate() {} |
| 294 |
| 295 virtual void PreSpawnTarget(sandbox::TargetPolicy* policy, |
| 296 bool* success) { |
| 297 AddBaseHandleClosePolicy(policy); |
| 298 GetContentClient()->browser()->PreSpawnRenderer(policy, success); |
| 299 } |
| 300 }; |
| 301 #endif // OS_WIN |
| 302 |
| 286 } // namespace | 303 } // namespace |
| 287 | 304 |
| 288 // Stores the maximum number of renderer processes the content module can | 305 // Stores the maximum number of renderer processes the content module can |
| 289 // create. | 306 // create. |
| 290 static size_t g_max_renderer_count_override = 0; | 307 static size_t g_max_renderer_count_override = 0; |
| 291 | 308 |
| 292 // static | 309 // static |
| 293 size_t RenderProcessHost::GetMaxRendererProcessCount() { | 310 size_t RenderProcessHost::GetMaxRendererProcessCount() { |
| 294 if (g_max_renderer_count_override) | 311 if (g_max_renderer_count_override) |
| 295 return g_max_renderer_count_override; | 312 return g_max_renderer_count_override; |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 480 if (!renderer_prefix.empty()) | 497 if (!renderer_prefix.empty()) |
| 481 cmd_line->PrependWrapper(renderer_prefix); | 498 cmd_line->PrependWrapper(renderer_prefix); |
| 482 AppendRendererCommandLine(cmd_line); | 499 AppendRendererCommandLine(cmd_line); |
| 483 cmd_line->AppendSwitchASCII(switches::kProcessChannelID, channel_id); | 500 cmd_line->AppendSwitchASCII(switches::kProcessChannelID, channel_id); |
| 484 | 501 |
| 485 // Spawn the child process asynchronously to avoid blocking the UI thread. | 502 // 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 | 503 // As long as there's no renderer prefix, we can use the zygote process |
| 487 // at this stage. | 504 // at this stage. |
| 488 child_process_launcher_.reset(new ChildProcessLauncher( | 505 child_process_launcher_.reset(new ChildProcessLauncher( |
| 489 #if defined(OS_WIN) | 506 #if defined(OS_WIN) |
| 490 base::FilePath(), | 507 new RendererSandboxedProcessLauncherDelegate, |
| 491 #elif defined(OS_POSIX) | 508 #elif defined(OS_POSIX) |
| 492 renderer_prefix.empty(), | 509 renderer_prefix.empty(), |
| 493 base::EnvironmentVector(), | 510 base::EnvironmentVector(), |
| 494 channel_->TakeClientFileDescriptor(), | 511 channel_->TakeClientFileDescriptor(), |
| 495 #endif | 512 #endif |
| 496 cmd_line, | 513 cmd_line, |
| 497 GetID(), | 514 GetID(), |
| 498 this)); | 515 this)); |
| 499 | 516 |
| 500 fast_shutdown_started_ = false; | 517 fast_shutdown_started_ = false; |
| (...skipping 1165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1666 TRACE_EVENT0("renderer_host", | 1683 TRACE_EVENT0("renderer_host", |
| 1667 "RenderWidgetHostImpl::OnCompositorSurfaceBuffersSwappedNoHost"); | 1684 "RenderWidgetHostImpl::OnCompositorSurfaceBuffersSwappedNoHost"); |
| 1668 AcceleratedSurfaceMsg_BufferPresented_Params ack_params; | 1685 AcceleratedSurfaceMsg_BufferPresented_Params ack_params; |
| 1669 ack_params.sync_point = 0; | 1686 ack_params.sync_point = 0; |
| 1670 RenderWidgetHostImpl::AcknowledgeBufferPresent(route_id, | 1687 RenderWidgetHostImpl::AcknowledgeBufferPresent(route_id, |
| 1671 gpu_process_host_id, | 1688 gpu_process_host_id, |
| 1672 ack_params); | 1689 ack_params); |
| 1673 } | 1690 } |
| 1674 | 1691 |
| 1675 } // namespace content | 1692 } // namespace content |
| OLD | NEW |