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

Unified Diff: content/browser/gpu/gpu_process_host.cc

Issue 780133002: Add optimization for CHROMIUM_subscribe_uniform extension. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tsepez@ 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
Index: content/browser/gpu/gpu_process_host.cc
diff --git a/content/browser/gpu/gpu_process_host.cc b/content/browser/gpu/gpu_process_host.cc
index 2d04cb9be80970aaf82e0577ceb30d04a5c628c5..d9adc722e19a32c5b307fb65df29058da25f880e 100644
--- a/content/browser/gpu/gpu_process_host.cc
+++ b/content/browser/gpu/gpu_process_host.cc
@@ -141,6 +141,16 @@ void SendGpuProcessMessage(GpuProcessHost::GpuProcessKind kind,
}
}
+void SendGpuProcessUpdateValueStateMessage(int client_id,
+ unsigned int target,
+ const gpu::ValueState& state) {
+ GpuProcessHost* host = GpuProcessHost::Get(
+ GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED,
+ CAUSE_FOR_GPU_LAUNCH_NO_LAUNCH);
+ if (host)
+ host->SendUpdateValueState(client_id, target, state);
+}
+
// NOTE: changes to this class need to be reviewed by the security team.
class GpuSandboxedProcessLauncherDelegate
: public SandboxedProcessLauncherDelegate {
@@ -349,6 +359,15 @@ void GpuProcessHost::SendOnIO(GpuProcessKind kind,
}
}
+//static
+void GpuProcessHost::SendUpdateValueStateOnIOThread(
+ int client_id, unsigned int target, const gpu::ValueState& state) {
+ BrowserThread::PostTask(
+ BrowserThread::IO, FROM_HERE,
+ base::Bind(&SendGpuProcessUpdateValueStateMessage,
+ client_id, target, state));
+}
+
GpuMainThreadFactoryFunction g_gpu_main_thread_factory = NULL;
void GpuProcessHost::RegisterGpuMainThreadFactory(
@@ -582,7 +601,8 @@ bool GpuProcessHost::OnMessageReceived(const IPC::Message& message) {
OnDestroyChannel)
IPC_MESSAGE_HANDLER(GpuHostMsg_CacheShader,
OnCacheShader)
-
+ IPC_MESSAGE_HANDLER(GpuHostMsg_AddSubscription, OnAddSubscription)
+ IPC_MESSAGE_HANDLER(GpuHostMsg_RemoveSubscription, OnRemoveSubscription)
IPC_MESSAGE_UNHANDLED(RouteOnUIThread(message))
IPC_END_MESSAGE_MAP()
@@ -1039,6 +1059,15 @@ void GpuProcessHost::LoadedShader(const std::string& key,
Send(new GpuMsg_LoadedShader(data));
}
+void GpuProcessHost::SendUpdateValueState(int client_id,
+ unsigned int target,
+ const gpu::ValueState& state) {
+ // Only send data if a valuebuffer is subscribed to the target
+ if (subscription_set_.find(target) != subscription_set_.end()) {
+ Send(new GpuMsg_UpdateValueState(client_id, target, state));
+ }
+}
+
void GpuProcessHost::CreateChannelCache(int32 client_id) {
TRACE_EVENT0("gpu", "GpuProcessHost::CreateChannelCache");
@@ -1069,4 +1098,12 @@ void GpuProcessHost::OnCacheShader(int32 client_id,
iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader);
}
+void GpuProcessHost::OnAddSubscription(unsigned int target) {
+ subscription_set_.insert(target);
+}
+
+void GpuProcessHost::OnRemoveSubscription(unsigned int target) {
+ subscription_set_.erase(target);
+}
+
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698