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/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 | 26 |
27 #if defined(OS_MACOSX) | 27 #if defined(OS_MACOSX) |
28 #include "content/browser/compositor/browser_compositor_ca_layer_tree_mac.h" | 28 #include "ui/compositor/mac/accelerated_widget_mac.h" |
29 #endif | 29 #endif |
30 | 30 |
31 #if defined(USE_OZONE) | 31 #if defined(USE_OZONE) |
32 #include "ui/ozone/public/gpu_platform_support_host.h" | 32 #include "ui/ozone/public/gpu_platform_support_host.h" |
33 #include "ui/ozone/public/ozone_platform.h" | 33 #include "ui/ozone/public/ozone_platform.h" |
34 #endif | 34 #endif |
35 | 35 |
36 namespace content { | 36 namespace content { |
37 | 37 |
38 namespace { | 38 namespace { |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
271 if (!ui::LatencyInfo::Verify(params.latency_info, | 271 if (!ui::LatencyInfo::Verify(params.latency_info, |
272 "GpuHostMsg_AcceleratedSurfaceBuffersSwapped")) { | 272 "GpuHostMsg_AcceleratedSurfaceBuffersSwapped")) { |
273 return; | 273 return; |
274 } | 274 } |
275 | 275 |
276 // On Mac with delegated rendering, accelerated surfaces are not necessarily | 276 // On Mac with delegated rendering, accelerated surfaces are not necessarily |
277 // associated with a RenderWidgetHostViewBase. | 277 // associated with a RenderWidgetHostViewBase. |
278 AcceleratedSurfaceMsg_BufferPresented_Params ack_params; | 278 AcceleratedSurfaceMsg_BufferPresented_Params ack_params; |
279 DCHECK(IsDelegatedRendererEnabled()); | 279 DCHECK(IsDelegatedRendererEnabled()); |
280 gfx::AcceleratedWidget native_widget = | 280 gfx::AcceleratedWidget native_widget = |
281 content::GpuSurfaceTracker::Get()->AcquireNativeWidget(params.surface_id); | 281 content::GpuSurfaceTracker::Get()->AcquireNativeWidget(params.surface_id); |
ccameron
2014/11/26 18:36:51
Shouldn't this be ui::AcceleratedWidgetMacGotAccel
tapted
2014/11/27 02:50:33
Yep - Done. I think it must have been relying on K
| |
282 AcceleratedWidgetMacGotAcceleratedFrame( | 282 AcceleratedWidgetMacGotAcceleratedFrame( |
283 native_widget, | 283 native_widget, |
284 params.surface_handle, | 284 params.surface_handle, |
285 params.latency_info, | 285 params.latency_info, |
286 params.size, | 286 params.size, |
287 params.scale_factor, | 287 params.scale_factor, |
288 base::Bind(&OnSurfaceDisplayedCallback, params.surface_id), | 288 base::Bind(&OnSurfaceDisplayedCallback, params.surface_id), |
289 &ack_params.disable_throttling, | 289 &ack_params.disable_throttling, |
290 &ack_params.renderer_id); | 290 &ack_params.renderer_id); |
291 Send(new AcceleratedSurfaceMsg_BufferPresented(params.route_id, ack_params)); | 291 Send(new AcceleratedSurfaceMsg_BufferPresented(params.route_id, ack_params)); |
292 #else | 292 #else |
293 NOTREACHED(); | 293 NOTREACHED(); |
294 #endif | 294 #endif |
295 } | 295 } |
296 | 296 |
297 void GpuProcessHostUIShim::OnVideoMemoryUsageStatsReceived( | 297 void GpuProcessHostUIShim::OnVideoMemoryUsageStatsReceived( |
298 const GPUVideoMemoryUsageStats& video_memory_usage_stats) { | 298 const GPUVideoMemoryUsageStats& video_memory_usage_stats) { |
299 GpuDataManagerImpl::GetInstance()->UpdateVideoMemoryUsageStats( | 299 GpuDataManagerImpl::GetInstance()->UpdateVideoMemoryUsageStats( |
300 video_memory_usage_stats); | 300 video_memory_usage_stats); |
301 } | 301 } |
302 | 302 |
303 void GpuProcessHostUIShim::OnResourcesRelinquished() { | 303 void GpuProcessHostUIShim::OnResourcesRelinquished() { |
304 if (!relinquish_callback_.is_null()) { | 304 if (!relinquish_callback_.is_null()) { |
305 base::ResetAndReturn(&relinquish_callback_).Run(); | 305 base::ResetAndReturn(&relinquish_callback_).Run(); |
306 } | 306 } |
307 } | 307 } |
308 | 308 |
309 } // namespace content | 309 } // namespace content |
OLD | NEW |