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_context_provider.h" | 5 #include "cc/test/test_context_provider.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 return &support_; | 88 return &support_; |
89 } | 89 } |
90 | 90 |
91 class GrContext* TestContextProvider::GrContext() { | 91 class GrContext* TestContextProvider::GrContext() { |
92 DCHECK(bound_); | 92 DCHECK(bound_); |
93 DCHECK(context_thread_checker_.CalledOnValidThread()); | 93 DCHECK(context_thread_checker_.CalledOnValidThread()); |
94 | 94 |
95 if (gr_context_) | 95 if (gr_context_) |
96 return gr_context_.get(); | 96 return gr_context_.get(); |
97 | 97 |
98 auto null_interface = skia::AdoptRef(GrGLCreateNullInterface()); | 98 skia::RefPtr<const GrGLInterface> null_interface = |
| 99 skia::AdoptRef(GrGLCreateNullInterface()); |
99 gr_context_ = skia::AdoptRef(GrContext::Create( | 100 gr_context_ = skia::AdoptRef(GrContext::Create( |
100 kOpenGL_GrBackend, | 101 kOpenGL_GrBackend, |
101 reinterpret_cast<GrBackendContext>(null_interface.get()))); | 102 reinterpret_cast<GrBackendContext>(null_interface.get()))); |
102 return gr_context_.get(); | 103 return gr_context_.get(); |
103 } | 104 } |
104 | 105 |
105 bool TestContextProvider::IsContextLost() { | 106 bool TestContextProvider::IsContextLost() { |
106 DCHECK(bound_); | 107 DCHECK(bound_); |
107 DCHECK(context_thread_checker_.CalledOnValidThread()); | 108 DCHECK(context_thread_checker_.CalledOnValidThread()); |
108 | 109 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 DCHECK(memory_policy_changed_callback_.is_null() || cb.is_null()); | 173 DCHECK(memory_policy_changed_callback_.is_null() || cb.is_null()); |
173 memory_policy_changed_callback_ = cb; | 174 memory_policy_changed_callback_ = cb; |
174 } | 175 } |
175 | 176 |
176 void TestContextProvider::SetMaxTransferBufferUsageBytes( | 177 void TestContextProvider::SetMaxTransferBufferUsageBytes( |
177 size_t max_transfer_buffer_usage_bytes) { | 178 size_t max_transfer_buffer_usage_bytes) { |
178 context3d_->SetMaxTransferBufferUsageBytes(max_transfer_buffer_usage_bytes); | 179 context3d_->SetMaxTransferBufferUsageBytes(max_transfer_buffer_usage_bytes); |
179 } | 180 } |
180 | 181 |
181 } // namespace cc | 182 } // namespace cc |
OLD | NEW |