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