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 "ui/gl/gl_surface.h" | 5 #include "ui/gl/gl_surface.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "ui/gfx/native_widget_types.h" | 9 #include "ui/gfx/native_widget_types.h" |
10 #include "ui/gl/gl_context.h" | 10 #include "ui/gl/gl_context.h" |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 widget_, z_order, transform, bounds_rect, crop_rect); | 135 widget_, z_order, transform, bounds_rect, crop_rect); |
136 } | 136 } |
137 bool IsOffscreen() override { return false; } | 137 bool IsOffscreen() override { return false; } |
138 VSyncProvider* GetVSyncProvider() override { return vsync_provider_.get(); } | 138 VSyncProvider* GetVSyncProvider() override { return vsync_provider_.get(); } |
139 bool SupportsPostSubBuffer() override { return true; } | 139 bool SupportsPostSubBuffer() override { return true; } |
140 bool PostSubBuffer(int x, int y, int width, int height) override { | 140 bool PostSubBuffer(int x, int y, int width, int height) override { |
141 // The actual sub buffer handling is handled at higher layers. | 141 // The actual sub buffer handling is handled at higher layers. |
142 SwapBuffers(); | 142 SwapBuffers(); |
143 return true; | 143 return true; |
144 } | 144 } |
| 145 bool SwapBuffersAsync(const SwapCompletionCallback& callback) override { |
| 146 // TODO: this should be replaced by a fence when supported by the driver. |
| 147 glFlush(); |
| 148 return ozone_surface_->OnSwapBuffersAsync(callback); |
| 149 } |
| 150 bool PostSubBufferAsync(int x, |
| 151 int y, |
| 152 int width, |
| 153 int height, |
| 154 const SwapCompletionCallback& callback) override { |
| 155 return SwapBuffersAsync(callback); |
| 156 } |
145 | 157 |
146 private: | 158 private: |
147 virtual ~GLSurfaceOzoneSurfaceless() { | 159 virtual ~GLSurfaceOzoneSurfaceless() { |
148 Destroy(); // EGL surface must be destroyed before SurfaceOzone | 160 Destroy(); // EGL surface must be destroyed before SurfaceOzone |
149 } | 161 } |
150 | 162 |
151 // The native surface. Deleting this is allowed to free the EGLNativeWindow. | 163 // The native surface. Deleting this is allowed to free the EGLNativeWindow. |
152 scoped_ptr<ui::SurfaceOzoneEGL> ozone_surface_; | 164 scoped_ptr<ui::SurfaceOzoneEGL> ozone_surface_; |
153 AcceleratedWidget widget_; | 165 AcceleratedWidget widget_; |
154 scoped_ptr<VSyncProvider> vsync_provider_; | 166 scoped_ptr<VSyncProvider> vsync_provider_; |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 NOTREACHED(); | 257 NOTREACHED(); |
246 return NULL; | 258 return NULL; |
247 } | 259 } |
248 } | 260 } |
249 | 261 |
250 EGLNativeDisplayType GetPlatformDefaultEGLNativeDisplay() { | 262 EGLNativeDisplayType GetPlatformDefaultEGLNativeDisplay() { |
251 return ui::SurfaceFactoryOzone::GetInstance()->GetNativeDisplay(); | 263 return ui::SurfaceFactoryOzone::GetInstance()->GetNativeDisplay(); |
252 } | 264 } |
253 | 265 |
254 } // namespace gfx | 266 } // namespace gfx |
OLD | NEW |