| 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 [native_widget gotAcceleratedIOSurfaceFrame:params.surface_handle |
| 25 withOutputSurfaceID:params.surface_id |
| 25 withPixelSize:params.size | 26 withPixelSize:params.size |
| 26 withScaleFactor:params.scale_factor]; | 27 withScaleFactor:params.scale_factor]; |
| 27 } | 28 } |
| 28 | 29 |
| 29 } // namespace | 30 } // namespace |
| 30 | 31 |
| 31 namespace content { | 32 namespace content { |
| 32 | 33 |
| 33 void RenderWidgetHelper::OnNativeSurfaceBuffersSwappedOnIOThread( | 34 void RenderWidgetHelper::OnNativeSurfaceBuffersSwappedOnIOThread( |
| 34 GpuProcessHost* gpu_process_host, | 35 GpuProcessHost* gpu_process_host, |
| (...skipping 17 matching lines...) Expand all Loading... |
| 52 base::ScopedCFTypeRef<IOSurfaceRef> io_surface(IOSurfaceLookup( | 53 base::ScopedCFTypeRef<IOSurfaceRef> io_surface(IOSurfaceLookup( |
| 53 static_cast<uint32>(params.surface_handle))); | 54 static_cast<uint32>(params.surface_handle))); |
| 54 | 55 |
| 55 BrowserThread::PostTask( | 56 BrowserThread::PostTask( |
| 56 BrowserThread::UI, | 57 BrowserThread::UI, |
| 57 FROM_HERE, | 58 FROM_HERE, |
| 58 base::Bind(&OnNativeSurfaceBuffersSwappedOnUIThread, io_surface, params)); | 59 base::Bind(&OnNativeSurfaceBuffersSwappedOnUIThread, io_surface, params)); |
| 59 } | 60 } |
| 60 | 61 |
| 61 } // namespace content | 62 } // namespace content |
| OLD | NEW |