OLD | NEW |
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/id_map.h" | 11 #include "base/id_map.h" |
12 #include "base/lazy_instance.h" | 12 #include "base/lazy_instance.h" |
13 #include "base/strings/string_number_conversions.h" | 13 #include "base/strings/string_number_conversions.h" |
14 #include "base/trace_event/trace_event.h" | 14 #include "base/trace_event/trace_event.h" |
15 #include "build/build_config.h" | 15 #include "build/build_config.h" |
16 #include "content/browser/compositor/gpu_process_transport_factory.h" | 16 #include "content/browser/compositor/gpu_process_transport_factory.h" |
17 #include "content/browser/gpu/compositor_util.h" | 17 #include "content/browser/gpu/compositor_util.h" |
18 #include "content/browser/gpu/gpu_data_manager_impl.h" | 18 #include "content/browser/gpu/gpu_data_manager_impl.h" |
19 #include "content/browser/gpu/gpu_process_host.h" | 19 #include "content/browser/gpu/gpu_process_host.h" |
20 #include "content/browser/gpu/gpu_surface_tracker.h" | 20 #include "content/browser/gpu/gpu_surface_tracker.h" |
21 #include "content/browser/renderer_host/render_process_host_impl.h" | 21 #include "content/browser/renderer_host/render_process_host_impl.h" |
22 #include "content/browser/renderer_host/render_view_host_impl.h" | 22 #include "content/browser/renderer_host/render_view_host_impl.h" |
23 #include "content/browser/renderer_host/render_widget_helper.h" | 23 #include "content/browser/renderer_host/render_widget_helper.h" |
24 #include "content/browser/renderer_host/render_widget_host_view_base.h" | 24 #include "content/browser/renderer_host/render_widget_host_view_base.h" |
25 #include "content/common/gpu/gpu_messages.h" | 25 #include "content/common/gpu/gpu_messages.h" |
26 #include "content/public/browser/browser_thread.h" | 26 #include "content/public/browser/browser_thread.h" |
27 #include "gpu/ipc/common/memory_stats.h" | |
28 | 27 |
29 #if defined(OS_MACOSX) | 28 #if defined(OS_MACOSX) |
30 #include "ui/accelerated_widget_mac/accelerated_widget_mac.h" | 29 #include "ui/accelerated_widget_mac/accelerated_widget_mac.h" |
31 #endif | 30 #endif |
32 | 31 |
33 #if defined(USE_OZONE) | 32 #if defined(USE_OZONE) |
34 #include "ui/ozone/public/gpu_platform_support_host.h" | 33 #include "ui/ozone/public/gpu_platform_support_host.h" |
35 #include "ui/ozone/public/ozone_platform.h" | 34 #include "ui/ozone/public/ozone_platform.h" |
36 #endif | 35 #endif |
37 | 36 |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 } | 264 } |
266 | 265 |
267 content::ImageTransportFactory::GetInstance()->OnGpuSwapBuffersCompleted( | 266 content::ImageTransportFactory::GetInstance()->OnGpuSwapBuffersCompleted( |
268 params.surface_id, params.latency_info, gfx::SwapResult::SWAP_ACK); | 267 params.surface_id, params.latency_info, gfx::SwapResult::SWAP_ACK); |
269 | 268 |
270 Send(new AcceleratedSurfaceMsg_BufferPresented(params.route_id, ack_params)); | 269 Send(new AcceleratedSurfaceMsg_BufferPresented(params.route_id, ack_params)); |
271 } | 270 } |
272 #endif | 271 #endif |
273 | 272 |
274 void GpuProcessHostUIShim::OnVideoMemoryUsageStatsReceived( | 273 void GpuProcessHostUIShim::OnVideoMemoryUsageStatsReceived( |
275 const gpu::VideoMemoryUsageStats& video_memory_usage_stats) { | 274 const GPUVideoMemoryUsageStats& video_memory_usage_stats) { |
276 GpuDataManagerImpl::GetInstance()->UpdateVideoMemoryUsageStats( | 275 GpuDataManagerImpl::GetInstance()->UpdateVideoMemoryUsageStats( |
277 video_memory_usage_stats); | 276 video_memory_usage_stats); |
278 } | 277 } |
279 | 278 |
280 void GpuProcessHostUIShim::OnAddSubscription(int32_t process_id, | 279 void GpuProcessHostUIShim::OnAddSubscription(int32_t process_id, |
281 unsigned int target) { | 280 unsigned int target) { |
282 RenderProcessHost* rph = RenderProcessHost::FromID(process_id); | 281 RenderProcessHost* rph = RenderProcessHost::FromID(process_id); |
283 if (rph) { | 282 if (rph) { |
284 rph->OnAddSubscription(target); | 283 rph->OnAddSubscription(target); |
285 } | 284 } |
286 } | 285 } |
287 | 286 |
288 void GpuProcessHostUIShim::OnRemoveSubscription(int32_t process_id, | 287 void GpuProcessHostUIShim::OnRemoveSubscription(int32_t process_id, |
289 unsigned int target) { | 288 unsigned int target) { |
290 RenderProcessHost* rph = RenderProcessHost::FromID(process_id); | 289 RenderProcessHost* rph = RenderProcessHost::FromID(process_id); |
291 if (rph) { | 290 if (rph) { |
292 rph->OnRemoveSubscription(target); | 291 rph->OnRemoveSubscription(target); |
293 } | 292 } |
294 } | 293 } |
295 | 294 |
296 } // namespace content | 295 } // namespace content |
OLD | NEW |