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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 forLayerTime:timeInterval | 87 forLayerTime:timeInterval |
88 displayTime:timeStamp]; | 88 displayTime:timeStamp]; |
89 } | 89 } |
90 | 90 |
91 @end | 91 @end |
92 | 92 |
93 namespace content { | 93 namespace content { |
94 | 94 |
95 CALayerStorageProvider::CALayerStorageProvider( | 95 CALayerStorageProvider::CALayerStorageProvider( |
96 ImageTransportSurfaceFBO* transport_surface) | 96 ImageTransportSurfaceFBO* transport_surface) |
97 : transport_surface_(transport_surface), | 97 : transport_surface_(transport_surface), |
98 gpu_vsync_disabled_(CommandLine::ForCurrentProcess()->HasSwitch( | 98 gpu_vsync_disabled_(base::CommandLine::ForCurrentProcess()->HasSwitch( |
99 switches::kDisableGpuVsync)), | 99 switches::kDisableGpuVsync)), |
100 throttling_disabled_(false), | 100 throttling_disabled_(false), |
101 has_pending_draw_(false), | 101 has_pending_draw_(false), |
102 can_draw_returned_false_count_(0), | 102 can_draw_returned_false_count_(0), |
103 fbo_texture_(0), | 103 fbo_texture_(0), |
104 fbo_scale_factor_(1), | 104 fbo_scale_factor_(1), |
105 recreate_layer_after_gpu_switch_(false), | 105 recreate_layer_after_gpu_switch_(false), |
106 pending_draw_weak_factory_(this) { | 106 pending_draw_weak_factory_(this) { |
107 ui::GpuSwitchingManager::GetInstance()->AddObserver(this); | 107 ui::GpuSwitchingManager::GetInstance()->AddObserver(this); |
108 } | 108 } |
109 | 109 |
110 CALayerStorageProvider::~CALayerStorageProvider() { | 110 CALayerStorageProvider::~CALayerStorageProvider() { |
111 ui::GpuSwitchingManager::GetInstance()->RemoveObserver(this); | 111 ui::GpuSwitchingManager::GetInstance()->RemoveObserver(this); |
112 } | 112 } |
113 | 113 |
114 gfx::Size CALayerStorageProvider::GetRoundedSize(gfx::Size size) { | 114 gfx::Size CALayerStorageProvider::GetRoundedSize(gfx::Size size) { |
115 return size; | 115 return size; |
116 } | 116 } |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 return; | 371 return; |
372 pending_draw_weak_factory_.InvalidateWeakPtrs(); | 372 pending_draw_weak_factory_.InvalidateWeakPtrs(); |
373 has_pending_draw_ = false; | 373 has_pending_draw_ = false; |
374 transport_surface_->SendSwapBuffers( | 374 transport_surface_->SendSwapBuffers( |
375 ui::SurfaceHandleFromCAContextID([context_ contextId]), | 375 ui::SurfaceHandleFromCAContextID([context_ contextId]), |
376 fbo_pixel_size_, | 376 fbo_pixel_size_, |
377 fbo_scale_factor_); | 377 fbo_scale_factor_); |
378 } | 378 } |
379 | 379 |
380 } // namespace content | 380 } // namespace content |
OLD | NEW |