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 uint64 IOSurfaceStorageProvider::GetSurfaceHandle() const { | 108 void IOSurfaceStorageProvider::DiscardBackbuffer() { |
109 return SurfaceHandleFromIOSurfaceID(io_surface_id_); | |
110 } | 109 } |
111 | 110 |
112 void IOSurfaceStorageProvider::WillSwapBuffers() { | 111 uint64 IOSurfaceStorageProvider::SwapBuffersAndGetSurfaceHandle() { |
113 // The browser compositor will throttle itself, so we are free to unblock the | 112 // The browser compositor will throttle itself, so we are free to unblock the |
114 // context immediately. Make sure that the browser is doing its throttling | 113 // context immediately. Make sure that the browser is doing its throttling |
115 // appropriately by ensuring that the previous swap was acknowledged before | 114 // appropriately by ensuring that the previous swap was acknowledged before |
116 // we get another swap. | 115 // we get another swap. |
117 DCHECK(pending_swapped_surfaces_.empty()); | 116 DCHECK(pending_swapped_surfaces_.empty()); |
118 pending_swapped_surfaces_.push_back(io_surface_); | 117 pending_swapped_surfaces_.push_back(io_surface_); |
119 transport_surface_->UnblockContextAfterPendingSwap(); | 118 transport_surface_->UnblockContextAfterPendingSwap(); |
| 119 |
| 120 return SurfaceHandleFromIOSurfaceID(io_surface_id_); |
120 } | 121 } |
121 | 122 |
122 void IOSurfaceStorageProvider::CanFreeSwappedBuffer() { | 123 void IOSurfaceStorageProvider::CanFreeSwappedBuffer() { |
123 DCHECK(!pending_swapped_surfaces_.empty()); | 124 DCHECK(!pending_swapped_surfaces_.empty()); |
124 pending_swapped_surfaces_.pop_front(); | 125 pending_swapped_surfaces_.pop_front(); |
125 } | 126 } |
126 | 127 |
127 } // namespace content | 128 } // namespace content |
OLD | NEW |