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" | 14 #include "ui/gl/scoped_api.h" |
15 | 15 |
16 namespace gpu { | 16 namespace gpu { |
17 | 17 |
18 GLContextVirtual::GLContextVirtual(gl::GLShareGroup* share_group, | 18 GLContextVirtual::GLContextVirtual(gl::GLShareGroup* share_group, |
19 gl::GLContext* shared_context, | 19 gl::GLContext* shared_context, |
20 base::WeakPtr<gles2::GLES2Decoder> decoder) | 20 base::WeakPtr<gles2::GLES2Decoder> decoder) |
21 : GLContext(share_group), | 21 : GLContext(share_group), |
22 shared_context_(shared_context), | 22 shared_context_(shared_context), |
23 decoder_(decoder) {} | 23 decoder_(decoder) {} |
24 | 24 |
25 bool GLContextVirtual::Initialize(gl::GLSurface* compatible_surface, | 25 bool GLContextVirtual::Initialize(gl::GLSurface* compatible_surface, |
26 gl::GpuPreference gpu_preference) { | 26 const gl::GLContextAttribs& attribs) { |
27 SetGLStateRestorer(new GLStateRestorerImpl(decoder_)); | 27 SetGLStateRestorer(new GLStateRestorerImpl(decoder_)); |
28 return shared_context_->MakeVirtuallyCurrent(this, compatible_surface); | 28 return shared_context_->MakeVirtuallyCurrent(this, compatible_surface); |
29 } | 29 } |
30 | 30 |
31 void GLContextVirtual::Destroy() { | 31 void GLContextVirtual::Destroy() { |
32 shared_context_->OnReleaseVirtuallyCurrent(this); | 32 shared_context_->OnReleaseVirtuallyCurrent(this); |
33 shared_context_ = NULL; | 33 shared_context_ = NULL; |
34 } | 34 } |
35 | 35 |
36 bool GLContextVirtual::MakeCurrent(gl::GLSurface* surface) { | 36 bool GLContextVirtual::MakeCurrent(gl::GLSurface* surface) { |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 | 91 |
92 gl::YUVToRGBConverter* GLContextVirtual::GetYUVToRGBConverter() { | 92 gl::YUVToRGBConverter* GLContextVirtual::GetYUVToRGBConverter() { |
93 return shared_context_->GetYUVToRGBConverter(); | 93 return shared_context_->GetYUVToRGBConverter(); |
94 } | 94 } |
95 | 95 |
96 GLContextVirtual::~GLContextVirtual() { | 96 GLContextVirtual::~GLContextVirtual() { |
97 Destroy(); | 97 Destroy(); |
98 } | 98 } |
99 | 99 |
100 } // namespace gpu | 100 } // namespace gpu |
OLD | NEW |