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

Unified Diff: content/browser/gpu/gpu_process_host_ui_shim.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
Index: content/browser/gpu/gpu_process_host_ui_shim.cc
diff --git a/content/browser/gpu/gpu_process_host_ui_shim.cc b/content/browser/gpu/gpu_process_host_ui_shim.cc
index 2293e745892609f8391e4d01e628cbc4bfc83abb..f4612c31dfc4ca3fe9bde9bbd96c7c0c540d46fe 100644
--- a/content/browser/gpu/gpu_process_host_ui_shim.cc
+++ b/content/browser/gpu/gpu_process_host_ui_shim.cc
@@ -23,6 +23,7 @@
#include "content/browser/renderer_host/render_widget_host_view_base.h"
#include "content/common/gpu/gpu_messages.h"
#include "content/public/browser/browser_thread.h"
+#include "content/public/browser/render_widget_host_iterator.h"
#if defined(OS_MACOSX)
#include "ui/accelerated_widget_mac/accelerated_widget_mac.h"
@@ -230,6 +231,8 @@ bool GpuProcessHostUIShim::OnControlMessageReceived(
OnVideoMemoryUsageStatsReceived);
IPC_MESSAGE_HANDLER(GpuHostMsg_ResourcesRelinquished,
OnResourcesRelinquished)
+ IPC_MESSAGE_HANDLER(GpuHostMsg_AddSubscription, OnAddSubscription);
+ IPC_MESSAGE_HANDLER(GpuHostMsg_RemoveSubscription, OnRemoveSubscription);
IPC_MESSAGE_UNHANDLED_ERROR()
IPC_END_MESSAGE_MAP()
@@ -306,4 +309,30 @@ void GpuProcessHostUIShim::OnResourcesRelinquished() {
}
}
+void GpuProcessHostUIShim::OnAddSubscription(
+ int32 process_id, unsigned int target) {
+ scoped_ptr<RenderWidgetHostIterator> rwhi_iterator =
+ RenderWidgetHostImpl::GetRenderWidgetHosts();
+ while (RenderWidgetHost* widget = rwhi_iterator->GetNextHost()) {
+ // Count only RenderWidgetHosts in this process.
+ if (widget->GetProcess()->GetID() == process_id) {
+ RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(widget);
+ rwhi->OnAddSubscription(target);
+ }
+ }
+}
+
+void GpuProcessHostUIShim::OnRemoveSubscription(
+ int32 process_id, unsigned int target) {
+ scoped_ptr<RenderWidgetHostIterator> rwhi_iterator =
+ RenderWidgetHostImpl::GetRenderWidgetHosts();
+ while (RenderWidgetHost* widget = rwhi_iterator->GetNextHost()) {
+ // Count only RenderWidgetHosts in this process.
+ if (widget->GetProcess()->GetID() == process_id) {
+ RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(widget);
+ rwhi->OnRemoveSubscription(target);
+ }
+ }
+}
+
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698