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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 if (!vsync_provider_) | 114 if (!vsync_provider_) |
115 return false; | 115 return false; |
116 return true; | 116 return true; |
117 } | 117 } |
118 virtual bool Resize(const gfx::Size& size) override { | 118 virtual bool Resize(const gfx::Size& size) override { |
119 if (!ozone_surface_->ResizeNativeWindow(size)) | 119 if (!ozone_surface_->ResizeNativeWindow(size)) |
120 return false; | 120 return false; |
121 | 121 |
122 return SurfacelessEGL::Resize(size); | 122 return SurfacelessEGL::Resize(size); |
123 } | 123 } |
124 virtual bool SwapBuffers() override { | 124 virtual bool SwapBuffersAsync( |
| 125 const SwapCompletionCallback& callback) override { |
125 // TODO: this should be replaced by a fence when supported by the driver. | 126 // TODO: this should be replaced by a fence when supported by the driver. |
126 glFlush(); | 127 glFlush(); |
| 128 ozone_surface_->SetPageFlipCompletionCallback(callback); |
127 return ozone_surface_->OnSwapBuffers(); | 129 return ozone_surface_->OnSwapBuffers(); |
128 } | 130 } |
129 virtual bool ScheduleOverlayPlane(int z_order, | 131 virtual bool ScheduleOverlayPlane(int z_order, |
130 OverlayTransform transform, | 132 OverlayTransform transform, |
131 GLImage* image, | 133 GLImage* image, |
132 const Rect& bounds_rect, | 134 const Rect& bounds_rect, |
133 const RectF& crop_rect) override { | 135 const RectF& crop_rect) override { |
134 return image->ScheduleOverlayPlane( | 136 return image->ScheduleOverlayPlane( |
135 widget_, z_order, transform, bounds_rect, crop_rect); | 137 widget_, z_order, transform, bounds_rect, crop_rect); |
136 } | 138 } |
137 virtual bool IsOffscreen() override { return false; } | 139 virtual bool IsOffscreen() override { return false; } |
138 virtual VSyncProvider* GetVSyncProvider() override { | 140 virtual VSyncProvider* GetVSyncProvider() override { |
139 return vsync_provider_.get(); | 141 return vsync_provider_.get(); |
140 } | 142 } |
141 virtual bool SupportsPostSubBuffer() override { return true; } | 143 virtual bool SupportsPostSubBuffer() override { return true; } |
142 virtual bool PostSubBuffer(int x, int y, int width, int height) override { | 144 virtual bool PostSubBufferAsync( |
| 145 int x, int y, int width, int height, |
| 146 const SwapCompletionCallback& callback) override { |
143 // The actual sub buffer handling is handled at higher layers. | 147 // The actual sub buffer handling is handled at higher layers. |
144 SwapBuffers(); | 148 SwapBuffersAsync(callback); |
145 return true; | 149 return true; |
146 } | 150 } |
147 | 151 |
148 private: | 152 private: |
149 virtual ~GLSurfaceOzoneSurfaceless() { | 153 virtual ~GLSurfaceOzoneSurfaceless() { |
150 Destroy(); // EGL surface must be destroyed before SurfaceOzone | 154 Destroy(); // EGL surface must be destroyed before SurfaceOzone |
151 } | 155 } |
152 | 156 |
153 // The native surface. Deleting this is allowed to free the EGLNativeWindow. | 157 // The native surface. Deleting this is allowed to free the EGLNativeWindow. |
154 scoped_ptr<ui::SurfaceOzoneEGL> ozone_surface_; | 158 scoped_ptr<ui::SurfaceOzoneEGL> ozone_surface_; |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 NOTREACHED(); | 251 NOTREACHED(); |
248 return NULL; | 252 return NULL; |
249 } | 253 } |
250 } | 254 } |
251 | 255 |
252 EGLNativeDisplayType GetPlatformDefaultEGLNativeDisplay() { | 256 EGLNativeDisplayType GetPlatformDefaultEGLNativeDisplay() { |
253 return ui::SurfaceFactoryOzone::GetInstance()->GetNativeDisplay(); | 257 return ui::SurfaceFactoryOzone::GetInstance()->GetNativeDisplay(); |
254 } | 258 } |
255 | 259 |
256 } // namespace gfx | 260 } // namespace gfx |
OLD | NEW |