| 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/common/gpu/image_transport_surface_calayer_mac.h" | 5 #include "content/common/gpu/image_transport_surface_calayer_mac.h" |
| 6 | 6 |
| 7 #include <OpenGL/CGLRenderers.h> | 7 #include <OpenGL/CGLRenderers.h> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/mac/sdk_forward_declarations.h" | 10 #include "base/mac/sdk_forward_declarations.h" |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 [layer_ resetStorageProvider]; | 283 [layer_ resetStorageProvider]; |
| 284 layer_.reset(); | 284 layer_.reset(); |
| 285 | 285 |
| 286 share_group_context_.reset(); | 286 share_group_context_.reset(); |
| 287 share_group_context_dirtied_callback_ = base::Closure(); | 287 share_group_context_dirtied_callback_ = base::Closure(); |
| 288 fbo_texture_ = 0; | 288 fbo_texture_ = 0; |
| 289 fbo_pixel_size_ = gfx::Size(); | 289 fbo_pixel_size_ = gfx::Size(); |
| 290 can_draw_returned_false_count_ = 0; | 290 can_draw_returned_false_count_ = 0; |
| 291 } | 291 } |
| 292 | 292 |
| 293 void CALayerStorageProvider::SwapBuffers( | 293 void CALayerStorageProvider::FrameSizeChanged(const gfx::Size& pixel_size, |
| 294 const gfx::Size& size, float scale_factor) { | 294 float scale_factor) { |
| 295 DCHECK_EQ(fbo_pixel_size_.ToString(), pixel_size.ToString()); |
| 296 DCHECK_EQ(fbo_scale_factor_, scale_factor); |
| 297 } |
| 298 |
| 299 void CALayerStorageProvider::SwapBuffers() { |
| 295 DCHECK(!has_pending_draw_); | 300 DCHECK(!has_pending_draw_); |
| 296 | 301 |
| 297 // Recreate the CALayer on the new GPU if a GPU switch has occurred. Note | 302 // Recreate the CALayer on the new GPU if a GPU switch has occurred. Note |
| 298 // that the CAContext will retain a reference to the old CALayer until the | 303 // that the CAContext will retain a reference to the old CALayer until the |
| 299 // call to -[CAContext setLayer:] replaces the old CALayer with the new one. | 304 // call to -[CAContext setLayer:] replaces the old CALayer with the new one. |
| 300 if (recreate_layer_after_gpu_switch_) { | 305 if (recreate_layer_after_gpu_switch_) { |
| 301 [layer_ resetStorageProvider]; | 306 [layer_ resetStorageProvider]; |
| 302 layer_.reset(); | 307 layer_.reset(); |
| 303 recreate_layer_after_gpu_switch_ = false; | 308 recreate_layer_after_gpu_switch_ = false; |
| 304 } | 309 } |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 return; | 546 return; |
| 542 pending_draw_weak_factory_.InvalidateWeakPtrs(); | 547 pending_draw_weak_factory_.InvalidateWeakPtrs(); |
| 543 has_pending_draw_ = false; | 548 has_pending_draw_ = false; |
| 544 transport_surface_->SendSwapBuffers( | 549 transport_surface_->SendSwapBuffers( |
| 545 ui::SurfaceHandleFromCAContextID([context_ contextId]), | 550 ui::SurfaceHandleFromCAContextID([context_ contextId]), |
| 546 fbo_pixel_size_, | 551 fbo_pixel_size_, |
| 547 fbo_scale_factor_); | 552 fbo_scale_factor_); |
| 548 } | 553 } |
| 549 | 554 |
| 550 } // namespace content | 555 } // namespace content |
| OLD | NEW |