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_iosurface_mac.h" | 5 #include "content/common/gpu/image_transport_surface_iosurface_mac.h" |
6 | 6 |
7 #include "content/common/gpu/gpu_messages.h" | 7 #include "content/common/gpu/gpu_messages.h" |
8 #include "content/common/gpu/surface_handle_types_mac.h" | 8 #include "content/common/gpu/surface_handle_types_mac.h" |
9 | 9 |
10 namespace content { | 10 namespace content { |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 | 98 |
99 glFlush(); | 99 glFlush(); |
100 return true; | 100 return true; |
101 } | 101 } |
102 | 102 |
103 void IOSurfaceStorageProvider::FreeColorBufferStorage() { | 103 void IOSurfaceStorageProvider::FreeColorBufferStorage() { |
104 io_surface_.reset(); | 104 io_surface_.reset(); |
105 io_surface_id_ = 0; | 105 io_surface_id_ = 0; |
106 } | 106 } |
107 | 107 |
108 void IOSurfaceStorageProvider::SwapBuffers( | 108 uint64 IOSurfaceStorageProvider::GetSurfaceHandle() const { |
109 const gfx::Size& size, float scale_factor) { | 109 return SurfaceHandleFromIOSurfaceID(io_surface_id_); |
| 110 } |
| 111 |
| 112 void IOSurfaceStorageProvider::WillSwapBuffers() { |
110 // The browser compositor will throttle itself, so we are free to unblock the | 113 // The browser compositor will throttle itself, so we are free to unblock the |
111 // context immediately. Make sure that the browser is doing its throttling | 114 // context immediately. Make sure that the browser is doing its throttling |
112 // appropriately by ensuring that the previous swap was acknowledged before | 115 // appropriately by ensuring that the previous swap was acknowledged before |
113 // we get another swap. | 116 // we get another swap. |
114 DCHECK(pending_swapped_surfaces_.empty()); | 117 DCHECK(pending_swapped_surfaces_.empty()); |
115 pending_swapped_surfaces_.push_back(io_surface_); | 118 pending_swapped_surfaces_.push_back(io_surface_); |
116 | 119 transport_surface_->UnblockContextAfterPendingSwap(); |
117 transport_surface_->SendSwapBuffers( | |
118 SurfaceHandleFromIOSurfaceID(io_surface_id_), size, scale_factor); | |
119 } | 120 } |
120 | 121 |
121 void IOSurfaceStorageProvider::WillWriteToBackbuffer() { | 122 void IOSurfaceStorageProvider::CanFreeSwappedBuffer() { |
122 } | |
123 | |
124 void IOSurfaceStorageProvider::DiscardBackbuffer() { | |
125 } | |
126 | |
127 void IOSurfaceStorageProvider::SwapBuffersAckedByBrowser() { | |
128 DCHECK(!pending_swapped_surfaces_.empty()); | 123 DCHECK(!pending_swapped_surfaces_.empty()); |
129 pending_swapped_surfaces_.pop_front(); | 124 pending_swapped_surfaces_.pop_front(); |
130 } | 125 } |
131 | 126 |
132 } // namespace content | 127 } // namespace content |
OLD | NEW |