| 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" |
| 11 #include "ui/gl/gl_surface.h" | 11 #include "ui/gl/gl_surface.h" |
| 12 #include "ui/gl/gpu_preference.h" | 12 #include "ui/gl/gpu_preference.h" |
| 13 #include "ui/gl/gpu_timing.h" | 13 #include "ui/gl/gpu_timing.h" |
| 14 #include "ui/gl/scoped_api.h" | |
| 15 | 14 |
| 16 namespace gpu { | 15 namespace gpu { |
| 17 | 16 |
| 18 GLContextVirtual::GLContextVirtual(gl::GLShareGroup* share_group, | 17 GLContextVirtual::GLContextVirtual(gl::GLShareGroup* share_group, |
| 19 gl::GLContext* shared_context, | 18 gl::GLContext* shared_context, |
| 20 base::WeakPtr<gles2::GLES2Decoder> decoder) | 19 base::WeakPtr<gles2::GLES2Decoder> decoder) |
| 21 : GLContext(share_group), | 20 : GLContext(share_group), |
| 22 shared_context_(shared_context), | 21 shared_context_(shared_context), |
| 23 decoder_(decoder) {} | 22 decoder_(decoder) {} |
| 24 | 23 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 } | 62 } |
| 64 | 63 |
| 65 scoped_refptr<gl::GPUTimingClient> GLContextVirtual::CreateGPUTimingClient() { | 64 scoped_refptr<gl::GPUTimingClient> GLContextVirtual::CreateGPUTimingClient() { |
| 66 return shared_context_->CreateGPUTimingClient(); | 65 return shared_context_->CreateGPUTimingClient(); |
| 67 } | 66 } |
| 68 | 67 |
| 69 void GLContextVirtual::OnSetSwapInterval(int interval) { | 68 void GLContextVirtual::OnSetSwapInterval(int interval) { |
| 70 shared_context_->SetSwapInterval(interval); | 69 shared_context_->SetSwapInterval(interval); |
| 71 } | 70 } |
| 72 | 71 |
| 72 std::string GLContextVirtual::GetGLVersion() { |
| 73 return shared_context_->GetGLVersion(); |
| 74 } |
| 75 |
| 76 std::string GLContextVirtual::GetGLRenderer() { |
| 77 return shared_context_->GetGLRenderer(); |
| 78 } |
| 79 |
| 73 std::string GLContextVirtual::GetExtensions() { | 80 std::string GLContextVirtual::GetExtensions() { |
| 74 return shared_context_->GetExtensions(); | 81 return shared_context_->GetExtensions(); |
| 75 } | 82 } |
| 76 | 83 |
| 77 void GLContextVirtual::SetSafeToForceGpuSwitch() { | 84 void GLContextVirtual::SetSafeToForceGpuSwitch() { |
| 78 // TODO(ccameron): This will not work if two contexts that disagree | 85 // TODO(ccameron): This will not work if two contexts that disagree |
| 79 // about whether or not forced gpu switching may be done both share | 86 // about whether or not forced gpu switching may be done both share |
| 80 // the same underlying shared_context_. | 87 // the same underlying shared_context_. |
| 81 return shared_context_->SetSafeToForceGpuSwitch(); | 88 return shared_context_->SetSafeToForceGpuSwitch(); |
| 82 } | 89 } |
| 83 | 90 |
| 84 bool GLContextVirtual::WasAllocatedUsingRobustnessExtension() { | 91 bool GLContextVirtual::WasAllocatedUsingRobustnessExtension() { |
| 85 return shared_context_->WasAllocatedUsingRobustnessExtension(); | 92 return shared_context_->WasAllocatedUsingRobustnessExtension(); |
| 86 } | 93 } |
| 87 | 94 |
| 88 void GLContextVirtual::SetUnbindFboOnMakeCurrent() { | 95 void GLContextVirtual::SetUnbindFboOnMakeCurrent() { |
| 89 shared_context_->SetUnbindFboOnMakeCurrent(); | 96 shared_context_->SetUnbindFboOnMakeCurrent(); |
| 90 } | 97 } |
| 91 | 98 |
| 92 gl::YUVToRGBConverter* GLContextVirtual::GetYUVToRGBConverter() { | 99 gl::YUVToRGBConverter* GLContextVirtual::GetYUVToRGBConverter() { |
| 93 return shared_context_->GetYUVToRGBConverter(); | 100 return shared_context_->GetYUVToRGBConverter(); |
| 94 } | 101 } |
| 95 | 102 |
| 96 GLContextVirtual::~GLContextVirtual() { | 103 GLContextVirtual::~GLContextVirtual() { |
| 97 Destroy(); | 104 Destroy(); |
| 98 } | 105 } |
| 99 | 106 |
| 100 } // namespace gpu | 107 } // namespace gpu |
| OLD | NEW |