| 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_private_mac.h" | 5 #include "content/browser/compositor/browser_compositor_view_private_mac.h" |
| 6 | 6 |
| 7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
| 8 #include "content/browser/compositor/gpu_process_transport_factory.h" | 8 #include "content/browser/compositor/gpu_process_transport_factory.h" |
| 9 #include "content/browser/renderer_host/compositing_iosurface_context_mac.h" | 9 #include "content/browser/renderer_host/compositing_iosurface_context_mac.h" |
| 10 #include "content/browser/renderer_host/compositing_iosurface_mac.h" | 10 #include "content/browser/renderer_host/compositing_iosurface_mac.h" |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 withScaleFactor:scale_factor]; | 189 withScaleFactor:scale_factor]; |
| 190 | 190 |
| 191 // If there was an accelerated layer, remove it. | 191 // If there was an accelerated layer, remove it. |
| 192 { | 192 { |
| 193 [accelerated_layer_ resetClient]; | 193 [accelerated_layer_ resetClient]; |
| 194 [accelerated_layer_ removeFromSuperlayer]; | 194 [accelerated_layer_ removeFromSuperlayer]; |
| 195 accelerated_layer_.reset(); | 195 accelerated_layer_.reset(); |
| 196 } | 196 } |
| 197 } | 197 } |
| 198 | 198 |
| 199 bool BrowserCompositorViewMacInternal::AcceleratedLayerShouldAckImmediately() |
| 200 const { |
| 201 // If there is no client then the accelerated layer is not in the hierarchy |
| 202 // and will never draw. |
| 203 if (!client_) |
| 204 return true; |
| 205 return client_->BrowserCompositorViewShouldAckImmediately(); |
| 206 } |
| 207 |
| 199 void BrowserCompositorViewMacInternal::AcceleratedLayerDidDrawFrame( | 208 void BrowserCompositorViewMacInternal::AcceleratedLayerDidDrawFrame( |
| 200 bool succeeded) { | 209 bool succeeded) { |
| 201 if (accelerated_layer_output_surface_id_) { | 210 if (accelerated_layer_output_surface_id_) { |
| 202 content::ImageTransportFactory::GetInstance()->OnSurfaceDisplayed( | 211 content::ImageTransportFactory::GetInstance()->OnSurfaceDisplayed( |
| 203 accelerated_layer_output_surface_id_); | 212 accelerated_layer_output_surface_id_); |
| 204 accelerated_layer_output_surface_id_ = 0; | 213 accelerated_layer_output_surface_id_ = 0; |
| 205 } | 214 } |
| 206 | 215 |
| 207 if (client_) | 216 if (client_) |
| 208 client_->BrowserCompositorViewFrameSwapped(accelerated_latency_info_); | 217 client_->BrowserCompositorViewFrameSwapped(accelerated_latency_info_); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 - (void)gotSoftwareFrame:(cc::SoftwareFrameData*)frame_data | 262 - (void)gotSoftwareFrame:(cc::SoftwareFrameData*)frame_data |
| 254 withScaleFactor:(float)scale_factor | 263 withScaleFactor:(float)scale_factor |
| 255 withCanvas:(SkCanvas*)canvas { | 264 withCanvas:(SkCanvas*)canvas { |
| 256 if (!client_) | 265 if (!client_) |
| 257 return; | 266 return; |
| 258 client_->GotSoftwareFrame(frame_data, scale_factor, canvas); | 267 client_->GotSoftwareFrame(frame_data, scale_factor, canvas); |
| 259 } | 268 } |
| 260 | 269 |
| 261 @end // BrowserCompositorViewCocoa | 270 @end // BrowserCompositorViewCocoa |
| 262 | 271 |
| OLD | NEW |