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

Side by Side Diff: ui/gfx/compositor/compositor_gl.cc

Issue 8463018: Use ScopedMakeCurrent (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address reviewer comments Created 9 years, 1 month 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/gfx/compositor/compositor_gl.h ('k') | no next file » | 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/gfx/compositor/compositor_gl.h" 5 #include "ui/gfx/compositor/compositor_gl.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 void SharedResourcesGL::Destroy() { 335 void SharedResourcesGL::Destroy() {
336 program_swizzle_.reset(); 336 program_swizzle_.reset();
337 program_no_swizzle_.reset(); 337 program_no_swizzle_.reset();
338 338
339 context_ = NULL; 339 context_ = NULL;
340 surface_ = NULL; 340 surface_ = NULL;
341 341
342 initialized_ = false; 342 initialized_ = false;
343 } 343 }
344 344
345 bool SharedResourcesGL::MakeSharedContextCurrent() { 345 gfx::ScopedMakeCurrent* SharedResourcesGL::GetScopedMakeCurrent() {
346 if (!initialized_) 346 DCHECK(initialized_);
347 return false; 347 if (initialized_)
348 return new gfx::ScopedMakeCurrent(context_.get(), surface_.get());
348 else 349 else
349 return context_->MakeCurrent(surface_.get()); 350 return NULL;
350 }
351
352 gfx::ScopedMakeCurrent* SharedResourcesGL::GetScopedMakeCurrent() {
353 return new gfx::ScopedMakeCurrent(context_.get(), surface_.get());
354 } 351 }
355 352
356 scoped_refptr<gfx::GLContext> SharedResourcesGL::CreateContext( 353 scoped_refptr<gfx::GLContext> SharedResourcesGL::CreateContext(
357 gfx::GLSurface* surface) { 354 gfx::GLSurface* surface) {
358 if (initialized_) 355 if (initialized_)
359 return gfx::GLContext::CreateGLContext( 356 return gfx::GLContext::CreateGLContext(
360 context_->share_group(), 357 context_->share_group(),
361 surface, 358 surface,
362 gfx::PreferIntegratedGpu); 359 gfx::PreferIntegratedGpu);
363 else 360 else
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
656 Compositor* Compositor::Create(CompositorDelegate* owner, 653 Compositor* Compositor::Create(CompositorDelegate* owner,
657 gfx::AcceleratedWidget widget, 654 gfx::AcceleratedWidget widget,
658 const gfx::Size& size) { 655 const gfx::Size& size) {
659 if (SharedResourcesGL::GetInstance() == NULL) 656 if (SharedResourcesGL::GetInstance() == NULL)
660 return NULL; 657 return NULL;
661 else 658 else
662 return new CompositorGL(owner, widget, size); 659 return new CompositorGL(owner, widget, size);
663 } 660 }
664 661
665 } // namespace ui 662 } // namespace ui
OLDNEW
« no previous file with comments | « ui/gfx/compositor/compositor_gl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698