| 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 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 565 sudden_termination_allowed_(true), | 565 sudden_termination_allowed_(true), |
| 566 ignore_input_events_(false), | 566 ignore_input_events_(false), |
| 567 is_for_guests_only_(is_for_guests_only), | 567 is_for_guests_only_(is_for_guests_only), |
| 568 gpu_observer_registered_(false), | 568 gpu_observer_registered_(false), |
| 569 delayed_cleanup_needed_(false), | 569 delayed_cleanup_needed_(false), |
| 570 within_process_died_observer_(false), | 570 within_process_died_observer_(false), |
| 571 power_monitor_broadcaster_(this), | 571 power_monitor_broadcaster_(this), |
| 572 worker_ref_count_(0), | 572 worker_ref_count_(0), |
| 573 max_worker_count_(0), | 573 max_worker_count_(0), |
| 574 permission_service_context_(new PermissionServiceContext(this)), | 574 permission_service_context_(new PermissionServiceContext(this)), |
| 575 pending_valuebuffer_state_(new gpu::ValueStateMap()), | |
| 576 subscribe_uniform_enabled_(false), | |
| 577 channel_connected_(false), | 575 channel_connected_(false), |
| 578 sent_render_process_ready_(false), | 576 sent_render_process_ready_(false), |
| 579 #if defined(OS_ANDROID) | 577 #if defined(OS_ANDROID) |
| 580 never_signaled_(true, false), | 578 never_signaled_(true, false), |
| 581 #endif | 579 #endif |
| 582 weak_factory_(this) { | 580 weak_factory_(this) { |
| 583 widget_helper_ = new RenderWidgetHelper(); | 581 widget_helper_ = new RenderWidgetHelper(); |
| 584 | 582 |
| 585 ChildProcessSecurityPolicyImpl::GetInstance()->Add(GetID()); | 583 ChildProcessSecurityPolicyImpl::GetInstance()->Add(GetID()); |
| 586 | 584 |
| 587 CHECK(!BrowserMainRunner::ExitedMainMessageLoop()); | 585 CHECK(!BrowserMainRunner::ExitedMainMessageLoop()); |
| 588 RegisterHost(GetID(), this); | 586 RegisterHost(GetID(), this); |
| 589 g_all_hosts.Get().set_check_on_null_data(true); | 587 g_all_hosts.Get().set_check_on_null_data(true); |
| 590 // Initialize |child_process_activity_time_| to a reasonable value. | 588 // Initialize |child_process_activity_time_| to a reasonable value. |
| 591 mark_child_process_activity_time(); | 589 mark_child_process_activity_time(); |
| 592 | 590 |
| 593 if (!GetBrowserContext()->IsOffTheRecord() && | 591 if (!GetBrowserContext()->IsOffTheRecord() && |
| 594 !base::CommandLine::ForCurrentProcess()->HasSwitch( | 592 !base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 595 switches::kDisableGpuShaderDiskCache)) { | 593 switches::kDisableGpuShaderDiskCache)) { |
| 596 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, | 594 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, |
| 597 base::Bind(&CacheShaderInfo, GetID(), | 595 base::Bind(&CacheShaderInfo, GetID(), |
| 598 storage_partition_impl_->GetPath())); | 596 storage_partition_impl_->GetPath())); |
| 599 } | 597 } |
| 600 subscribe_uniform_enabled_ = | |
| 601 base::CommandLine::ForCurrentProcess()->HasSwitch( | |
| 602 switches::kEnableSubscribeUniformExtension); | |
| 603 | 598 |
| 604 #if defined(OS_MACOSX) | 599 #if defined(OS_MACOSX) |
| 605 if (BootstrapSandboxManager::ShouldEnable()) | 600 if (BootstrapSandboxManager::ShouldEnable()) |
| 606 AddObserver(BootstrapSandboxManager::GetInstance()); | 601 AddObserver(BootstrapSandboxManager::GetInstance()); |
| 607 #endif | 602 #endif |
| 608 | 603 |
| 609 #if USE_ATTACHMENT_BROKER | 604 #if USE_ATTACHMENT_BROKER |
| 610 // Construct the privileged attachment broker early in the life cycle of a | 605 // Construct the privileged attachment broker early in the life cycle of a |
| 611 // render process. This ensures that when a test is being run in one of the | 606 // render process. This ensures that when a test is being run in one of the |
| 612 // single process modes, the global attachment broker is the privileged | 607 // single process modes, the global attachment broker is the privileged |
| (...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1123 std::unique_ptr<base::SharedPersistentMemoryAllocator> | 1118 std::unique_ptr<base::SharedPersistentMemoryAllocator> |
| 1124 RenderProcessHostImpl::TakeMetricsAllocator() { | 1119 RenderProcessHostImpl::TakeMetricsAllocator() { |
| 1125 return std::move(metrics_allocator_); | 1120 return std::move(metrics_allocator_); |
| 1126 } | 1121 } |
| 1127 | 1122 |
| 1128 const base::TimeTicks& RenderProcessHostImpl::GetInitTimeForNavigationMetrics() | 1123 const base::TimeTicks& RenderProcessHostImpl::GetInitTimeForNavigationMetrics() |
| 1129 const { | 1124 const { |
| 1130 return init_time_; | 1125 return init_time_; |
| 1131 } | 1126 } |
| 1132 | 1127 |
| 1133 bool RenderProcessHostImpl::SubscribeUniformEnabled() const { | |
| 1134 return subscribe_uniform_enabled_; | |
| 1135 } | |
| 1136 | |
| 1137 void RenderProcessHostImpl::OnAddSubscription(unsigned int target) { | |
| 1138 DCHECK(subscribe_uniform_enabled_); | |
| 1139 subscription_set_.insert(target); | |
| 1140 const gpu::ValueState* state = pending_valuebuffer_state_->GetState(target); | |
| 1141 if (state) { | |
| 1142 SendUpdateValueState(target, *state); | |
| 1143 } | |
| 1144 } | |
| 1145 | |
| 1146 void RenderProcessHostImpl::OnRemoveSubscription(unsigned int target) { | |
| 1147 DCHECK(subscribe_uniform_enabled_); | |
| 1148 subscription_set_.erase(target); | |
| 1149 } | |
| 1150 | |
| 1151 void RenderProcessHostImpl::SendUpdateValueState(unsigned int target, | |
| 1152 const gpu::ValueState& state) { | |
| 1153 DCHECK(subscribe_uniform_enabled_); | |
| 1154 if (subscription_set_.find(target) != subscription_set_.end()) { | |
| 1155 GpuProcessHost::SendOnIO(GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED, | |
| 1156 CAUSE_FOR_GPU_LAUNCH_NO_LAUNCH, | |
| 1157 new GpuMsg_UpdateValueState(id_, target, state)); | |
| 1158 } else { | |
| 1159 // Store the ValueState locally in case a Valuebuffer subscribes to it later | |
| 1160 pending_valuebuffer_state_->UpdateState(target, state); | |
| 1161 } | |
| 1162 } | |
| 1163 | |
| 1164 #if defined(ENABLE_BROWSER_CDMS) | 1128 #if defined(ENABLE_BROWSER_CDMS) |
| 1165 scoped_refptr<media::MediaKeys> RenderProcessHostImpl::GetCdm( | 1129 scoped_refptr<media::MediaKeys> RenderProcessHostImpl::GetCdm( |
| 1166 int render_frame_id, | 1130 int render_frame_id, |
| 1167 int cdm_id) const { | 1131 int cdm_id) const { |
| 1168 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 1132 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 1169 BrowserCdmManager* manager = BrowserCdmManager::FromProcess(GetID()); | 1133 BrowserCdmManager* manager = BrowserCdmManager::FromProcess(GetID()); |
| 1170 if (!manager) | 1134 if (!manager) |
| 1171 return nullptr; | 1135 return nullptr; |
| 1172 return manager->GetCdm(render_frame_id, cdm_id); | 1136 return manager->GetCdm(render_frame_id, cdm_id); |
| 1173 } | 1137 } |
| (...skipping 1654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2828 | 2792 |
| 2829 // Skip widgets in other processes. | 2793 // Skip widgets in other processes. |
| 2830 if (rvh->GetProcess()->GetID() != GetID()) | 2794 if (rvh->GetProcess()->GetID() != GetID()) |
| 2831 continue; | 2795 continue; |
| 2832 | 2796 |
| 2833 rvh->OnWebkitPreferencesChanged(); | 2797 rvh->OnWebkitPreferencesChanged(); |
| 2834 } | 2798 } |
| 2835 } | 2799 } |
| 2836 | 2800 |
| 2837 } // namespace content | 2801 } // namespace content |
| OLD | NEW |