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()); |
| 453 channel_.reset(new IPC::ChannelProxy( | 457 channel_.reset( |
| 454 channel_id, IPC::Channel::MODE_SERVER, this, | 458 #if defined(OS_ANDROID) |
| 455 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO))); | 459 // Android WebView needs to be able to wait from the UI thread to support |
| 460 // the synchronous legacy APIs. | |
| 461 browser_command_line.HasSwitch(switches::kEnableWebViewSynchronousAPIs) ? | |
| 462 new IPC::SyncChannel( | |
|
jam
2012/09/21 00:57:23
nit: need tabbing here
Leandro GraciĆ” Gil
2012/09/21 11:48:09
Done.
| |
| 463 channel_id, IPC::Channel::MODE_SERVER, this, | |
| 464 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), | |
| 465 true, &dummy_shutdown_event_) : | |
| 466 #endif | |
| 467 new IPC::ChannelProxy( | |
| 468 channel_id, IPC::Channel::MODE_SERVER, this, | |
| 469 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO))); | |
| 456 | 470 |
| 457 // Call the embedder first so that their IPC filters have priority. | 471 // Call the embedder first so that their IPC filters have priority. |
| 458 GetContentClient()->browser()->RenderProcessHostCreated(this); | 472 GetContentClient()->browser()->RenderProcessHostCreated(this); |
| 459 | 473 |
| 460 CreateMessageFilters(); | 474 CreateMessageFilters(); |
| 461 | 475 |
| 462 if (run_renderer_in_process()) { | 476 if (run_renderer_in_process()) { |
| 463 // Crank up a thread and run the initialization there. With the way that | 477 // 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 | 478 // messages flow between the browser and renderer, this thread is required |
| 465 // to prevent a deadlock in single-process mode. Since the primordial | 479 // to prevent a deadlock in single-process mode. Since the primordial |
| (...skipping 1085 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1551 const gfx::Size& size, | 1565 const gfx::Size& size, |
| 1552 int32 gpu_process_host_id) { | 1566 int32 gpu_process_host_id) { |
| 1553 TRACE_EVENT0("renderer_host", | 1567 TRACE_EVENT0("renderer_host", |
| 1554 "RenderWidgetHostImpl::OnCompositorSurfaceBuffersSwappedNoHost"); | 1568 "RenderWidgetHostImpl::OnCompositorSurfaceBuffersSwappedNoHost"); |
| 1555 RenderWidgetHostImpl::AcknowledgeBufferPresent(route_id, | 1569 RenderWidgetHostImpl::AcknowledgeBufferPresent(route_id, |
| 1556 gpu_process_host_id, | 1570 gpu_process_host_id, |
| 1557 0); | 1571 0); |
| 1558 } | 1572 } |
| 1559 | 1573 |
| 1560 } // namespace content | 1574 } // namespace content |
| OLD | NEW |