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 | 15 |
16 namespace { | 16 namespace { |
17 | 17 |
18 void OnNativeSurfaceBuffersSwappedOnUIThread( | 18 void OnNativeSurfaceBuffersSwappedOnUIThread( |
19 base::ScopedCFTypeRef<IOSurfaceRef> io_surface, | 19 base::ScopedCFTypeRef<IOSurfaceRef> io_surface, |
20 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params) { | 20 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params) { |
21 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 21 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
22 gfx::AcceleratedWidget native_widget = | 22 gfx::AcceleratedWidget native_widget = |
23 content::GpuSurfaceTracker::Get()->AcquireNativeWidget(params.surface_id); | 23 content::GpuSurfaceTracker::Get()->AcquireNativeWidget(params.surface_id); |
24 [native_widget gotAcceleratedIOSurfaceFrame:params.surface_handle | 24 IOSurfaceID io_surface_handle = static_cast<IOSurfaceID>( |
| 25 params.surface_handle); |
| 26 [native_widget gotAcceleratedIOSurfaceFrame:io_surface_handle |
25 withOutputSurfaceID:params.surface_id | 27 withOutputSurfaceID:params.surface_id |
26 withPixelSize:params.size | 28 withPixelSize:params.size |
27 withScaleFactor:params.scale_factor]; | 29 withScaleFactor:params.scale_factor]; |
28 } | 30 } |
29 | 31 |
30 } // namespace | 32 } // namespace |
31 | 33 |
32 namespace content { | 34 namespace content { |
33 | 35 |
34 void RenderWidgetHelper::OnNativeSurfaceBuffersSwappedOnIOThread( | 36 void RenderWidgetHelper::OnNativeSurfaceBuffersSwappedOnIOThread( |
(...skipping 18 matching lines...) Expand all Loading... |
53 base::ScopedCFTypeRef<IOSurfaceRef> io_surface(IOSurfaceLookup( | 55 base::ScopedCFTypeRef<IOSurfaceRef> io_surface(IOSurfaceLookup( |
54 static_cast<uint32>(params.surface_handle))); | 56 static_cast<uint32>(params.surface_handle))); |
55 | 57 |
56 BrowserThread::PostTask( | 58 BrowserThread::PostTask( |
57 BrowserThread::UI, | 59 BrowserThread::UI, |
58 FROM_HERE, | 60 FROM_HERE, |
59 base::Bind(&OnNativeSurfaceBuffersSwappedOnUIThread, io_surface, params)); | 61 base::Bind(&OnNativeSurfaceBuffersSwappedOnUIThread, io_surface, params)); |
60 } | 62 } |
61 | 63 |
62 } // namespace content | 64 } // namespace content |
OLD | NEW |