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

Side by Side Diff: content/browser/gpu/gpu_process_host_ui_shim.cc

Issue 638123003: Prepare to move BrowserCompositorViewMac to ui (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove TODOs Created 6 years, 2 months 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/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)
26 #include "content/browser/compositor/browser_compositor_view_mac.h"
27 #endif
28
29 #if defined(USE_OZONE) 25 #if defined(USE_OZONE)
30 #include "ui/ozone/public/gpu_platform_support_host.h" 26 #include "ui/ozone/public/gpu_platform_support_host.h"
31 #include "ui/ozone/public/ozone_platform.h" 27 #include "ui/ozone/public/ozone_platform.h"
32 #endif 28 #endif
33 29
34 namespace content { 30 namespace content {
35 31
32 // Forward-definition of the parts of BrowserCompositorCALayerTreeMac that are
33 // needed (the header cannot be included here because it uses Objective C).
34 #if defined(OS_MACOSX)
35 void BrowserCompositorCALayerTreeMacGotAcceleratedFrame(
36 gfx::AcceleratedWidget widget,
37 uint64 surface_handle, int surface_id,
38 const std::vector<ui::LatencyInfo>& latency_info,
39 gfx::Size pixel_size, float scale_factor,
40 bool* disable_throttling, int* renderer_id);
41 #endif
42
36 namespace { 43 namespace {
37 44
38 // One of the linux specific headers defines this as a macro. 45 // One of the linux specific headers defines this as a macro.
39 #ifdef DestroyAll 46 #ifdef DestroyAll
40 #undef DestroyAll 47 #undef DestroyAll
41 #endif 48 #endif
42 49
43 base::LazyInstance<IDMap<GpuProcessHostUIShim> > g_hosts_by_id = 50 base::LazyInstance<IDMap<GpuProcessHostUIShim> > g_hosts_by_id =
44 LAZY_INSTANCE_INITIALIZER; 51 LAZY_INSTANCE_INITIALIZER;
45 52
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 #if defined(OS_MACOSX) 257 #if defined(OS_MACOSX)
251 TRACE_EVENT0("renderer", 258 TRACE_EVENT0("renderer",
252 "GpuProcessHostUIShim::OnAcceleratedSurfaceBuffersSwapped"); 259 "GpuProcessHostUIShim::OnAcceleratedSurfaceBuffersSwapped");
253 if (!ui::LatencyInfo::Verify(params.latency_info, 260 if (!ui::LatencyInfo::Verify(params.latency_info,
254 "GpuHostMsg_AcceleratedSurfaceBuffersSwapped")) { 261 "GpuHostMsg_AcceleratedSurfaceBuffersSwapped")) {
255 return; 262 return;
256 } 263 }
257 264
258 // On Mac with delegated rendering, accelerated surfaces are not necessarily 265 // On Mac with delegated rendering, accelerated surfaces are not necessarily
259 // associated with a RenderWidgetHostViewBase. 266 // associated with a RenderWidgetHostViewBase.
267 AcceleratedSurfaceMsg_BufferPresented_Params ack_params;
260 DCHECK(IsDelegatedRendererEnabled()); 268 DCHECK(IsDelegatedRendererEnabled());
261 gfx::AcceleratedWidget native_widget = 269 gfx::AcceleratedWidget native_widget =
262 content::GpuSurfaceTracker::Get()->AcquireNativeWidget(params.surface_id); 270 content::GpuSurfaceTracker::Get()->AcquireNativeWidget(params.surface_id);
263 BrowserCompositorViewMac::GotAcceleratedFrame(native_widget, 271 BrowserCompositorCALayerTreeMacGotAcceleratedFrame(
264 params.surface_handle, 272 native_widget,
265 params.surface_id, 273 params.surface_handle,
266 params.latency_info, 274 params.surface_id,
267 params.size, 275 params.latency_info,
268 params.scale_factor, 276 params.size,
269 host_id_, 277 params.scale_factor,
270 params.route_id); 278 &ack_params.disable_throttling,
279 &ack_params.renderer_id);
280 Send(new AcceleratedSurfaceMsg_BufferPresented(params.route_id, ack_params));
271 #else 281 #else
272 NOTREACHED(); 282 NOTREACHED();
273 #endif 283 #endif
274 } 284 }
275 285
276 void GpuProcessHostUIShim::OnVideoMemoryUsageStatsReceived( 286 void GpuProcessHostUIShim::OnVideoMemoryUsageStatsReceived(
277 const GPUVideoMemoryUsageStats& video_memory_usage_stats) { 287 const GPUVideoMemoryUsageStats& video_memory_usage_stats) {
278 GpuDataManagerImpl::GetInstance()->UpdateVideoMemoryUsageStats( 288 GpuDataManagerImpl::GetInstance()->UpdateVideoMemoryUsageStats(
279 video_memory_usage_stats); 289 video_memory_usage_stats);
280 } 290 }
281 291
282 } // namespace content 292 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698