| OLD | NEW | 
|---|
| 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 #include "ui/gl/scoped_make_current.h" | 5 #include "ui/gl/scoped_make_current.h" | 
| 6 | 6 | 
| 7 #include "base/logging.h" | 7 #include "base/logging.h" | 
| 8 #include "ui/gl/gl_context.h" | 8 #include "ui/gl/gl_context.h" | 
| 9 #include "ui/gl/gl_surface.h" | 9 #include "ui/gl/gl_surface.h" | 
| 10 | 10 | 
| (...skipping 17 matching lines...) Expand all  Loading... | 
| 28     previous_context_->MakeCurrent(previous_surface_.get()); | 28     previous_context_->MakeCurrent(previous_surface_.get()); | 
| 29   } else { | 29   } else { | 
| 30     context_->ReleaseCurrent(surface_.get()); | 30     context_->ReleaseCurrent(surface_.get()); | 
| 31   } | 31   } | 
| 32 } | 32 } | 
| 33 | 33 | 
| 34 bool ScopedMakeCurrent::Succeeded() const { | 34 bool ScopedMakeCurrent::Succeeded() const { | 
| 35   return succeeded_; | 35   return succeeded_; | 
| 36 } | 36 } | 
| 37 | 37 | 
|  | 38 ScopedReleaseCurrent::ScopedReleaseCurrent(gl::GLSurface* this_surface) { | 
|  | 39   gl::GLContext* current_context = gl::GLContext::GetCurrent(); | 
|  | 40   bool was_current = | 
|  | 41       current_context && current_context->IsCurrent(this_surface); | 
|  | 42   if (was_current) { | 
|  | 43     make_current_.emplace(current_context, this_surface); | 
|  | 44     current_context->ReleaseCurrent(this_surface); | 
|  | 45   } | 
|  | 46 } | 
|  | 47 | 
|  | 48 ScopedReleaseCurrent::~ScopedReleaseCurrent() {} | 
|  | 49 | 
| 38 }  // namespace ui | 50 }  // namespace ui | 
| OLD | NEW | 
|---|