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 |