| 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 "gpu/command_buffer/service/gl_context_virtual.h" | 5 #include "gpu/command_buffer/service/gl_context_virtual.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "gpu/command_buffer/service/gl_state_restorer_impl.h" | 8 #include "gpu/command_buffer/service/gl_state_restorer_impl.h" |
| 9 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" | 9 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
| 10 #include "ui/gl/gl_gl_api_implementation.h" | 10 #include "ui/gl/gl_gl_api_implementation.h" |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 } | 99 } |
| 100 | 100 |
| 101 bool GLContextVirtual::WasAllocatedUsingRobustnessExtension() { | 101 bool GLContextVirtual::WasAllocatedUsingRobustnessExtension() { |
| 102 return shared_context_->WasAllocatedUsingRobustnessExtension(); | 102 return shared_context_->WasAllocatedUsingRobustnessExtension(); |
| 103 } | 103 } |
| 104 | 104 |
| 105 void GLContextVirtual::SetUnbindFboOnMakeCurrent() { | 105 void GLContextVirtual::SetUnbindFboOnMakeCurrent() { |
| 106 shared_context_->SetUnbindFboOnMakeCurrent(); | 106 shared_context_->SetUnbindFboOnMakeCurrent(); |
| 107 } | 107 } |
| 108 | 108 |
| 109 base::Closure GLContextVirtual::GetStateWasDirtiedExternallyCallback() { | |
| 110 return shared_context_->GetStateWasDirtiedExternallyCallback(); | |
| 111 } | |
| 112 | |
| 113 void GLContextVirtual::RestoreStateIfDirtiedExternally() { | |
| 114 // The dirty bit should only be cleared after the state has been restored, | |
| 115 // which should be done only when the context is current. | |
| 116 DCHECK(IsCurrent(NULL)); | |
| 117 if (!shared_context_->GetStateWasDirtiedExternally()) | |
| 118 return; | |
| 119 gfx::ScopedSetGLToRealGLApi scoped_set_gl_api; | |
| 120 GetGLStateRestorer()->RestoreState(NULL); | |
| 121 shared_context_->SetStateWasDirtiedExternally(false); | |
| 122 } | |
| 123 | |
| 124 GLContextVirtual::~GLContextVirtual() { | 109 GLContextVirtual::~GLContextVirtual() { |
| 125 Destroy(); | 110 Destroy(); |
| 126 } | 111 } |
| 127 | 112 |
| 128 } // namespace gpu | 113 } // namespace gpu |
| OLD | NEW |