| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 if (IsCurrent(surface)) { | 44 if (IsCurrent(surface)) { |
| 45 shared_context_->OnReleaseVirtuallyCurrent(this); | 45 shared_context_->OnReleaseVirtuallyCurrent(this); |
| 46 shared_context_->ReleaseCurrent(surface); | 46 shared_context_->ReleaseCurrent(surface); |
| 47 } | 47 } |
| 48 } | 48 } |
| 49 | 49 |
| 50 bool GLContextVirtual::IsCurrent(gl::GLSurface* surface) { | 50 bool GLContextVirtual::IsCurrent(gl::GLSurface* surface) { |
| 51 // If it's a real surface it needs to be current. | 51 // If it's a real surface it needs to be current. |
| 52 if (surface && | 52 if (surface && |
| 53 !surface->IsOffscreen()) | 53 !surface->IsOffscreen()) |
| 54 return shared_context_->IsCurrent(surface) && | 54 return shared_context_->IsCurrent(surface); |
| 55 shared_context_->current_virtual_context_ == this; | |
| 56 | 55 |
| 57 // Otherwise, only insure the context itself is current. | 56 // Otherwise, only insure the context itself is current. |
| 58 return shared_context_->IsCurrent(NULL) && | 57 return shared_context_->IsCurrent(NULL); |
| 59 shared_context_->current_virtual_context_ == this; | |
| 60 } | 58 } |
| 61 | 59 |
| 62 void* GLContextVirtual::GetHandle() { | 60 void* GLContextVirtual::GetHandle() { |
| 63 return shared_context_->GetHandle(); | 61 return shared_context_->GetHandle(); |
| 64 } | 62 } |
| 65 | 63 |
| 66 scoped_refptr<gl::GPUTimingClient> GLContextVirtual::CreateGPUTimingClient() { | 64 scoped_refptr<gl::GPUTimingClient> GLContextVirtual::CreateGPUTimingClient() { |
| 67 return shared_context_->CreateGPUTimingClient(); | 65 return shared_context_->CreateGPUTimingClient(); |
| 68 } | 66 } |
| 69 | 67 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 100 | 98 |
| 101 gl::YUVToRGBConverter* GLContextVirtual::GetYUVToRGBConverter() { | 99 gl::YUVToRGBConverter* GLContextVirtual::GetYUVToRGBConverter() { |
| 102 return shared_context_->GetYUVToRGBConverter(); | 100 return shared_context_->GetYUVToRGBConverter(); |
| 103 } | 101 } |
| 104 | 102 |
| 105 GLContextVirtual::~GLContextVirtual() { | 103 GLContextVirtual::~GLContextVirtual() { |
| 106 Destroy(); | 104 Destroy(); |
| 107 } | 105 } |
| 108 | 106 |
| 109 } // namespace gpu | 107 } // namespace gpu |
| OLD | NEW |