Chromium Code Reviews| 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 #if defined(OS_WIN) | 10 #if defined(OS_WIN) |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 104 #include "content/public/common/content_switches.h" | 104 #include "content/public/common/content_switches.h" |
| 105 #include "content/public/common/process_type.h" | 105 #include "content/public/common/process_type.h" |
| 106 #include "content/public/common/result_codes.h" | 106 #include "content/public/common/result_codes.h" |
| 107 #include "content/public/common/url_constants.h" | 107 #include "content/public/common/url_constants.h" |
| 108 #include "content/renderer/render_process_impl.h" | 108 #include "content/renderer/render_process_impl.h" |
| 109 #include "content/renderer/render_thread_impl.h" | 109 #include "content/renderer/render_thread_impl.h" |
| 110 #include "ipc/ipc_channel.h" | 110 #include "ipc/ipc_channel.h" |
| 111 #include "ipc/ipc_logging.h" | 111 #include "ipc/ipc_logging.h" |
| 112 #include "ipc/ipc_platform_file.h" | 112 #include "ipc/ipc_platform_file.h" |
| 113 #include "ipc/ipc_switches.h" | 113 #include "ipc/ipc_switches.h" |
| 114 #include "ipc/ipc_sync_channel.h" | |
| 114 #include "media/base/media_switches.h" | 115 #include "media/base/media_switches.h" |
| 115 #include "net/url_request/url_request_context_getter.h" | 116 #include "net/url_request/url_request_context_getter.h" |
| 116 #include "ui/base/ui_base_switches.h" | 117 #include "ui/base/ui_base_switches.h" |
| 117 #include "ui/gl/gl_switches.h" | 118 #include "ui/gl/gl_switches.h" |
| 118 #include "webkit/fileapi/sandbox_mount_point_provider.h" | 119 #include "webkit/fileapi/sandbox_mount_point_provider.h" |
| 119 #include "webkit/glue/resource_type.h" | 120 #include "webkit/glue/resource_type.h" |
| 120 #include "webkit/plugins/plugin_switches.h" | 121 #include "webkit/plugins/plugin_switches.h" |
| 121 | 122 |
| 122 #if defined(OS_WIN) | 123 #if defined(OS_WIN) |
| 123 #include "content/common/font_cache_dispatcher_win.h" | 124 #include "content/common/font_cache_dispatcher_win.h" |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 336 backgrounded_(true), | 337 backgrounded_(true), |
| 337 ALLOW_THIS_IN_INITIALIZER_LIST(cached_dibs_cleaner_( | 338 ALLOW_THIS_IN_INITIALIZER_LIST(cached_dibs_cleaner_( |
| 338 FROM_HERE, base::TimeDelta::FromSeconds(5), | 339 FROM_HERE, base::TimeDelta::FromSeconds(5), |
| 339 this, &RenderProcessHostImpl::ClearTransportDIBCache)), | 340 this, &RenderProcessHostImpl::ClearTransportDIBCache)), |
| 340 is_initialized_(false), | 341 is_initialized_(false), |
| 341 id_(ChildProcessHostImpl::GenerateChildProcessUniqueId()), | 342 id_(ChildProcessHostImpl::GenerateChildProcessUniqueId()), |
| 342 browser_context_(browser_context), | 343 browser_context_(browser_context), |
| 343 storage_partition_impl_(storage_partition_impl), | 344 storage_partition_impl_(storage_partition_impl), |
| 344 sudden_termination_allowed_(true), | 345 sudden_termination_allowed_(true), |
| 345 ignore_input_events_(false), | 346 ignore_input_events_(false), |
| 347 #if defined(OS_ANDROID) | |
| 348 dummy_shutdown_event_(false, false), | |
| 349 #endif | |
| 346 is_guest_(is_guest) { | 350 is_guest_(is_guest) { |
| 347 widget_helper_ = new RenderWidgetHelper(); | 351 widget_helper_ = new RenderWidgetHelper(); |
| 348 | 352 |
| 349 ChildProcessSecurityPolicyImpl::GetInstance()->Add(GetID()); | 353 ChildProcessSecurityPolicyImpl::GetInstance()->Add(GetID()); |
| 350 | 354 |
| 351 // Grant most file permissions to this renderer. | 355 // Grant most file permissions to this renderer. |
| 352 // PLATFORM_FILE_TEMPORARY, PLATFORM_FILE_HIDDEN and | 356 // PLATFORM_FILE_TEMPORARY, PLATFORM_FILE_HIDDEN and |
| 353 // PLATFORM_FILE_DELETE_ON_CLOSE are not granted, because no existing API | 357 // PLATFORM_FILE_DELETE_ON_CLOSE are not granted, because no existing API |
| 354 // requests them. | 358 // requests them. |
| 355 // This is for the filesystem sandbox. | 359 // This is for the filesystem sandbox. |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 443 | 447 |
| 444 // Find the renderer before creating the channel so if this fails early we | 448 // Find the renderer before creating the channel so if this fails early we |
| 445 // return without creating the channel. | 449 // return without creating the channel. |
| 446 FilePath renderer_path = ChildProcessHost::GetChildPath(flags); | 450 FilePath renderer_path = ChildProcessHost::GetChildPath(flags); |
| 447 if (renderer_path.empty()) | 451 if (renderer_path.empty()) |
| 448 return false; | 452 return false; |
| 449 | 453 |
| 450 // Setup the IPC channel. | 454 // Setup the IPC channel. |
| 451 const std::string channel_id = | 455 const std::string channel_id = |
| 452 IPC::Channel::GenerateVerifiedChannelID(std::string()); | 456 IPC::Channel::GenerateVerifiedChannelID(std::string()); |
| 457 #if defined(OS_ANDROID) | |
| 458 // Android WebView needs to be able to wait from the UI thread to support | |
| 459 // the synchronous legacy APIs. | |
| 460 channel_.reset(new IPC::SyncChannel( | |
|
jam
2012/09/19 16:55:43
please make this conditional on webview (either ru
Leandro Graciá Gil
2012/09/19 18:08:59
We're currently working on this, but haven't found
jam
2012/09/19 19:37:56
I can't make any recommendations since I'm not fam
| |
| 461 channel_id, IPC::Channel::MODE_SERVER, this, | |
| 462 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), | |
| 463 true, &dummy_shutdown_event_)); | |
| 464 #else | |
| 453 channel_.reset(new IPC::ChannelProxy( | 465 channel_.reset(new IPC::ChannelProxy( |
| 454 channel_id, IPC::Channel::MODE_SERVER, this, | 466 channel_id, IPC::Channel::MODE_SERVER, this, |
| 455 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO))); | 467 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO))); |
| 468 #endif | |
| 456 | 469 |
| 457 // Call the embedder first so that their IPC filters have priority. | 470 // Call the embedder first so that their IPC filters have priority. |
| 458 GetContentClient()->browser()->RenderProcessHostCreated(this); | 471 GetContentClient()->browser()->RenderProcessHostCreated(this); |
| 459 | 472 |
| 460 CreateMessageFilters(); | 473 CreateMessageFilters(); |
| 461 | 474 |
| 462 if (run_renderer_in_process()) { | 475 if (run_renderer_in_process()) { |
| 463 // Crank up a thread and run the initialization there. With the way that | 476 // Crank up a thread and run the initialization there. With the way that |
| 464 // messages flow between the browser and renderer, this thread is required | 477 // messages flow between the browser and renderer, this thread is required |
| 465 // to prevent a deadlock in single-process mode. Since the primordial | 478 // to prevent a deadlock in single-process mode. Since the primordial |
| (...skipping 1083 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1549 const gfx::Size& size, | 1562 const gfx::Size& size, |
| 1550 int32 gpu_process_host_id) { | 1563 int32 gpu_process_host_id) { |
| 1551 TRACE_EVENT0("renderer_host", | 1564 TRACE_EVENT0("renderer_host", |
| 1552 "RenderWidgetHostImpl::OnCompositorSurfaceBuffersSwappedNoHost"); | 1565 "RenderWidgetHostImpl::OnCompositorSurfaceBuffersSwappedNoHost"); |
| 1553 RenderWidgetHostImpl::AcknowledgeBufferPresent(route_id, | 1566 RenderWidgetHostImpl::AcknowledgeBufferPresent(route_id, |
| 1554 gpu_process_host_id, | 1567 gpu_process_host_id, |
| 1555 0); | 1568 0); |
| 1556 } | 1569 } |
| 1557 | 1570 |
| 1558 } // namespace content | 1571 } // namespace content |
| OLD | NEW |