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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/gpu/gpu_process_host_ui_shim.h" 5 #include "content/browser/gpu/gpu_process_host_ui_shim.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback_helpers.h" 10 #include "base/callback_helpers.h"
11 #include "base/debug/trace_event.h" 11 #include "base/debug/trace_event.h"
12 #include "base/id_map.h" 12 #include "base/id_map.h"
13 #include "base/lazy_instance.h" 13 #include "base/lazy_instance.h"
14 #include "base/strings/string_number_conversions.h" 14 #include "base/strings/string_number_conversions.h"
15 #include "content/browser/compositor/gpu_process_transport_factory.h" 15 #include "content/browser/compositor/gpu_process_transport_factory.h"
16 #include "content/browser/gpu/compositor_util.h" 16 #include "content/browser/gpu/compositor_util.h"
17 #include "content/browser/gpu/gpu_data_manager_impl.h" 17 #include "content/browser/gpu/gpu_data_manager_impl.h"
18 #include "content/browser/gpu/gpu_process_host.h" 18 #include "content/browser/gpu/gpu_process_host.h"
19 #include "content/browser/gpu/gpu_surface_tracker.h" 19 #include "content/browser/gpu/gpu_surface_tracker.h"
20 #include "content/browser/renderer_host/render_process_host_impl.h" 20 #include "content/browser/renderer_host/render_process_host_impl.h"
21 #include "content/browser/renderer_host/render_view_host_impl.h" 21 #include "content/browser/renderer_host/render_view_host_impl.h"
22 #include "content/browser/renderer_host/render_widget_helper.h" 22 #include "content/browser/renderer_host/render_widget_helper.h"
23 #include "content/browser/renderer_host/render_widget_host_view_base.h" 23 #include "content/browser/renderer_host/render_widget_host_view_base.h"
24 #include "content/common/gpu/gpu_messages.h" 24 #include "content/common/gpu/gpu_messages.h"
25 #include "content/public/browser/browser_thread.h" 25 #include "content/public/browser/browser_thread.h"
26 #include "content/public/browser/render_widget_host_iterator.h"
26 27
27 #if defined(OS_MACOSX) 28 #if defined(OS_MACOSX)
28 #include "ui/accelerated_widget_mac/accelerated_widget_mac.h" 29 #include "ui/accelerated_widget_mac/accelerated_widget_mac.h"
29 #endif 30 #endif
30 31
31 #if defined(USE_OZONE) 32 #if defined(USE_OZONE)
32 #include "ui/ozone/public/gpu_platform_support_host.h" 33 #include "ui/ozone/public/gpu_platform_support_host.h"
33 #include "ui/ozone/public/ozone_platform.h" 34 #include "ui/ozone/public/ozone_platform.h"
34 #endif 35 #endif
35 36
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceInitialized, 224 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceInitialized,
224 OnAcceleratedSurfaceInitialized) 225 OnAcceleratedSurfaceInitialized)
225 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceBuffersSwapped, 226 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceBuffersSwapped,
226 OnAcceleratedSurfaceBuffersSwapped) 227 OnAcceleratedSurfaceBuffersSwapped)
227 IPC_MESSAGE_HANDLER(GpuHostMsg_GraphicsInfoCollected, 228 IPC_MESSAGE_HANDLER(GpuHostMsg_GraphicsInfoCollected,
228 OnGraphicsInfoCollected) 229 OnGraphicsInfoCollected)
229 IPC_MESSAGE_HANDLER(GpuHostMsg_VideoMemoryUsageStats, 230 IPC_MESSAGE_HANDLER(GpuHostMsg_VideoMemoryUsageStats,
230 OnVideoMemoryUsageStatsReceived); 231 OnVideoMemoryUsageStatsReceived);
231 IPC_MESSAGE_HANDLER(GpuHostMsg_ResourcesRelinquished, 232 IPC_MESSAGE_HANDLER(GpuHostMsg_ResourcesRelinquished,
232 OnResourcesRelinquished) 233 OnResourcesRelinquished)
234 IPC_MESSAGE_HANDLER(GpuHostMsg_AddSubscription, OnAddSubscription);
235 IPC_MESSAGE_HANDLER(GpuHostMsg_RemoveSubscription, OnRemoveSubscription);
233 236
234 IPC_MESSAGE_UNHANDLED_ERROR() 237 IPC_MESSAGE_UNHANDLED_ERROR()
235 IPC_END_MESSAGE_MAP() 238 IPC_END_MESSAGE_MAP()
236 239
237 return true; 240 return true;
238 } 241 }
239 242
240 void GpuProcessHostUIShim::OnLogMessage( 243 void GpuProcessHostUIShim::OnLogMessage(
241 int level, 244 int level,
242 const std::string& header, 245 const std::string& header,
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 GpuDataManagerImpl::GetInstance()->UpdateVideoMemoryUsageStats( 302 GpuDataManagerImpl::GetInstance()->UpdateVideoMemoryUsageStats(
300 video_memory_usage_stats); 303 video_memory_usage_stats);
301 } 304 }
302 305
303 void GpuProcessHostUIShim::OnResourcesRelinquished() { 306 void GpuProcessHostUIShim::OnResourcesRelinquished() {
304 if (!relinquish_callback_.is_null()) { 307 if (!relinquish_callback_.is_null()) {
305 base::ResetAndReturn(&relinquish_callback_).Run(); 308 base::ResetAndReturn(&relinquish_callback_).Run();
306 } 309 }
307 } 310 }
308 311
312 void GpuProcessHostUIShim::OnAddSubscription(
313 int32 process_id, unsigned int target) {
314 scoped_ptr<RenderWidgetHostIterator> rwhi_iterator =
315 RenderWidgetHostImpl::GetRenderWidgetHosts();
316 while (RenderWidgetHost* widget = rwhi_iterator->GetNextHost()) {
317 // Count only RenderWidgetHosts in this process.
318 if (widget->GetProcess()->GetID() == process_id) {
319 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(widget);
320 rwhi->OnAddSubscription(target);
321 }
322 }
323 }
324
325 void GpuProcessHostUIShim::OnRemoveSubscription(
326 int32 process_id, unsigned int target) {
327 scoped_ptr<RenderWidgetHostIterator> rwhi_iterator =
328 RenderWidgetHostImpl::GetRenderWidgetHosts();
329 while (RenderWidgetHost* widget = rwhi_iterator->GetNextHost()) {
330 // Count only RenderWidgetHosts in this process.
331 if (widget->GetProcess()->GetID() == process_id) {
332 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(widget);
333 rwhi->OnRemoveSubscription(target);
334 }
335 }
336 }
337
309 } // namespace content 338 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698