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" |
11 #include "base/callback_helpers.h" | 11 #include "base/callback_helpers.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "cc/test/test_gles2_interface.h" | 13 #include "cc/test/test_gles2_interface.h" |
14 #include "cc/test/test_web_graphics_context_3d.h" | 14 #include "cc/test/test_web_graphics_context_3d.h" |
15 | 15 |
16 namespace cc { | 16 namespace cc { |
17 | 17 |
18 // static | 18 // static |
19 scoped_refptr<TestContextProvider> TestContextProvider::Create() { | 19 scoped_refptr<TestContextProvider> TestContextProvider::Create() { |
20 return Create(TestWebGraphicsContext3D::Create().Pass()); | 20 return Create(TestWebGraphicsContext3D::Create().Pass()); |
21 } | 21 } |
22 | 22 |
23 // static | 23 // static |
24 scoped_refptr<TestContextProvider> TestContextProvider::Create( | 24 scoped_refptr<TestContextProvider> TestContextProvider::Create( |
25 scoped_ptr<TestWebGraphicsContext3D> context) { | 25 scoped_ptr<TestWebGraphicsContext3D> context) { |
26 if (!context) | 26 if (!context) |
27 return NULL; | 27 return nullptr; |
28 return new TestContextProvider(context.Pass()); | 28 return new TestContextProvider(context.Pass()); |
29 } | 29 } |
30 | 30 |
31 TestContextProvider::TestContextProvider( | 31 TestContextProvider::TestContextProvider( |
32 scoped_ptr<TestWebGraphicsContext3D> context) | 32 scoped_ptr<TestWebGraphicsContext3D> context) |
33 : context3d_(context.Pass()), | 33 : context3d_(context.Pass()), |
34 context_gl_(new TestGLES2Interface(context3d_.get())), | 34 context_gl_(new TestGLES2Interface(context3d_.get())), |
35 bound_(false), | 35 bound_(false), |
36 destroyed_(false), | 36 destroyed_(false), |
37 weak_ptr_factory_(this) { | 37 weak_ptr_factory_(this) { |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 | 84 |
85 gpu::ContextSupport* TestContextProvider::ContextSupport() { | 85 gpu::ContextSupport* TestContextProvider::ContextSupport() { |
86 return &support_; | 86 return &support_; |
87 } | 87 } |
88 | 88 |
89 class GrContext* TestContextProvider::GrContext() { | 89 class GrContext* TestContextProvider::GrContext() { |
90 DCHECK(bound_); | 90 DCHECK(bound_); |
91 DCHECK(context_thread_checker_.CalledOnValidThread()); | 91 DCHECK(context_thread_checker_.CalledOnValidThread()); |
92 | 92 |
93 // TODO(danakj): Make a test GrContext that works with a test Context3d. | 93 // TODO(danakj): Make a test GrContext that works with a test Context3d. |
94 return NULL; | 94 return nullptr; |
95 } | 95 } |
96 | 96 |
97 bool TestContextProvider::IsContextLost() { | 97 bool TestContextProvider::IsContextLost() { |
98 DCHECK(bound_); | 98 DCHECK(bound_); |
99 DCHECK(context_thread_checker_.CalledOnValidThread()); | 99 DCHECK(context_thread_checker_.CalledOnValidThread()); |
100 | 100 |
101 return context3d_->isContextLost(); | 101 return context3d_->isContextLost(); |
102 } | 102 } |
103 | 103 |
104 void TestContextProvider::VerifyContexts() { | 104 void TestContextProvider::VerifyContexts() { |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 DCHECK(memory_policy_changed_callback_.is_null() || cb.is_null()); | 164 DCHECK(memory_policy_changed_callback_.is_null() || cb.is_null()); |
165 memory_policy_changed_callback_ = cb; | 165 memory_policy_changed_callback_ = cb; |
166 } | 166 } |
167 | 167 |
168 void TestContextProvider::SetMaxTransferBufferUsageBytes( | 168 void TestContextProvider::SetMaxTransferBufferUsageBytes( |
169 size_t max_transfer_buffer_usage_bytes) { | 169 size_t max_transfer_buffer_usage_bytes) { |
170 context3d_->SetMaxTransferBufferUsageBytes(max_transfer_buffer_usage_bytes); | 170 context3d_->SetMaxTransferBufferUsageBytes(max_transfer_buffer_usage_bytes); |
171 } | 171 } |
172 | 172 |
173 } // namespace cc | 173 } // namespace cc |
OLD | NEW |