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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 : support_(std::move(support)), | 77 : support_(std::move(support)), |
78 context3d_(std::move(context)), | 78 context3d_(std::move(context)), |
79 context_gl_(std::move(gl)), | 79 context_gl_(std::move(gl)), |
80 weak_ptr_factory_(this) { | 80 weak_ptr_factory_(this) { |
81 DCHECK(main_thread_checker_.CalledOnValidThread()); | 81 DCHECK(main_thread_checker_.CalledOnValidThread()); |
82 DCHECK(context3d_); | 82 DCHECK(context3d_); |
83 DCHECK(context_gl_); | 83 DCHECK(context_gl_); |
84 context_thread_checker_.DetachFromThread(); | 84 context_thread_checker_.DetachFromThread(); |
85 context_gl_->set_test_context(context3d_.get()); | 85 context_gl_->set_test_context(context3d_.get()); |
86 context3d_->set_test_support(support_.get()); | 86 context3d_->set_test_support(support_.get()); |
87 cache_controller_.reset(new ContextCacheController(support_.get())); | 87 // Just pass nullptr to the ContextCacheController for its task runner. Idle |
| 88 // handling is tested directly in ContextCacheController's unittests, and |
| 89 // isn't needed here. |
| 90 cache_controller_.reset(new ContextCacheController(support_.get(), nullptr)); |
88 } | 91 } |
89 | 92 |
90 TestContextProvider::~TestContextProvider() { | 93 TestContextProvider::~TestContextProvider() { |
91 DCHECK(main_thread_checker_.CalledOnValidThread() || | 94 DCHECK(main_thread_checker_.CalledOnValidThread() || |
92 context_thread_checker_.CalledOnValidThread()); | 95 context_thread_checker_.CalledOnValidThread()); |
93 } | 96 } |
94 | 97 |
95 bool TestContextProvider::BindToCurrentThread() { | 98 bool TestContextProvider::BindToCurrentThread() { |
96 // This is called on the thread the context will be used. | 99 // This is called on the thread the context will be used. |
97 DCHECK(context_thread_checker_.CalledOnValidThread()); | 100 DCHECK(context_thread_checker_.CalledOnValidThread()); |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 } | 194 } |
192 | 195 |
193 void TestContextProvider::SetLostContextCallback( | 196 void TestContextProvider::SetLostContextCallback( |
194 const LostContextCallback& cb) { | 197 const LostContextCallback& cb) { |
195 DCHECK(context_thread_checker_.CalledOnValidThread()); | 198 DCHECK(context_thread_checker_.CalledOnValidThread()); |
196 DCHECK(lost_context_callback_.is_null() || cb.is_null()); | 199 DCHECK(lost_context_callback_.is_null() || cb.is_null()); |
197 lost_context_callback_ = cb; | 200 lost_context_callback_ = cb; |
198 } | 201 } |
199 | 202 |
200 } // namespace cc | 203 } // namespace cc |
OLD | NEW |