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/compositor/browser_compositor_view_mac.h" | 5 #include "content/browser/compositor/browser_compositor_view_mac.h" |
6 | 6 |
7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "base/mac/scoped_cftyperef.h" | 8 #include "base/mac/scoped_cftyperef.h" |
9 #include "content/browser/compositor/gpu_process_transport_factory.h" | 9 #include "content/browser/compositor/gpu_process_transport_factory.h" |
10 #include "content/browser/renderer_host/compositing_iosurface_context_mac.h" | 10 #include "content/browser/renderer_host/compositing_iosurface_context_mac.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 BrowserCompositorViewMac* view_; | 41 BrowserCompositorViewMac* view_; |
42 }; | 42 }; |
43 | 43 |
44 } // namespace content | 44 } // namespace content |
45 | 45 |
46 | 46 |
47 // The default implementation of additions to the NSView interface for browser | 47 // The default implementation of additions to the NSView interface for browser |
48 // compositing should never be called. Log an error if they are. | 48 // compositing should never be called. Log an error if they are. |
49 @implementation NSView (BrowserCompositorView) | 49 @implementation NSView (BrowserCompositorView) |
50 | 50 |
51 - (void)gotAcceleratedIOSurfaceFrame:(uint64)surface_handle | 51 - (void)gotAcceleratedIOSurfaceFrame:(IOSurfaceID)surface_handle |
52 withOutputSurfaceID:(int)surface_id | 52 withOutputSurfaceID:(int)surface_id |
53 withPixelSize:(gfx::Size)pixel_size | 53 withPixelSize:(gfx::Size)pixel_size |
54 withScaleFactor:(float)scale_factor { | 54 withScaleFactor:(float)scale_factor { |
55 DLOG(ERROR) << "-[NSView gotAcceleratedIOSurfaceFrame] called on " | 55 DLOG(ERROR) << "-[NSView gotAcceleratedIOSurfaceFrame] called on " |
56 << "non-overriden class."; | 56 << "non-overriden class."; |
57 } | 57 } |
58 | 58 |
59 - (void)gotSoftwareFrame:(cc::SoftwareFrameData*)frame_data | 59 - (void)gotSoftwareFrame:(cc::SoftwareFrameData*)frame_data |
60 withScaleFactor:(float)scale_factor | 60 withScaleFactor:(float)scale_factor |
61 withCanvas:(SkCanvas*)canvas { | 61 withCanvas:(SkCanvas*)canvas { |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 } | 141 } |
142 | 142 |
143 - (void)resetClient { | 143 - (void)resetClient { |
144 [accelerated_layer_ resetClient]; | 144 [accelerated_layer_ resetClient]; |
145 } | 145 } |
146 | 146 |
147 - (ui::Compositor*)compositor { | 147 - (ui::Compositor*)compositor { |
148 return compositor_.get(); | 148 return compositor_.get(); |
149 } | 149 } |
150 | 150 |
151 - (void)gotAcceleratedIOSurfaceFrame:(uint64)surface_handle | 151 - (void)gotAcceleratedIOSurfaceFrame:(IOSurfaceID)surface_handle |
152 withOutputSurfaceID:(int)surface_id | 152 withOutputSurfaceID:(int)surface_id |
153 withPixelSize:(gfx::Size)pixel_size | 153 withPixelSize:(gfx::Size)pixel_size |
154 withScaleFactor:(float)scale_factor { | 154 withScaleFactor:(float)scale_factor { |
155 DCHECK(!accelerated_layer_output_surface_id_); | 155 DCHECK(!accelerated_layer_output_surface_id_); |
156 accelerated_layer_output_surface_id_ = surface_id; | 156 accelerated_layer_output_surface_id_ = surface_id; |
157 | 157 |
158 ScopedCAActionDisabler disabler; | 158 ScopedCAActionDisabler disabler; |
159 | 159 |
160 // If there is already an accelerated layer, but it has the wrong scale | 160 // If there is already an accelerated layer, but it has the wrong scale |
161 // factor or it was poisoned, remove the old layer and replace it. | 161 // factor or it was poisoned, remove the old layer and replace it. |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 - (void)layerDidDrawFrame { | 247 - (void)layerDidDrawFrame { |
248 if (!accelerated_layer_output_surface_id_) | 248 if (!accelerated_layer_output_surface_id_) |
249 return; | 249 return; |
250 | 250 |
251 content::ImageTransportFactory::GetInstance()->OnSurfaceDisplayed( | 251 content::ImageTransportFactory::GetInstance()->OnSurfaceDisplayed( |
252 accelerated_layer_output_surface_id_); | 252 accelerated_layer_output_surface_id_); |
253 accelerated_layer_output_surface_id_ = 0; | 253 accelerated_layer_output_surface_id_ = 0; |
254 } | 254 } |
255 | 255 |
256 @end // BrowserCompositorViewMac | 256 @end // BrowserCompositorViewMac |
OLD | NEW |