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

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

Issue 1416363002: Mac: Always use surfaceless mode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove extra diffs Created 5 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/callback_helpers.h" 10 #include "base/callback_helpers.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 "base/trace_event/trace_event.h" 14 #include "base/trace_event/trace_event.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/browser_io_surface_manager_mac.h"
28 #include "ui/accelerated_widget_mac/accelerated_widget_mac.h" 29 #include "ui/accelerated_widget_mac/accelerated_widget_mac.h"
29 #endif 30 #endif
30 31
31 #if defined(USE_OZONE) 32 #if defined(USE_OZONE)
32 #include "ui/ozone/public/gpu_platform_support_host.h" 33 #include "ui/ozone/public/gpu_platform_support_host.h"
33 #include "ui/ozone/public/ozone_platform.h" 34 #include "ui/ozone/public/ozone_platform.h"
34 #endif 35 #endif
35 36
36 namespace content { 37 namespace content {
37 38
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 // it to the GPU process immediately, so we can proceed to the next frame. 246 // it to the GPU process immediately, so we can proceed to the next frame.
246 bool should_not_show_frame = 247 bool should_not_show_frame =
247 content::ImageTransportFactory::GetInstance() 248 content::ImageTransportFactory::GetInstance()
248 ->SurfaceShouldNotShowFramesAfterSuspendForRecycle(params.surface_id); 249 ->SurfaceShouldNotShowFramesAfterSuspendForRecycle(params.surface_id);
249 if (should_not_show_frame) { 250 if (should_not_show_frame) {
250 OnSurfaceDisplayedCallback(params.surface_id); 251 OnSurfaceDisplayedCallback(params.surface_id);
251 } else { 252 } else {
252 gfx::AcceleratedWidget native_widget = 253 gfx::AcceleratedWidget native_widget =
253 content::GpuSurfaceTracker::Get()->AcquireNativeWidget( 254 content::GpuSurfaceTracker::Get()->AcquireNativeWidget(
254 params.surface_id); 255 params.surface_id);
256 base::ScopedCFTypeRef<IOSurfaceRef> io_surface;
257 CAContextID ca_context_id = 0;
258
259 switch (ui::GetSurfaceHandleType(params.surface_handle)) {
260 case ui::kSurfaceHandleTypeIOSurface: {
261 IOSurfaceID io_surface_id =
262 ui::IOSurfaceIDFromSurfaceHandle(params.surface_handle);
263 io_surface.reset(
264 BrowserIOSurfaceManager::GetInstance()->AcquireIOSurface(
265 gfx::GenericSharedMemoryId(io_surface_id)));
ccameron 2015/10/22 22:16:49 Ensuring that this AcquireIOSurface works is the r
266 break;
267 }
268 case ui::kSurfaceHandleTypeCAContext: {
269 ca_context_id = ui::CAContextIDFromSurfaceHandle(params.surface_handle);
270 break;
271 }
272 default:
273 DLOG(ERROR) << "Unrecognized accelerated frame type.";
274 return;
275 }
255 ui::AcceleratedWidgetMacGotAcceleratedFrame( 276 ui::AcceleratedWidgetMacGotAcceleratedFrame(
256 native_widget, params.surface_handle, params.latency_info, params.size, 277 native_widget, ca_context_id, io_surface, params.latency_info,
257 params.scale_factor, 278 params.size, params.scale_factor, params.damage_rect,
258 params.damage_rect,
259 base::Bind(&OnSurfaceDisplayedCallback, params.surface_id), 279 base::Bind(&OnSurfaceDisplayedCallback, params.surface_id),
260 &ack_params.disable_throttling, &ack_params.renderer_id, 280 &ack_params.disable_throttling, &ack_params.renderer_id,
261 &ack_params.vsync_timebase, &ack_params.vsync_interval); 281 &ack_params.vsync_timebase, &ack_params.vsync_interval);
262 } 282 }
263 Send(new AcceleratedSurfaceMsg_BufferPresented(params.route_id, ack_params)); 283 Send(new AcceleratedSurfaceMsg_BufferPresented(params.route_id, ack_params));
264 } 284 }
265 #endif 285 #endif
266 286
267 void GpuProcessHostUIShim::OnVideoMemoryUsageStatsReceived( 287 void GpuProcessHostUIShim::OnVideoMemoryUsageStatsReceived(
268 const GPUVideoMemoryUsageStats& video_memory_usage_stats) { 288 const GPUVideoMemoryUsageStats& video_memory_usage_stats) {
(...skipping 11 matching lines...) Expand all
280 300
281 void GpuProcessHostUIShim::OnRemoveSubscription( 301 void GpuProcessHostUIShim::OnRemoveSubscription(
282 int32 process_id, unsigned int target) { 302 int32 process_id, unsigned int target) {
283 RenderProcessHost* rph = RenderProcessHost::FromID(process_id); 303 RenderProcessHost* rph = RenderProcessHost::FromID(process_id);
284 if (rph) { 304 if (rph) {
285 rph->OnRemoveSubscription(target); 305 rph->OnRemoveSubscription(target);
286 } 306 }
287 } 307 }
288 308
289 } // namespace content 309 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698