| 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/gpu_data_manager_impl.h" | 15 #include "content/browser/gpu/gpu_data_manager_impl.h" |
| 15 #include "content/browser/gpu/gpu_process_host.h" | 16 #include "content/browser/gpu/gpu_process_host.h" |
| 16 #include "content/browser/gpu/gpu_surface_tracker.h" | 17 #include "content/browser/gpu/gpu_surface_tracker.h" |
| 17 #include "content/browser/renderer_host/render_process_host_impl.h" | 18 #include "content/browser/renderer_host/render_process_host_impl.h" |
| 18 #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" |
| 19 #include "content/browser/renderer_host/render_widget_host_view_base.h" | 21 #include "content/browser/renderer_host/render_widget_host_view_base.h" |
| 20 #include "content/common/gpu/gpu_messages.h" | 22 #include "content/common/gpu/gpu_messages.h" |
| 21 #include "content/public/browser/browser_thread.h" | 23 #include "content/public/browser/browser_thread.h" |
| 22 | 24 |
| 23 #if defined(USE_OZONE) | 25 #if defined(USE_OZONE) |
| 24 #include "ui/ozone/public/gpu_platform_support_host.h" | 26 #include "ui/ozone/public/gpu_platform_support_host.h" |
| 25 #include "ui/ozone/public/ozone_platform.h" | 27 #include "ui/ozone/public/ozone_platform.h" |
| 26 #endif | 28 #endif |
| 27 | 29 |
| 28 namespace content { | 30 namespace content { |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 view->AcceleratedSurfaceInitialized(host_id_, route_id); | 249 view->AcceleratedSurfaceInitialized(host_id_, route_id); |
| 248 } | 250 } |
| 249 | 251 |
| 250 void GpuProcessHostUIShim::OnAcceleratedSurfaceBuffersSwapped( | 252 void GpuProcessHostUIShim::OnAcceleratedSurfaceBuffersSwapped( |
| 251 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params) { | 253 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params) { |
| 252 TRACE_EVENT0("renderer", | 254 TRACE_EVENT0("renderer", |
| 253 "GpuProcessHostUIShim::OnAcceleratedSurfaceBuffersSwapped"); | 255 "GpuProcessHostUIShim::OnAcceleratedSurfaceBuffersSwapped"); |
| 254 if (!ui::LatencyInfo::Verify(params.latency_info, | 256 if (!ui::LatencyInfo::Verify(params.latency_info, |
| 255 "GpuHostMsg_AcceleratedSurfaceBuffersSwapped")) | 257 "GpuHostMsg_AcceleratedSurfaceBuffersSwapped")) |
| 256 return; | 258 return; |
| 259 |
| 260 #if defined(OS_MACOSX) |
| 261 // On Mac with delegated rendering, accelerated surfaces are swapped by |
| 262 // calling a method on their NSView. |
| 263 if (IsDelegatedRendererEnabled()) { |
| 264 RenderWidgetHelper::OnNativeSurfaceBuffersSwappedOnUIThread(params); |
| 265 return; |
| 266 } |
| 267 #endif |
| 268 |
| 257 AcceleratedSurfaceMsg_BufferPresented_Params ack_params; | 269 AcceleratedSurfaceMsg_BufferPresented_Params ack_params; |
| 258 ack_params.mailbox = params.mailbox; | 270 ack_params.mailbox = params.mailbox; |
| 259 ack_params.sync_point = 0; | 271 ack_params.sync_point = 0; |
| 260 ScopedSendOnIOThread delayed_send( | 272 ScopedSendOnIOThread delayed_send( |
| 261 host_id_, | 273 host_id_, |
| 262 new AcceleratedSurfaceMsg_BufferPresented(params.route_id, | 274 new AcceleratedSurfaceMsg_BufferPresented(params.route_id, |
| 263 ack_params)); | 275 ack_params)); |
| 264 | 276 |
| 265 RenderWidgetHostViewBase* view = GetRenderWidgetHostViewFromSurfaceID( | 277 RenderWidgetHostViewBase* view = GetRenderWidgetHostViewFromSurfaceID( |
| 266 params.surface_id); | 278 params.surface_id); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 view->AcceleratedSurfaceRelease(); | 356 view->AcceleratedSurfaceRelease(); |
| 345 } | 357 } |
| 346 | 358 |
| 347 void GpuProcessHostUIShim::OnVideoMemoryUsageStatsReceived( | 359 void GpuProcessHostUIShim::OnVideoMemoryUsageStatsReceived( |
| 348 const GPUVideoMemoryUsageStats& video_memory_usage_stats) { | 360 const GPUVideoMemoryUsageStats& video_memory_usage_stats) { |
| 349 GpuDataManagerImpl::GetInstance()->UpdateVideoMemoryUsageStats( | 361 GpuDataManagerImpl::GetInstance()->UpdateVideoMemoryUsageStats( |
| 350 video_memory_usage_stats); | 362 video_memory_usage_stats); |
| 351 } | 363 } |
| 352 | 364 |
| 353 } // namespace content | 365 } // namespace content |
| OLD | NEW |