OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "cc/test/test_in_process_context_provider.h" | 5 #include "cc/test/test_in_process_context_provider.h" |
6 | 6 |
7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
8 #include "cc/resources/platform_color.h" | 8 #include "cc/resources/platform_color.h" |
9 #include "gpu/GLES2/gl2extchromium.h" | 9 #include "gpu/GLES2/gl2extchromium.h" |
10 #include "gpu/command_buffer/client/gl_in_process_context.h" | 10 #include "gpu/command_buffer/client/gl_in_process_context.h" |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 | 107 |
108 class GrContext* TestInProcessContextProvider::GrContext() { | 108 class GrContext* TestInProcessContextProvider::GrContext() { |
109 if (gr_context_) | 109 if (gr_context_) |
110 return gr_context_.get(); | 110 return gr_context_.get(); |
111 | 111 |
112 // The GrGLInterface factory will make GL calls using the C GLES2 interface. | 112 // The GrGLInterface factory will make GL calls using the C GLES2 interface. |
113 // Make sure the gles2 library is initialized first on exactly one thread. | 113 // Make sure the gles2 library is initialized first on exactly one thread. |
114 g_gles2_initializer.Get(); | 114 g_gles2_initializer.Get(); |
115 gles2::SetGLContext(ContextGL()); | 115 gles2::SetGLContext(ContextGL()); |
116 | 116 |
117 skia::RefPtr<GrGLInterface> interface = | 117 skia::RefPtr<GrGLInterface> interface = skia::AdoptRef(new GrGLInterface); |
118 skia::AdoptRef(skia_bindings::CreateCommandBufferSkiaGLBinding()); | 118 skia_bindings::InitCommandBufferSkiaGLBinding(interface.get()); |
119 interface->fCallback = BindGrContextCallback; | 119 interface->fCallback = BindGrContextCallback; |
120 interface->fCallbackData = reinterpret_cast<GrGLInterfaceCallbackData>(this); | 120 interface->fCallbackData = reinterpret_cast<GrGLInterfaceCallbackData>(this); |
121 | 121 |
122 gr_context_ = skia::AdoptRef(GrContext::Create( | 122 gr_context_ = skia::AdoptRef(GrContext::Create( |
123 kOpenGL_GrBackend, reinterpret_cast<GrBackendContext>(interface.get()))); | 123 kOpenGL_GrBackend, reinterpret_cast<GrBackendContext>(interface.get()))); |
124 | 124 |
125 return gr_context_.get(); | 125 return gr_context_.get(); |
126 } | 126 } |
127 | 127 |
128 void TestInProcessContextProvider::InvalidateGrContext(uint32_t state) { | 128 void TestInProcessContextProvider::InvalidateGrContext(uint32_t state) { |
(...skipping 29 matching lines...) Expand all Loading... |
158 | 158 |
159 void TestInProcessContextProvider::DeleteCachedResources() { | 159 void TestInProcessContextProvider::DeleteCachedResources() { |
160 if (gr_context_) | 160 if (gr_context_) |
161 gr_context_->freeGpuResources(); | 161 gr_context_->freeGpuResources(); |
162 } | 162 } |
163 | 163 |
164 void TestInProcessContextProvider::SetLostContextCallback( | 164 void TestInProcessContextProvider::SetLostContextCallback( |
165 const LostContextCallback& lost_context_callback) {} | 165 const LostContextCallback& lost_context_callback) {} |
166 | 166 |
167 } // namespace cc | 167 } // namespace cc |
OLD | NEW |