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

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

Issue 102563005: [Ozone] Rename GetVSyncProvider to CreateVSyncProvider (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix win Created 6 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « ui/gl/gl_surface_egl.h ('k') | ui/gl/gl_surface_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // This include must be here so that the includes provided transitively 5 // This include must be here so that the includes provided transitively
6 // by gl_surface_egl.h don't make it impossible to compile this code. 6 // by gl_surface_egl.h don't make it impossible to compile this code.
7 #include "third_party/mesa/src/include/GL/osmesa.h" 7 #include "third_party/mesa/src/include/GL/osmesa.h"
8 8
9 #include "ui/gl/gl_surface_egl.h" 9 #include "ui/gl/gl_surface_egl.h"
10 10
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 surface_(NULL), 243 surface_(NULL),
244 supports_post_sub_buffer_(false), 244 supports_post_sub_buffer_(false),
245 config_(NULL) { 245 config_(NULL) {
246 #if defined(OS_ANDROID) 246 #if defined(OS_ANDROID)
247 if (window) 247 if (window)
248 ANativeWindow_acquire(window); 248 ANativeWindow_acquire(window);
249 #endif 249 #endif
250 } 250 }
251 251
252 bool NativeViewGLSurfaceEGL::Initialize() { 252 bool NativeViewGLSurfaceEGL::Initialize() {
253 return Initialize(NULL); 253 return Initialize(scoped_ptr<VSyncProvider>());
254 } 254 }
255 255
256 bool NativeViewGLSurfaceEGL::Initialize(VSyncProvider* sync_provider) { 256 bool NativeViewGLSurfaceEGL::Initialize(
257 scoped_ptr<VSyncProvider> sync_provider) {
257 DCHECK(!surface_); 258 DCHECK(!surface_);
258 scoped_ptr<VSyncProvider> vsync_provider(sync_provider);
259 259
260 if (window_ == kNullAcceleratedWidget) { 260 if (window_ == kNullAcceleratedWidget) {
261 LOG(ERROR) << "Trying to create surface without window."; 261 LOG(ERROR) << "Trying to create surface without window.";
262 return false; 262 return false;
263 } 263 }
264 264
265 if (!GetDisplay()) { 265 if (!GetDisplay()) {
266 LOG(ERROR) << "Trying to create surface with invalid display."; 266 LOG(ERROR) << "Trying to create surface with invalid display.";
267 return false; 267 return false;
268 } 268 }
(...skipping 20 matching lines...) Expand all
289 } 289 }
290 290
291 EGLint surfaceVal; 291 EGLint surfaceVal;
292 EGLBoolean retVal = eglQuerySurface(GetDisplay(), 292 EGLBoolean retVal = eglQuerySurface(GetDisplay(),
293 surface_, 293 surface_,
294 EGL_POST_SUB_BUFFER_SUPPORTED_NV, 294 EGL_POST_SUB_BUFFER_SUPPORTED_NV,
295 &surfaceVal); 295 &surfaceVal);
296 supports_post_sub_buffer_ = (surfaceVal && retVal) == EGL_TRUE; 296 supports_post_sub_buffer_ = (surfaceVal && retVal) == EGL_TRUE;
297 297
298 if (sync_provider) 298 if (sync_provider)
299 vsync_provider_.swap(vsync_provider); 299 vsync_provider_.reset(sync_provider.release());
300 else if (g_egl_sync_control_supported) 300 else if (g_egl_sync_control_supported)
301 vsync_provider_.reset(new EGLSyncControlVSyncProvider(surface_)); 301 vsync_provider_.reset(new EGLSyncControlVSyncProvider(surface_));
302 return true; 302 return true;
303 } 303 }
304 304
305 void NativeViewGLSurfaceEGL::Destroy() { 305 void NativeViewGLSurfaceEGL::Destroy() {
306 if (surface_) { 306 if (surface_) {
307 if (!eglDestroySurface(GetDisplay(), surface_)) { 307 if (!eglDestroySurface(GetDisplay(), surface_)) {
308 LOG(ERROR) << "eglDestroySurface failed with error " 308 LOG(ERROR) << "eglDestroySurface failed with error "
309 << GetLastEGLErrorString(); 309 << GetLastEGLErrorString();
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
711 711
712 if (GetGLImplementation() == kGLImplementationOSMesaGL) { 712 if (GetGLImplementation() == kGLImplementationOSMesaGL) {
713 scoped_refptr<GLSurface> surface(new GLSurfaceOSMesaHeadless(window)); 713 scoped_refptr<GLSurface> surface(new GLSurfaceOSMesaHeadless(window));
714 if (!surface->Initialize()) 714 if (!surface->Initialize())
715 return NULL; 715 return NULL;
716 return surface; 716 return surface;
717 } 717 }
718 DCHECK(GetGLImplementation() == kGLImplementationEGLGLES2); 718 DCHECK(GetGLImplementation() == kGLImplementationEGLGLES2);
719 if (window) { 719 if (window) {
720 scoped_refptr<NativeViewGLSurfaceEGL> surface; 720 scoped_refptr<NativeViewGLSurfaceEGL> surface;
721 VSyncProvider* sync_provider = NULL; 721 scoped_ptr<VSyncProvider> sync_provider;
722 #if defined(USE_OZONE) 722 #if defined(USE_OZONE)
723 window = gfx::SurfaceFactoryOzone::GetInstance()->RealizeAcceleratedWidget( 723 window = gfx::SurfaceFactoryOzone::GetInstance()->RealizeAcceleratedWidget(
724 window); 724 window);
725 sync_provider = 725 sync_provider =
726 gfx::SurfaceFactoryOzone::GetInstance()->GetVSyncProvider(window); 726 gfx::SurfaceFactoryOzone::GetInstance()->CreateVSyncProvider(window);
727 #endif 727 #endif
728 surface = new NativeViewGLSurfaceEGL(window); 728 surface = new NativeViewGLSurfaceEGL(window);
729 if(surface->Initialize(sync_provider)) 729 if(surface->Initialize(sync_provider.Pass()))
730 return surface; 730 return surface;
731 } else { 731 } else {
732 scoped_refptr<GLSurface> surface = new GLSurfaceStub(); 732 scoped_refptr<GLSurface> surface = new GLSurfaceStub();
733 if (surface->Initialize()) 733 if (surface->Initialize())
734 return surface; 734 return surface;
735 } 735 }
736 return NULL; 736 return NULL;
737 } 737 }
738 738
739 // static 739 // static
(...skipping 21 matching lines...) Expand all
761 } 761 }
762 default: 762 default:
763 NOTREACHED(); 763 NOTREACHED();
764 return NULL; 764 return NULL;
765 } 765 }
766 } 766 }
767 767
768 #endif 768 #endif
769 769
770 } // namespace gfx 770 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gl/gl_surface_egl.h ('k') | ui/gl/gl_surface_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698