Index: content/browser/renderer_host/render_process_host_impl.cc |
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc |
index a32b4d79b9cfc74de5b412a83ea4f11a682e15ba..317bc3950886c7850cf90cc7eabef10c44137305 100644 |
--- a/content/browser/renderer_host/render_process_host_impl.cc |
+++ b/content/browser/renderer_host/render_process_host_impl.cc |
@@ -457,6 +457,8 @@ RenderProcessHostImpl::RenderProcessHostImpl( |
power_monitor_broadcaster_(this), |
worker_ref_count_(0), |
permission_service_context_(new PermissionServiceContext(this)), |
+ pending_valuebuffer_state_(new gpu::ValueStateMap()), |
+ subscribe_uniform_enabled_(false), |
weak_factory_(this) { |
widget_helper_ = new RenderWidgetHelper(); |
@@ -475,6 +477,9 @@ RenderProcessHostImpl::RenderProcessHostImpl( |
base::Bind(&CacheShaderInfo, GetID(), |
storage_partition_impl_->GetPath())); |
} |
+ subscribe_uniform_enabled_ = |
+ base::CommandLine::ForCurrentProcess()->HasSwitch( |
+ switches::kEnableSubscribeUniformExtension); |
// Note: When we create the RenderProcessHostImpl, it's technically |
// backgrounded, because it has no visible listeners. But the process |
@@ -928,6 +933,38 @@ const base::TimeTicks& RenderProcessHostImpl::GetInitTimeForNavigationMetrics() |
return init_time_; |
} |
+bool RenderProcessHostImpl::SubscribeUniformEnabled() const { |
+ return subscribe_uniform_enabled_; |
+} |
+ |
+void RenderProcessHostImpl::OnAddSubscription(unsigned int target) { |
+ DCHECK(subscribe_uniform_enabled_); |
+ subscription_set_.insert(target); |
+ const gpu::ValueState* state = pending_valuebuffer_state_->GetState(target); |
+ if (state) { |
+ SendUpdateValueState(target, *state); |
+ } |
+} |
+ |
+void RenderProcessHostImpl::OnRemoveSubscription(unsigned int target) { |
+ DCHECK(subscribe_uniform_enabled_); |
+ subscription_set_.erase(target); |
+} |
+ |
+void RenderProcessHostImpl::SendUpdateValueState(unsigned int target, |
+ const gpu::ValueState& state) { |
+ DCHECK(subscribe_uniform_enabled_); |
+ if (subscription_set_.find(target) != subscription_set_.end()) { |
+ GpuProcessHost::SendOnIO( |
+ GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED, |
+ CAUSE_FOR_GPU_LAUNCH_NO_LAUNCH, |
+ new GpuMsg_UpdateValueState(id_, target, state)); |
+ } else { |
+ // Store the ValueState locally in case a Valuebuffer subscribes to it later |
+ pending_valuebuffer_state_->UpdateState(target, state); |
+ } |
+} |
+ |
void RenderProcessHostImpl::AddRoute( |
int32 routing_id, |
IPC::Listener* listener) { |