| 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/debug/trace_event.h" | 10 #include "base/debug/trace_event.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 "content/browser/gpu/compositor_util.h" | 14 #include "content/browser/gpu/compositor_util.h" |
| 15 #include "content/browser/gpu/gpu_data_manager_impl.h" | 15 #include "content/browser/gpu/gpu_data_manager_impl.h" |
| 16 #include "content/browser/gpu/gpu_process_host.h" | 16 #include "content/browser/gpu/gpu_process_host.h" |
| 17 #include "content/browser/gpu/gpu_surface_tracker.h" | 17 #include "content/browser/gpu/gpu_surface_tracker.h" |
| 18 #include "content/browser/renderer_host/render_process_host_impl.h" | 18 #include "content/browser/renderer_host/render_process_host_impl.h" |
| 19 #include "content/browser/renderer_host/render_view_host_impl.h" | 19 #include "content/browser/renderer_host/render_view_host_impl.h" |
| 20 #include "content/browser/renderer_host/render_widget_helper.h" | 20 #include "content/browser/renderer_host/render_widget_helper.h" |
| 21 #include "content/browser/renderer_host/render_widget_host_view_base.h" | 21 #include "content/browser/renderer_host/render_widget_host_view_base.h" |
| 22 #include "content/common/gpu/gpu_messages.h" | 22 #include "content/common/gpu/gpu_messages.h" |
| 23 #include "content/public/browser/browser_thread.h" | 23 #include "content/public/browser/browser_thread.h" |
| 24 | 24 |
| 25 #if defined(OS_MACOSX) | 25 #if defined(OS_MACOSX) |
| 26 #include "content/browser/compositor/browser_compositor_view_mac.h" | 26 #include "content/browser/compositor/browser_compositor_ca_layer_tree_mac.h" |
| 27 #endif | 27 #endif |
| 28 | 28 |
| 29 #if defined(USE_OZONE) | 29 #if defined(USE_OZONE) |
| 30 #include "ui/ozone/public/gpu_platform_support_host.h" | 30 #include "ui/ozone/public/gpu_platform_support_host.h" |
| 31 #include "ui/ozone/public/ozone_platform.h" | 31 #include "ui/ozone/public/ozone_platform.h" |
| 32 #endif | 32 #endif |
| 33 | 33 |
| 34 namespace content { | 34 namespace content { |
| 35 | 35 |
| 36 namespace { | 36 namespace { |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 #if defined(OS_MACOSX) | 250 #if defined(OS_MACOSX) |
| 251 TRACE_EVENT0("renderer", | 251 TRACE_EVENT0("renderer", |
| 252 "GpuProcessHostUIShim::OnAcceleratedSurfaceBuffersSwapped"); | 252 "GpuProcessHostUIShim::OnAcceleratedSurfaceBuffersSwapped"); |
| 253 if (!ui::LatencyInfo::Verify(params.latency_info, | 253 if (!ui::LatencyInfo::Verify(params.latency_info, |
| 254 "GpuHostMsg_AcceleratedSurfaceBuffersSwapped")) { | 254 "GpuHostMsg_AcceleratedSurfaceBuffersSwapped")) { |
| 255 return; | 255 return; |
| 256 } | 256 } |
| 257 | 257 |
| 258 // On Mac with delegated rendering, accelerated surfaces are not necessarily | 258 // On Mac with delegated rendering, accelerated surfaces are not necessarily |
| 259 // associated with a RenderWidgetHostViewBase. | 259 // associated with a RenderWidgetHostViewBase. |
| 260 AcceleratedSurfaceMsg_BufferPresented_Params ack_params; |
| 260 DCHECK(IsDelegatedRendererEnabled()); | 261 DCHECK(IsDelegatedRendererEnabled()); |
| 261 gfx::AcceleratedWidget native_widget = | 262 gfx::AcceleratedWidget native_widget = |
| 262 content::GpuSurfaceTracker::Get()->AcquireNativeWidget(params.surface_id); | 263 content::GpuSurfaceTracker::Get()->AcquireNativeWidget(params.surface_id); |
| 263 BrowserCompositorViewMac::GotAcceleratedFrame(native_widget, | 264 BrowserCompositorCALayerTreeMacGotAcceleratedFrame( |
| 264 params.surface_handle, | 265 native_widget, |
| 265 params.surface_id, | 266 params.surface_handle, |
| 266 params.latency_info, | 267 params.surface_id, |
| 267 params.size, | 268 params.latency_info, |
| 268 params.scale_factor, | 269 params.size, |
| 269 host_id_, | 270 params.scale_factor, |
| 270 params.route_id); | 271 &ack_params.disable_throttling, |
| 272 &ack_params.renderer_id); |
| 273 Send(new AcceleratedSurfaceMsg_BufferPresented(params.route_id, ack_params)); |
| 271 #else | 274 #else |
| 272 NOTREACHED(); | 275 NOTREACHED(); |
| 273 #endif | 276 #endif |
| 274 } | 277 } |
| 275 | 278 |
| 276 void GpuProcessHostUIShim::OnVideoMemoryUsageStatsReceived( | 279 void GpuProcessHostUIShim::OnVideoMemoryUsageStatsReceived( |
| 277 const GPUVideoMemoryUsageStats& video_memory_usage_stats) { | 280 const GPUVideoMemoryUsageStats& video_memory_usage_stats) { |
| 278 GpuDataManagerImpl::GetInstance()->UpdateVideoMemoryUsageStats( | 281 GpuDataManagerImpl::GetInstance()->UpdateVideoMemoryUsageStats( |
| 279 video_memory_usage_stats); | 282 video_memory_usage_stats); |
| 280 } | 283 } |
| 281 | 284 |
| 282 } // namespace content | 285 } // namespace content |
| OLD | NEW |