OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/renderer_host/render_widget_helper.h" | 5 #include "content/browser/renderer_host/render_widget_helper.h" |
6 | 6 |
7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
8 #include <IOSurface/IOSurfaceAPI.h> | 8 #include <IOSurface/IOSurfaceAPI.h> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "content/browser/compositor/browser_compositor_view_mac.h" | 11 #include "content/browser/compositor/browser_compositor_view_mac.h" |
12 #include "content/browser/gpu/gpu_process_host.h" | 12 #include "content/browser/gpu/gpu_process_host.h" |
13 #include "content/browser/gpu/gpu_surface_tracker.h" | 13 #include "content/browser/gpu/gpu_surface_tracker.h" |
14 #include "content/common/gpu/gpu_messages.h" | 14 #include "content/common/gpu/gpu_messages.h" |
| 15 #include "content/common/gpu/surface_handle_types_mac.h" |
15 | 16 |
16 namespace { | 17 namespace { |
17 | 18 |
18 void OnNativeSurfaceBuffersSwappedOnUIThread( | 19 void OnNativeSurfaceBuffersSwappedOnUIThread( |
19 base::ScopedCFTypeRef<IOSurfaceRef> io_surface, | 20 base::ScopedCFTypeRef<IOSurfaceRef> io_surface, |
20 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params) { | 21 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params) { |
21 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 22 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
22 gfx::AcceleratedWidget native_widget = | 23 gfx::AcceleratedWidget native_widget = |
23 content::GpuSurfaceTracker::Get()->AcquireNativeWidget(params.surface_id); | 24 content::GpuSurfaceTracker::Get()->AcquireNativeWidget(params.surface_id); |
24 IOSurfaceID io_surface_handle = static_cast<IOSurfaceID>( | 25 IOSurfaceID io_surface_id = content::IOSurfaceIDFromSurfaceHandle( |
25 params.surface_handle); | 26 params.surface_handle); |
26 [native_widget gotAcceleratedIOSurfaceFrame:io_surface_handle | 27 [native_widget gotAcceleratedIOSurfaceFrame:io_surface_id |
27 withOutputSurfaceID:params.surface_id | 28 withOutputSurfaceID:params.surface_id |
28 withPixelSize:params.size | 29 withPixelSize:params.size |
29 withScaleFactor:params.scale_factor]; | 30 withScaleFactor:params.scale_factor]; |
30 } | 31 } |
31 | 32 |
32 } // namespace | 33 } // namespace |
33 | 34 |
34 namespace content { | 35 namespace content { |
35 | 36 |
36 void RenderWidgetHelper::OnNativeSurfaceBuffersSwappedOnIOThread( | 37 void RenderWidgetHelper::OnNativeSurfaceBuffersSwappedOnIOThread( |
(...skipping 18 matching lines...) Expand all Loading... |
55 base::ScopedCFTypeRef<IOSurfaceRef> io_surface(IOSurfaceLookup( | 56 base::ScopedCFTypeRef<IOSurfaceRef> io_surface(IOSurfaceLookup( |
56 static_cast<uint32>(params.surface_handle))); | 57 static_cast<uint32>(params.surface_handle))); |
57 | 58 |
58 BrowserThread::PostTask( | 59 BrowserThread::PostTask( |
59 BrowserThread::UI, | 60 BrowserThread::UI, |
60 FROM_HERE, | 61 FROM_HERE, |
61 base::Bind(&OnNativeSurfaceBuffersSwappedOnUIThread, io_surface, params)); | 62 base::Bind(&OnNativeSurfaceBuffersSwappedOnUIThread, io_surface, params)); |
62 } | 63 } |
63 | 64 |
64 } // namespace content | 65 } // namespace content |
OLD | NEW |