| 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 <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 return context_->GetImplementation(); | 80 return context_->GetImplementation(); |
| 81 } | 81 } |
| 82 | 82 |
| 83 class GrContext* TestInProcessContextProvider::GrContext() { | 83 class GrContext* TestInProcessContextProvider::GrContext() { |
| 84 if (gr_context_) | 84 if (gr_context_) |
| 85 return gr_context_.get(); | 85 return gr_context_.get(); |
| 86 | 86 |
| 87 sk_sp<GrGLInterface> interface( | 87 sk_sp<GrGLInterface> interface( |
| 88 skia_bindings::CreateGLES2InterfaceBindings(ContextGL())); | 88 skia_bindings::CreateGLES2InterfaceBindings(ContextGL())); |
| 89 | 89 |
| 90 gr_context_ = skia::AdoptRef(GrContext::Create( | 90 gr_context_ = sk_sp<::GrContext>(GrContext::Create( |
| 91 // GrContext takes ownership of |interface|. | 91 // GrContext takes ownership of |interface|. |
| 92 kOpenGL_GrBackend, reinterpret_cast<GrBackendContext>(interface.get()))); | 92 kOpenGL_GrBackend, reinterpret_cast<GrBackendContext>(interface.get()))); |
| 93 return gr_context_.get(); | 93 return gr_context_.get(); |
| 94 } | 94 } |
| 95 | 95 |
| 96 void TestInProcessContextProvider::InvalidateGrContext(uint32_t state) { | 96 void TestInProcessContextProvider::InvalidateGrContext(uint32_t state) { |
| 97 if (gr_context_) | 97 if (gr_context_) |
| 98 gr_context_->resetContext(state); | 98 gr_context_->resetContext(state); |
| 99 } | 99 } |
| 100 | 100 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 126 | 126 |
| 127 void TestInProcessContextProvider::DeleteCachedResources() { | 127 void TestInProcessContextProvider::DeleteCachedResources() { |
| 128 if (gr_context_) | 128 if (gr_context_) |
| 129 gr_context_->freeGpuResources(); | 129 gr_context_->freeGpuResources(); |
| 130 } | 130 } |
| 131 | 131 |
| 132 void TestInProcessContextProvider::SetLostContextCallback( | 132 void TestInProcessContextProvider::SetLostContextCallback( |
| 133 const LostContextCallback& lost_context_callback) {} | 133 const LostContextCallback& lost_context_callback) {} |
| 134 | 134 |
| 135 } // namespace cc | 135 } // namespace cc |
| OLD | NEW |