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 731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
742 storage_partition_impl_->GetIndexedDBContext(), | 742 storage_partition_impl_->GetIndexedDBContext(), |
743 ChromeBlobStorageContext::GetFor(browser_context_))), | 743 ChromeBlobStorageContext::GetFor(browser_context_))), |
744 channel_connected_(false), | 744 channel_connected_(false), |
745 sent_render_process_ready_(false), | 745 sent_render_process_ready_(false), |
746 #if defined(OS_ANDROID) | 746 #if defined(OS_ANDROID) |
747 never_signaled_(base::WaitableEvent::ResetPolicy::MANUAL, | 747 never_signaled_(base::WaitableEvent::ResetPolicy::MANUAL, |
748 base::WaitableEvent::InitialState::NOT_SIGNALED), | 748 base::WaitableEvent::InitialState::NOT_SIGNALED), |
749 #endif | 749 #endif |
750 instance_weak_factory_( | 750 instance_weak_factory_( |
751 new base::WeakPtrFactory<RenderProcessHostImpl>(this)), | 751 new base::WeakPtrFactory<RenderProcessHostImpl>(this)), |
752 frame_sink_provider_(id_), | |
753 weak_factory_(this) { | 752 weak_factory_(this) { |
754 widget_helper_ = new RenderWidgetHelper(); | 753 widget_helper_ = new RenderWidgetHelper(); |
755 | 754 |
756 ChildProcessSecurityPolicyImpl::GetInstance()->Add(GetID()); | 755 ChildProcessSecurityPolicyImpl::GetInstance()->Add(GetID()); |
757 | 756 |
758 CHECK(!BrowserMainRunner::ExitedMainMessageLoop()); | 757 CHECK(!BrowserMainRunner::ExitedMainMessageLoop()); |
759 RegisterHost(GetID(), this); | 758 RegisterHost(GetID(), this); |
760 g_all_hosts.Get().set_check_on_null_data(true); | 759 g_all_hosts.Get().set_check_on_null_data(true); |
761 // Initialize |child_process_activity_time_| to a reasonable value. | 760 // Initialize |child_process_activity_time_| to a reasonable value. |
762 mark_child_process_activity_time(); | 761 mark_child_process_activity_time(); |
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1279 registry.get(), | 1278 registry.get(), |
1280 base::Bind( | 1279 base::Bind( |
1281 &PaymentAppContextImpl::CreatePaymentManager, | 1280 &PaymentAppContextImpl::CreatePaymentManager, |
1282 base::Unretained(storage_partition_impl_->GetPaymentAppContext()))); | 1281 base::Unretained(storage_partition_impl_->GetPaymentAppContext()))); |
1283 | 1282 |
1284 AddUIThreadInterface( | 1283 AddUIThreadInterface( |
1285 registry.get(), | 1284 registry.get(), |
1286 base::Bind(&RenderProcessHostImpl::CreateOffscreenCanvasProvider, | 1285 base::Bind(&RenderProcessHostImpl::CreateOffscreenCanvasProvider, |
1287 base::Unretained(this))); | 1286 base::Unretained(this))); |
1288 | 1287 |
1289 AddUIThreadInterface(registry.get(), | |
1290 base::Bind(&RenderProcessHostImpl::BindFrameSinkProvider, | |
1291 base::Unretained(this))); | |
1292 | |
1293 AddUIThreadInterface( | 1288 AddUIThreadInterface( |
1294 registry.get(), | 1289 registry.get(), |
1295 base::Bind(&BackgroundSyncContext::CreateService, | 1290 base::Bind(&BackgroundSyncContext::CreateService, |
1296 base::Unretained( | 1291 base::Unretained( |
1297 storage_partition_impl_->GetBackgroundSyncContext()))); | 1292 storage_partition_impl_->GetBackgroundSyncContext()))); |
1298 AddUIThreadInterface( | 1293 AddUIThreadInterface( |
1299 registry.get(), | 1294 registry.get(), |
1300 base::Bind(&PlatformNotificationContextImpl::CreateService, | 1295 base::Bind(&PlatformNotificationContextImpl::CreateService, |
1301 base::Unretained( | 1296 base::Unretained( |
1302 storage_partition_impl_->GetPlatformNotificationContext()), | 1297 storage_partition_impl_->GetPlatformNotificationContext()), |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1419 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 1414 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
1420 if (!offscreen_canvas_provider_) { | 1415 if (!offscreen_canvas_provider_) { |
1421 // The client id gets converted to a uint32_t in FrameSinkId. | 1416 // The client id gets converted to a uint32_t in FrameSinkId. |
1422 uint32_t renderer_client_id = base::checked_cast<uint32_t>(id_); | 1417 uint32_t renderer_client_id = base::checked_cast<uint32_t>(id_); |
1423 offscreen_canvas_provider_ = | 1418 offscreen_canvas_provider_ = |
1424 base::MakeUnique<OffscreenCanvasProviderImpl>(renderer_client_id); | 1419 base::MakeUnique<OffscreenCanvasProviderImpl>(renderer_client_id); |
1425 } | 1420 } |
1426 offscreen_canvas_provider_->Add(std::move(request)); | 1421 offscreen_canvas_provider_->Add(std::move(request)); |
1427 } | 1422 } |
1428 | 1423 |
1429 void RenderProcessHostImpl::BindFrameSinkProvider( | |
1430 mojom::FrameSinkProviderRequest request) { | |
1431 frame_sink_provider_.Bind(std::move(request)); | |
1432 } | |
1433 | |
1434 void RenderProcessHostImpl::CreateStoragePartitionService( | 1424 void RenderProcessHostImpl::CreateStoragePartitionService( |
1435 mojo::InterfaceRequest<mojom::StoragePartitionService> request) { | 1425 mojo::InterfaceRequest<mojom::StoragePartitionService> request) { |
1436 // DO NOT REMOVE THIS COMMAND LINE CHECK WITHOUT SECURITY REVIEW! | 1426 // DO NOT REMOVE THIS COMMAND LINE CHECK WITHOUT SECURITY REVIEW! |
1437 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 1427 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
1438 switches::kMojoLocalStorage)) { | 1428 switches::kMojoLocalStorage)) { |
1439 storage_partition_impl_->Bind(std::move(request)); | 1429 storage_partition_impl_->Bind(std::move(request)); |
1440 } | 1430 } |
1441 } | 1431 } |
1442 | 1432 |
1443 int RenderProcessHostImpl::GetNextRoutingID() { | 1433 int RenderProcessHostImpl::GetNextRoutingID() { |
(...skipping 1381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2825 // before Init()) and they'll eventually reach the new process. | 2815 // before Init()) and they'll eventually reach the new process. |
2826 // | 2816 // |
2827 // Note that this may have already been called by one of the above observers | 2817 // Note that this may have already been called by one of the above observers |
2828 EnableSendQueue(); | 2818 EnableSendQueue(); |
2829 | 2819 |
2830 // It's possible that one of the calls out to the observers might have caused | 2820 // It's possible that one of the calls out to the observers might have caused |
2831 // this object to be no longer needed. | 2821 // this object to be no longer needed. |
2832 if (delayed_cleanup_needed_) | 2822 if (delayed_cleanup_needed_) |
2833 Cleanup(); | 2823 Cleanup(); |
2834 | 2824 |
2835 // If RenderProcessHostImpl is reused, the next renderer will send a new | |
2836 // request for FrameSinkProvider so make sure frame_sink_provider_ is ready | |
2837 // for that. | |
2838 frame_sink_provider_.Unbind(); | |
2839 | |
2840 // This object is not deleted at this point and might be reused later. | 2825 // This object is not deleted at this point and might be reused later. |
2841 // TODO(darin): clean this up | 2826 // TODO(darin): clean this up |
2842 } | 2827 } |
2843 | 2828 |
2844 size_t RenderProcessHost::GetActiveViewCount() { | 2829 size_t RenderProcessHost::GetActiveViewCount() { |
2845 size_t num_active_views = 0; | 2830 size_t num_active_views = 0; |
2846 std::unique_ptr<RenderWidgetHostIterator> widgets( | 2831 std::unique_ptr<RenderWidgetHostIterator> widgets( |
2847 RenderWidgetHost::GetRenderWidgetHosts()); | 2832 RenderWidgetHost::GetRenderWidgetHosts()); |
2848 while (RenderWidgetHost* widget = widgets->GetNextHost()) { | 2833 while (RenderWidgetHost* widget = widgets->GetNextHost()) { |
2849 // Count only RenderWidgetHosts in this process. | 2834 // Count only RenderWidgetHosts in this process. |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3134 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error; | 3119 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error; |
3135 | 3120 |
3136 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. | 3121 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. |
3137 // Capture the error message in a crash key value. | 3122 // Capture the error message in a crash key value. |
3138 base::debug::ScopedCrashKey error_key_value("mojo-message-error", error); | 3123 base::debug::ScopedCrashKey error_key_value("mojo-message-error", error); |
3139 bad_message::ReceivedBadMessage(render_process_id, | 3124 bad_message::ReceivedBadMessage(render_process_id, |
3140 bad_message::RPH_MOJO_PROCESS_ERROR); | 3125 bad_message::RPH_MOJO_PROCESS_ERROR); |
3141 } | 3126 } |
3142 | 3127 |
3143 } // namespace content | 3128 } // namespace content |
OLD | NEW |