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 <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <set> | 10 #include <set> |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 return &support_; | 105 return &support_; |
106 } | 106 } |
107 | 107 |
108 class GrContext* TestContextProvider::GrContext() { | 108 class GrContext* TestContextProvider::GrContext() { |
109 DCHECK(bound_); | 109 DCHECK(bound_); |
110 DCHECK(context_thread_checker_.CalledOnValidThread()); | 110 DCHECK(context_thread_checker_.CalledOnValidThread()); |
111 | 111 |
112 if (gr_context_) | 112 if (gr_context_) |
113 return gr_context_.get(); | 113 return gr_context_.get(); |
114 | 114 |
115 skia::RefPtr<const GrGLInterface> gl_interface = | 115 sk_sp<const GrGLInterface> gl_interface(GrGLCreateNullInterface()); |
116 skia::AdoptRef(GrGLCreateNullInterface()); | 116 gr_context_ = sk_sp<::GrContext>(GrContext::Create( |
117 gr_context_ = skia::AdoptRef(GrContext::Create( | |
118 kOpenGL_GrBackend, | 117 kOpenGL_GrBackend, |
119 reinterpret_cast<GrBackendContext>(gl_interface.get()))); | 118 reinterpret_cast<GrBackendContext>(gl_interface.get()))); |
120 | 119 |
121 // If GlContext is already lost, also abandon the new GrContext. | 120 // If GlContext is already lost, also abandon the new GrContext. |
122 if (ContextGL()->GetGraphicsResetStatusKHR() != GL_NO_ERROR) | 121 if (ContextGL()->GetGraphicsResetStatusKHR() != GL_NO_ERROR) |
123 gr_context_->abandonContext(); | 122 gr_context_->abandonContext(); |
124 | 123 |
125 return gr_context_.get(); | 124 return gr_context_.get(); |
126 } | 125 } |
127 | 126 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 DCHECK(lost_context_callback_.is_null() || cb.is_null()); | 167 DCHECK(lost_context_callback_.is_null() || cb.is_null()); |
169 lost_context_callback_ = cb; | 168 lost_context_callback_ = cb; |
170 } | 169 } |
171 | 170 |
172 void TestContextProvider::SetMaxTransferBufferUsageBytes( | 171 void TestContextProvider::SetMaxTransferBufferUsageBytes( |
173 size_t max_transfer_buffer_usage_bytes) { | 172 size_t max_transfer_buffer_usage_bytes) { |
174 context3d_->SetMaxTransferBufferUsageBytes(max_transfer_buffer_usage_bytes); | 173 context3d_->SetMaxTransferBufferUsageBytes(max_transfer_buffer_usage_bytes); |
175 } | 174 } |
176 | 175 |
177 } // namespace cc | 176 } // namespace cc |
OLD | NEW |