Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1670)

Unified Diff: content/browser/renderer_host/render_widget_host_impl.cc

Issue 780133002: Add optimization for CHROMIUM_subscribe_uniform extension. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: piman@ review Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/renderer_host/render_widget_host_impl.h ('k') | content/common/gpu/gpu_channel.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/render_widget_host_impl.cc
diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc
index bfbb78498496f2d9c75c9772ad4079b98d983787..86b95c51e8ae957d341ca053b5be3c382885de47 100644
--- a/content/browser/renderer_host/render_widget_host_impl.cc
+++ b/content/browser/renderer_host/render_widget_host_impl.cc
@@ -233,6 +233,8 @@ RenderWidgetHostImpl::RenderWidgetHostImpl(RenderWidgetHostDelegate* delegate,
weak_factory_.GetWeakPtr())));
}
+ pending_valuebuffer_state_ = new gpu::ValueStateMap();
+
subscribe_uniform_enabled_ =
base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableSubscribeUniformExtension);
@@ -904,17 +906,11 @@ void RenderWidgetHostImpl::ForwardMouseEventWithLatencyInfo(
// Pass mouse state to gpu service if the subscribe uniform
// extension is enabled.
- // TODO(orglofch): Only pass mouse information if one of the GL Contexts
- // is subscribed to GL_MOUSE_POSITION_CHROMIUM
if (subscribe_uniform_enabled_) {
gpu::ValueState state;
state.int_value[0] = mouse_event.x;
state.int_value[1] = mouse_event.y;
- GpuProcessHost::SendOnIO(
- GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED,
- CAUSE_FOR_GPU_LAUNCH_NO_LAUNCH,
- new GpuMsg_UpdateValueState(
- process_->GetID(), GL_MOUSE_POSITION_CHROMIUM, state));
+ SendUpdateValueState(GL_MOUSE_POSITION_CHROMIUM, state);
}
}
@@ -2355,6 +2351,21 @@ void RenderWidgetHostImpl::OnSnapshotDataReceivedAsync(
OnSnapshotDataReceived(snapshot_id, NULL, 0);
}
+void RenderWidgetHostImpl::SendUpdateValueState(unsigned int target,
+ const gpu::ValueState& state) {
+ if (subscription_set_.find(GL_MOUSE_POSITION_CHROMIUM)
piman 2014/12/10 06:57:10 s/GL_MOUSE_POSITION_CHROMIUM/target/ in this metho
orglofch 2014/12/10 21:54:48 Done.
+ != subscription_set_.end()) {
+ GpuProcessHost::SendOnIO(
+ GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED,
+ CAUSE_FOR_GPU_LAUNCH_NO_LAUNCH,
+ new GpuMsg_UpdateValueState(
+ process_->GetID(), GL_MOUSE_POSITION_CHROMIUM, state));
piman 2014/12/10 06:57:10 Actually, I'm realizing, this doesn't make much se
orglofch 2014/12/10 21:54:48 Done. Moved to RenderProcessHost.
+ } else {
+ // Store the ValueState locally in case a Valuebuffer subscribes to it later
+ pending_valuebuffer_state_->UpdateState(GL_MOUSE_POSITION_CHROMIUM, state);
+ }
+}
+
// static
void RenderWidgetHostImpl::CompositorFrameDrawn(
const std::vector<ui::LatencyInfo>& latency_info) {
@@ -2411,6 +2422,18 @@ void RenderWidgetHostImpl::AddLatencyInfoComponentIds(
}
}
+void RenderWidgetHostImpl::OnAddSubscription(unsigned int target) {
+ subscription_set_.insert(target);
+ const gpu::ValueState* state = pending_valuebuffer_state_->GetState(target);
+ if (state) {
+ SendUpdateValueState(target, *state);
+ }
+}
+
+void RenderWidgetHostImpl::OnRemoveSubscription(unsigned int target) {
+ subscription_set_.erase(target);
+}
+
BrowserAccessibilityManager*
RenderWidgetHostImpl::GetRootBrowserAccessibilityManager() {
return delegate_ ? delegate_->GetRootBrowserAccessibilityManager() : NULL;
« no previous file with comments | « content/browser/renderer_host/render_widget_host_impl.h ('k') | content/common/gpu/gpu_channel.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698