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

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

Issue 1532813002: Replace IOSurfaceManager by directly passing IOSurface Mach ports over Chrome IPC. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 11 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 "build/build_config.h" 15 #include "build/build_config.h"
16 #include "content/browser/compositor/gpu_process_transport_factory.h" 16 #include "content/browser/compositor/gpu_process_transport_factory.h"
17 #include "content/browser/gpu/compositor_util.h" 17 #include "content/browser/gpu/compositor_util.h"
18 #include "content/browser/gpu/gpu_data_manager_impl.h" 18 #include "content/browser/gpu/gpu_data_manager_impl.h"
19 #include "content/browser/gpu/gpu_process_host.h" 19 #include "content/browser/gpu/gpu_process_host.h"
20 #include "content/browser/gpu/gpu_surface_tracker.h" 20 #include "content/browser/gpu/gpu_surface_tracker.h"
21 #include "content/browser/renderer_host/render_process_host_impl.h" 21 #include "content/browser/renderer_host/render_process_host_impl.h"
22 #include "content/browser/renderer_host/render_view_host_impl.h" 22 #include "content/browser/renderer_host/render_view_host_impl.h"
23 #include "content/browser/renderer_host/render_widget_helper.h" 23 #include "content/browser/renderer_host/render_widget_helper.h"
24 #include "content/browser/renderer_host/render_widget_host_view_base.h" 24 #include "content/browser/renderer_host/render_widget_host_view_base.h"
25 #include "content/common/gpu/gpu_messages.h" 25 #include "content/common/gpu/gpu_messages.h"
26 #include "content/public/browser/browser_thread.h" 26 #include "content/public/browser/browser_thread.h"
27 27
28 #if defined(OS_MACOSX) 28 #if defined(OS_MACOSX)
29 #include "content/browser/browser_io_surface_manager_mac.h"
30 #include "ui/accelerated_widget_mac/accelerated_widget_mac.h" 29 #include "ui/accelerated_widget_mac/accelerated_widget_mac.h"
31 #endif 30 #endif
32 31
33 #if defined(USE_OZONE) 32 #if defined(USE_OZONE)
34 #include "ui/ozone/public/gpu_platform_support_host.h" 33 #include "ui/ozone/public/gpu_platform_support_host.h"
35 #include "ui/ozone/public/ozone_platform.h" 34 #include "ui/ozone/public/ozone_platform.h"
36 #endif 35 #endif
37 36
38 namespace content { 37 namespace content {
39 38
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 // no longer attached to, do not pass the frame along to the widget. Just ack 238 // no longer attached to, do not pass the frame along to the widget. Just ack
240 // it to the GPU process immediately, so we can proceed to the next frame. 239 // it to the GPU process immediately, so we can proceed to the next frame.
241 bool should_not_show_frame = 240 bool should_not_show_frame =
242 content::ImageTransportFactory::GetInstance() 241 content::ImageTransportFactory::GetInstance()
243 ->SurfaceShouldNotShowFramesAfterSuspendForRecycle(params.surface_id); 242 ->SurfaceShouldNotShowFramesAfterSuspendForRecycle(params.surface_id);
244 if (!should_not_show_frame) { 243 if (!should_not_show_frame) {
245 gfx::AcceleratedWidget native_widget = 244 gfx::AcceleratedWidget native_widget =
246 content::GpuSurfaceTracker::Get()->AcquireNativeWidget( 245 content::GpuSurfaceTracker::Get()->AcquireNativeWidget(
247 params.surface_id); 246 params.surface_id);
248 base::ScopedCFTypeRef<IOSurfaceRef> io_surface; 247 base::ScopedCFTypeRef<IOSurfaceRef> io_surface;
249 CAContextID ca_context_id = 0; 248 CAContextID ca_context_id = params.ca_context_id;
250 249
251 switch (ui::GetSurfaceHandleType(params.surface_handle)) { 250 DCHECK((params.ca_context_id == 0) ^
252 case ui::kSurfaceHandleTypeIOSurface: { 251 (params.io_surface.get() == MACH_PORT_NULL));
253 IOSurfaceID io_surface_id = 252 if (params.io_surface.get()) {
254 ui::IOSurfaceIDFromSurfaceHandle(params.surface_handle); 253 io_surface.reset(IOSurfaceLookupFromMachPort(params.io_surface));
255 io_surface.reset(
256 BrowserIOSurfaceManager::GetInstance()->AcquireIOSurface(
257 gfx::GenericSharedMemoryId(io_surface_id)));
258 break;
259 }
260 case ui::kSurfaceHandleTypeCAContext: {
261 ca_context_id = ui::CAContextIDFromSurfaceHandle(params.surface_handle);
262 break;
263 }
264 default:
265 DLOG(ERROR) << "Unrecognized accelerated frame type.";
266 return;
267 } 254 }
268 255
269 ui::AcceleratedWidgetMacGotFrame(native_widget, ca_context_id, io_surface, 256 ui::AcceleratedWidgetMacGotFrame(native_widget, ca_context_id, io_surface,
270 params.size, params.scale_factor, 257 params.size, params.scale_factor,
271 &ack_params.vsync_timebase, 258 &ack_params.vsync_timebase,
272 &ack_params.vsync_interval); 259 &ack_params.vsync_interval);
273 } 260 }
274 261
275 content::ImageTransportFactory::GetInstance()->OnGpuSwapBuffersCompleted( 262 content::ImageTransportFactory::GetInstance()->OnGpuSwapBuffersCompleted(
276 params.surface_id, params.latency_info, gfx::SwapResult::SWAP_ACK); 263 params.surface_id, params.latency_info, gfx::SwapResult::SWAP_ACK);
(...skipping 18 matching lines...) Expand all
295 282
296 void GpuProcessHostUIShim::OnRemoveSubscription(int32_t process_id, 283 void GpuProcessHostUIShim::OnRemoveSubscription(int32_t process_id,
297 unsigned int target) { 284 unsigned int target) {
298 RenderProcessHost* rph = RenderProcessHost::FromID(process_id); 285 RenderProcessHost* rph = RenderProcessHost::FromID(process_id);
299 if (rph) { 286 if (rph) {
300 rph->OnRemoveSubscription(target); 287 rph->OnRemoveSubscription(target);
301 } 288 }
302 } 289 }
303 290
304 } // namespace content 291 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/gpu/gpu_process_host.cc ('k') | content/browser/in_process_io_surface_manager_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698