Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(47)

Side by Side Diff: ui/gl/gl_surface_ozone.cc

Issue 1084173004: Adding status to swap complete (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 SwapBuffers(); 180 SwapBuffers();
181 return true; 181 return true;
182 } 182 }
183 bool SwapBuffersAsync(const SwapCompletionCallback& callback) override { 183 bool SwapBuffersAsync(const SwapCompletionCallback& callback) override {
184 // If last swap failed, don't try to schedule new ones. 184 // If last swap failed, don't try to schedule new ones.
185 if (!last_swap_buffers_result_) 185 if (!last_swap_buffers_result_)
186 return false; 186 return false;
187 187
188 glFlush(); 188 glFlush();
189 189
190 base::Closure surface_swap_callback = 190 SwapCompletionCallback surface_swap_callback =
191 base::Bind(&GLSurfaceOzoneSurfaceless::SwapCompleted, 191 base::Bind(&GLSurfaceOzoneSurfaceless::SwapCompleted,
192 weak_factory_.GetWeakPtr(), callback); 192 weak_factory_.GetWeakPtr(), callback);
193 193
194 PendingFrame* frame = unsubmitted_frames_.back(); 194 PendingFrame* frame = unsubmitted_frames_.back();
195 frame->callback = surface_swap_callback; 195 frame->callback = surface_swap_callback;
196 unsubmitted_frames_.push_back(new PendingFrame()); 196 unsubmitted_frames_.push_back(new PendingFrame());
197 197
198 // TODO: the following should be replaced by a per surface flush as it gets 198 // TODO: the following should be replaced by a per surface flush as it gets
199 // implemented in GL drivers. 199 // implemented in GL drivers.
200 if (has_implicit_external_sync_) { 200 if (has_implicit_external_sync_) {
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 EGL_NONE}; 291 EGL_NONE};
292 return eglCreateSyncKHR(GetDisplay(), EGL_SYNC_FENCE_KHR, attrib_list); 292 return eglCreateSyncKHR(GetDisplay(), EGL_SYNC_FENCE_KHR, attrib_list);
293 } 293 }
294 294
295 void FenceRetired(EGLSyncKHR fence, PendingFrame* frame) { 295 void FenceRetired(EGLSyncKHR fence, PendingFrame* frame) {
296 eglDestroySyncKHR(GetDisplay(), fence); 296 eglDestroySyncKHR(GetDisplay(), fence);
297 frame->ready = true; 297 frame->ready = true;
298 SubmitFrame(); 298 SubmitFrame();
299 } 299 }
300 300
301 void SwapCompleted(const SwapCompletionCallback& callback) { 301 void SwapCompleted(const SwapCompletionCallback& callback,
302 callback.Run(); 302 gfx::SwapResult result) {
303 callback.Run(result);
303 swap_buffers_pending_ = false; 304 swap_buffers_pending_ = false;
304 305
305 SubmitFrame(); 306 SubmitFrame();
306 } 307 }
307 308
308 // The native surface. Deleting this is allowed to free the EGLNativeWindow. 309 // The native surface. Deleting this is allowed to free the EGLNativeWindow.
309 scoped_ptr<ui::SurfaceOzoneEGL> ozone_surface_; 310 scoped_ptr<ui::SurfaceOzoneEGL> ozone_surface_;
310 AcceleratedWidget widget_; 311 AcceleratedWidget widget_;
311 scoped_ptr<VSyncProvider> vsync_provider_; 312 scoped_ptr<VSyncProvider> vsync_provider_;
312 ScopedVector<PendingFrame> unsubmitted_frames_; 313 ScopedVector<PendingFrame> unsubmitted_frames_;
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 NOTREACHED(); 582 NOTREACHED();
582 return NULL; 583 return NULL;
583 } 584 }
584 } 585 }
585 586
586 EGLNativeDisplayType GetPlatformDefaultEGLNativeDisplay() { 587 EGLNativeDisplayType GetPlatformDefaultEGLNativeDisplay() {
587 return ui::SurfaceFactoryOzone::GetInstance()->GetNativeDisplay(); 588 return ui::SurfaceFactoryOzone::GetInstance()->GetNativeDisplay();
588 } 589 }
589 590
590 } // namespace gfx 591 } // namespace gfx
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698