| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 #include "base/sys_info.h" | 45 #include "base/sys_info.h" |
| 46 #include "base/threading/thread.h" | 46 #include "base/threading/thread.h" |
| 47 #include "base/threading/thread_restrictions.h" | 47 #include "base/threading/thread_restrictions.h" |
| 48 #include "base/threading/thread_task_runner_handle.h" | 48 #include "base/threading/thread_task_runner_handle.h" |
| 49 #include "base/trace_event/trace_event.h" | 49 #include "base/trace_event/trace_event.h" |
| 50 #include "base/tracked_objects.h" | 50 #include "base/tracked_objects.h" |
| 51 #include "build/build_config.h" | 51 #include "build/build_config.h" |
| 52 #include "cc/base/switches.h" | 52 #include "cc/base/switches.h" |
| 53 #include "cc/output/buffer_to_texture_target_map.h" | 53 #include "cc/output/buffer_to_texture_target_map.h" |
| 54 #include "components/discardable_memory/service/discardable_shared_memory_manage
r.h" | 54 #include "components/discardable_memory/service/discardable_shared_memory_manage
r.h" |
| 55 #include "components/display_compositor/host_shared_bitmap_manager.h" |
| 55 #include "components/tracing/common/tracing_switches.h" | 56 #include "components/tracing/common/tracing_switches.h" |
| 56 #include "content/browser/appcache/appcache_dispatcher_host.h" | 57 #include "content/browser/appcache/appcache_dispatcher_host.h" |
| 57 #include "content/browser/appcache/chrome_appcache_service.h" | 58 #include "content/browser/appcache/chrome_appcache_service.h" |
| 58 #include "content/browser/background_sync/background_sync_service_impl.h" | 59 #include "content/browser/background_sync/background_sync_service_impl.h" |
| 59 #include "content/browser/bad_message.h" | 60 #include "content/browser/bad_message.h" |
| 60 #include "content/browser/blob_storage/blob_dispatcher_host.h" | 61 #include "content/browser/blob_storage/blob_dispatcher_host.h" |
| 61 #include "content/browser/blob_storage/chrome_blob_storage_context.h" | 62 #include "content/browser/blob_storage/chrome_blob_storage_context.h" |
| 62 #include "content/browser/broadcast_channel/broadcast_channel_provider.h" | 63 #include "content/browser/broadcast_channel/broadcast_channel_provider.h" |
| 63 #include "content/browser/browser_child_process_host_impl.h" | 64 #include "content/browser/browser_child_process_host_impl.h" |
| 64 #include "content/browser/browser_main.h" | 65 #include "content/browser/browser_main.h" |
| (...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 700 id_, | 701 id_, |
| 701 storage_partition_impl_->GetURLRequestContext(), | 702 storage_partition_impl_->GetURLRequestContext(), |
| 702 storage_partition_impl_->GetIndexedDBContext(), | 703 storage_partition_impl_->GetIndexedDBContext(), |
| 703 ChromeBlobStorageContext::GetFor(browser_context_))), | 704 ChromeBlobStorageContext::GetFor(browser_context_))), |
| 704 channel_connected_(false), | 705 channel_connected_(false), |
| 705 sent_render_process_ready_(false), | 706 sent_render_process_ready_(false), |
| 706 #if defined(OS_ANDROID) | 707 #if defined(OS_ANDROID) |
| 707 never_signaled_(base::WaitableEvent::ResetPolicy::MANUAL, | 708 never_signaled_(base::WaitableEvent::ResetPolicy::MANUAL, |
| 708 base::WaitableEvent::InitialState::NOT_SIGNALED), | 709 base::WaitableEvent::InitialState::NOT_SIGNALED), |
| 709 #endif | 710 #endif |
| 711 bitmap_manager_client_( |
| 712 display_compositor::HostSharedBitmapManager::current()), |
| 710 instance_weak_factory_( | 713 instance_weak_factory_( |
| 711 new base::WeakPtrFactory<RenderProcessHostImpl>(this)), | 714 new base::WeakPtrFactory<RenderProcessHostImpl>(this)), |
| 712 weak_factory_(this) { | 715 weak_factory_(this) { |
| 713 widget_helper_ = new RenderWidgetHelper(); | 716 widget_helper_ = new RenderWidgetHelper(); |
| 714 | 717 |
| 715 ChildProcessSecurityPolicyImpl::GetInstance()->Add(GetID()); | 718 ChildProcessSecurityPolicyImpl::GetInstance()->Add(GetID()); |
| 716 | 719 |
| 717 CHECK(!BrowserMainRunner::ExitedMainMessageLoop()); | 720 CHECK(!BrowserMainRunner::ExitedMainMessageLoop()); |
| 718 RegisterHost(GetID(), this); | 721 RegisterHost(GetID(), this); |
| 719 g_all_hosts.Get().set_check_on_null_data(true); | 722 g_all_hosts.Get().set_check_on_null_data(true); |
| (...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1329 // Chrome browser process only provides DiscardableSharedMemory service when | 1332 // Chrome browser process only provides DiscardableSharedMemory service when |
| 1330 // Chrome is not running in mus+ash. | 1333 // Chrome is not running in mus+ash. |
| 1331 if (!service_manager::ServiceManagerIsRemote()) { | 1334 if (!service_manager::ServiceManagerIsRemote()) { |
| 1332 discardable_memory::DiscardableSharedMemoryManager* manager = | 1335 discardable_memory::DiscardableSharedMemoryManager* manager = |
| 1333 BrowserMainLoop::GetInstance()->discardable_shared_memory_manager(); | 1336 BrowserMainLoop::GetInstance()->discardable_shared_memory_manager(); |
| 1334 registry->AddInterface( | 1337 registry->AddInterface( |
| 1335 base::Bind(&discardable_memory::DiscardableSharedMemoryManager::Bind, | 1338 base::Bind(&discardable_memory::DiscardableSharedMemoryManager::Bind, |
| 1336 base::Unretained(manager))); | 1339 base::Unretained(manager))); |
| 1337 } | 1340 } |
| 1338 | 1341 |
| 1342 registry->AddInterface( |
| 1343 base::Bind(&display_compositor::HostSharedBitmapManagerClient::Bind, |
| 1344 base::Unretained(&bitmap_manager_client_))); |
| 1345 |
| 1339 GetContentClient()->browser()->ExposeInterfacesToRenderer(registry.get(), | 1346 GetContentClient()->browser()->ExposeInterfacesToRenderer(registry.get(), |
| 1340 this); | 1347 this); |
| 1341 | 1348 |
| 1342 ServiceManagerConnection* service_manager_connection = | 1349 ServiceManagerConnection* service_manager_connection = |
| 1343 BrowserContext::GetServiceManagerConnectionFor(browser_context_); | 1350 BrowserContext::GetServiceManagerConnectionFor(browser_context_); |
| 1344 std::unique_ptr<ConnectionFilterImpl> connection_filter( | 1351 std::unique_ptr<ConnectionFilterImpl> connection_filter( |
| 1345 new ConnectionFilterImpl(child_connection_->child_identity(), | 1352 new ConnectionFilterImpl(child_connection_->child_identity(), |
| 1346 std::move(registry))); | 1353 std::move(registry))); |
| 1347 connection_filter_controller_ = connection_filter->controller(); | 1354 connection_filter_controller_ = connection_filter->controller(); |
| 1348 connection_filter_id_ = service_manager_connection->AddConnectionFilter( | 1355 connection_filter_id_ = service_manager_connection->AddConnectionFilter( |
| (...skipping 1717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3066 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error; | 3073 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error; |
| 3067 | 3074 |
| 3068 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. | 3075 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. |
| 3069 // Capture the error message in a crash key value. | 3076 // Capture the error message in a crash key value. |
| 3070 base::debug::ScopedCrashKey error_key_value("mojo-message-error", error); | 3077 base::debug::ScopedCrashKey error_key_value("mojo-message-error", error); |
| 3071 bad_message::ReceivedBadMessage(render_process_id, | 3078 bad_message::ReceivedBadMessage(render_process_id, |
| 3072 bad_message::RPH_MOJO_PROCESS_ERROR); | 3079 bad_message::RPH_MOJO_PROCESS_ERROR); |
| 3073 } | 3080 } |
| 3074 | 3081 |
| 3075 } // namespace content | 3082 } // namespace content |
| OLD | NEW |