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

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

Issue 745453002: Create an AcceleratedWidgetMac (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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/compositor/gpu_process_transport_factory.h"
14 #include "content/browser/gpu/compositor_util.h" 15 #include "content/browser/gpu/compositor_util.h"
15 #include "content/browser/gpu/gpu_data_manager_impl.h" 16 #include "content/browser/gpu/gpu_data_manager_impl.h"
16 #include "content/browser/gpu/gpu_process_host.h" 17 #include "content/browser/gpu/gpu_process_host.h"
17 #include "content/browser/gpu/gpu_surface_tracker.h" 18 #include "content/browser/gpu/gpu_surface_tracker.h"
18 #include "content/browser/renderer_host/render_process_host_impl.h" 19 #include "content/browser/renderer_host/render_process_host_impl.h"
19 #include "content/browser/renderer_host/render_view_host_impl.h" 20 #include "content/browser/renderer_host/render_view_host_impl.h"
20 #include "content/browser/renderer_host/render_widget_helper.h" 21 #include "content/browser/renderer_host/render_widget_helper.h"
21 #include "content/browser/renderer_host/render_widget_host_view_base.h" 22 #include "content/browser/renderer_host/render_widget_host_view_base.h"
22 #include "content/common/gpu/gpu_messages.h" 23 #include "content/common/gpu/gpu_messages.h"
23 #include "content/public/browser/browser_thread.h" 24 #include "content/public/browser/browser_thread.h"
24 25
25 #if defined(OS_MACOSX) 26 #if defined(OS_MACOSX)
26 #include "content/browser/compositor/browser_compositor_ca_layer_tree_mac.h" 27 #include "content/browser/compositor/browser_compositor_ca_layer_tree_mac.h"
27 #endif 28 #endif
28 29
29 #if defined(USE_OZONE) 30 #if defined(USE_OZONE)
30 #include "ui/ozone/public/gpu_platform_support_host.h" 31 #include "ui/ozone/public/gpu_platform_support_host.h"
31 #include "ui/ozone/public/ozone_platform.h" 32 #include "ui/ozone/public/ozone_platform.h"
32 #endif 33 #endif
33 34
34 namespace content { 35 namespace content {
35 36
36 namespace { 37 namespace {
37 38
38 // One of the linux specific headers defines this as a macro. 39 // One of the linux specific headers defines this as a macro.
39 #ifdef DestroyAll 40 #ifdef DestroyAll
40 #undef DestroyAll 41 #undef DestroyAll
41 #endif 42 #endif
42 43
44 void OnSurfaceDisplayedCallback(int output_surface_id) {
45 content::ImageTransportFactory::GetInstance()->OnSurfaceDisplayed(
46 output_surface_id);
47 }
48
43 base::LazyInstance<IDMap<GpuProcessHostUIShim> > g_hosts_by_id = 49 base::LazyInstance<IDMap<GpuProcessHostUIShim> > g_hosts_by_id =
44 LAZY_INSTANCE_INITIALIZER; 50 LAZY_INSTANCE_INITIALIZER;
45 51
46 void SendOnIOThreadTask(int host_id, IPC::Message* msg) { 52 void SendOnIOThreadTask(int host_id, IPC::Message* msg) {
47 GpuProcessHost* host = GpuProcessHost::FromID(host_id); 53 GpuProcessHost* host = GpuProcessHost::FromID(host_id);
48 if (host) 54 if (host)
49 host->Send(msg); 55 host->Send(msg);
50 else 56 else
51 delete msg; 57 delete msg;
52 } 58 }
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 "GpuHostMsg_AcceleratedSurfaceBuffersSwapped")) { 260 "GpuHostMsg_AcceleratedSurfaceBuffersSwapped")) {
255 return; 261 return;
256 } 262 }
257 263
258 // On Mac with delegated rendering, accelerated surfaces are not necessarily 264 // On Mac with delegated rendering, accelerated surfaces are not necessarily
259 // associated with a RenderWidgetHostViewBase. 265 // associated with a RenderWidgetHostViewBase.
260 AcceleratedSurfaceMsg_BufferPresented_Params ack_params; 266 AcceleratedSurfaceMsg_BufferPresented_Params ack_params;
261 DCHECK(IsDelegatedRendererEnabled()); 267 DCHECK(IsDelegatedRendererEnabled());
262 gfx::AcceleratedWidget native_widget = 268 gfx::AcceleratedWidget native_widget =
263 content::GpuSurfaceTracker::Get()->AcquireNativeWidget(params.surface_id); 269 content::GpuSurfaceTracker::Get()->AcquireNativeWidget(params.surface_id);
264 BrowserCompositorCALayerTreeMacGotAcceleratedFrame( 270 AcceleratedWidgetMacGotAcceleratedFrame(
265 native_widget, 271 native_widget,
266 params.surface_handle, 272 params.surface_handle,
267 params.surface_id,
268 params.latency_info, 273 params.latency_info,
269 params.size, 274 params.size,
270 params.scale_factor, 275 params.scale_factor,
276 base::Bind(&OnSurfaceDisplayedCallback, params.surface_id),
271 &ack_params.disable_throttling, 277 &ack_params.disable_throttling,
272 &ack_params.renderer_id); 278 &ack_params.renderer_id);
273 Send(new AcceleratedSurfaceMsg_BufferPresented(params.route_id, ack_params)); 279 Send(new AcceleratedSurfaceMsg_BufferPresented(params.route_id, ack_params));
274 #else 280 #else
275 NOTREACHED(); 281 NOTREACHED();
276 #endif 282 #endif
277 } 283 }
278 284
279 void GpuProcessHostUIShim::OnVideoMemoryUsageStatsReceived( 285 void GpuProcessHostUIShim::OnVideoMemoryUsageStatsReceived(
280 const GPUVideoMemoryUsageStats& video_memory_usage_stats) { 286 const GPUVideoMemoryUsageStats& video_memory_usage_stats) {
281 GpuDataManagerImpl::GetInstance()->UpdateVideoMemoryUsageStats( 287 GpuDataManagerImpl::GetInstance()->UpdateVideoMemoryUsageStats(
282 video_memory_usage_stats); 288 video_memory_usage_stats);
283 } 289 }
284 290
285 } // namespace content 291 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698