Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(436)

Side by Side Diff: cc/test/test_context_provider.cc

Issue 51653008: Remove WGC3D::isContextLost references from cc (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix android build Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « cc/test/test_context_provider.h ('k') | cc/test/test_web_graphics_context_3d.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 // static 64 // static
65 scoped_refptr<TestContextProvider> TestContextProvider::Create( 65 scoped_refptr<TestContextProvider> TestContextProvider::Create(
66 scoped_ptr<TestWebGraphicsContext3D> context) { 66 scoped_ptr<TestWebGraphicsContext3D> context) {
67 if (!context) 67 if (!context)
68 return NULL; 68 return NULL;
69 return new TestContextProvider(context.Pass()); 69 return new TestContextProvider(context.Pass());
70 } 70 }
71 71
72 TestContextProvider::TestContextProvider( 72 TestContextProvider::TestContextProvider(
73 scoped_ptr<TestWebGraphicsContext3D> context) 73 scoped_ptr<TestWebGraphicsContext3D> context)
74 : context3d_(context.Pass()), bound_(false), destroyed_(false) { 74 : context3d_(context.Pass()),
75 bound_(false),
76 destroyed_(false) {
75 DCHECK(main_thread_checker_.CalledOnValidThread()); 77 DCHECK(main_thread_checker_.CalledOnValidThread());
76 DCHECK(context3d_); 78 DCHECK(context3d_);
77 context_thread_checker_.DetachFromThread(); 79 context_thread_checker_.DetachFromThread();
78 context3d_->set_test_support(&support_); 80 context3d_->set_test_support(&support_);
79 } 81 }
80 82
81 TestContextProvider::~TestContextProvider() { 83 TestContextProvider::~TestContextProvider() {
82 DCHECK(main_thread_checker_.CalledOnValidThread() || 84 DCHECK(main_thread_checker_.CalledOnValidThread() ||
83 context_thread_checker_.CalledOnValidThread()); 85 context_thread_checker_.CalledOnValidThread());
84 } 86 }
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 134
133 class GrContext* TestContextProvider::GrContext() { 135 class GrContext* TestContextProvider::GrContext() {
134 DCHECK(context3d_); 136 DCHECK(context3d_);
135 DCHECK(bound_); 137 DCHECK(bound_);
136 DCHECK(context_thread_checker_.CalledOnValidThread()); 138 DCHECK(context_thread_checker_.CalledOnValidThread());
137 139
138 // TODO(danakj): Make a test GrContext that works with a test Context3d. 140 // TODO(danakj): Make a test GrContext that works with a test Context3d.
139 return NULL; 141 return NULL;
140 } 142 }
141 143
144 bool TestContextProvider::IsContextLost() {
145 DCHECK(context3d_);
146 DCHECK(bound_);
147 DCHECK(context_thread_checker_.CalledOnValidThread());
148
149 return context3d_->isContextLost();
150 }
151
142 void TestContextProvider::VerifyContexts() { 152 void TestContextProvider::VerifyContexts() {
143 DCHECK(context3d_); 153 DCHECK(context3d_);
144 DCHECK(bound_); 154 DCHECK(bound_);
145 DCHECK(context_thread_checker_.CalledOnValidThread()); 155 DCHECK(context_thread_checker_.CalledOnValidThread());
146 156
147 if (context3d_->isContextLost()) { 157 if (context3d_->isContextLost()) {
148 base::AutoLock lock(destroyed_lock_); 158 base::AutoLock lock(destroyed_lock_);
149 destroyed_ = true; 159 destroyed_ = true;
150 } 160 }
151 } 161 }
(...skipping 26 matching lines...) Expand all
178 TestWebGraphicsContext3D* TestContextProvider::TestContext3d() { 188 TestWebGraphicsContext3D* TestContextProvider::TestContext3d() {
179 DCHECK(context3d_); 189 DCHECK(context3d_);
180 DCHECK(bound_); 190 DCHECK(bound_);
181 DCHECK(context_thread_checker_.CalledOnValidThread()); 191 DCHECK(context_thread_checker_.CalledOnValidThread());
182 192
183 return context3d_.get(); 193 return context3d_.get();
184 } 194 }
185 195
186 TestWebGraphicsContext3D* TestContextProvider::UnboundTestContext3d() { 196 TestWebGraphicsContext3D* TestContextProvider::UnboundTestContext3d() {
187 DCHECK(context3d_); 197 DCHECK(context3d_);
188 DCHECK(context_thread_checker_.CalledOnValidThread());
189 198
190 return context3d_.get(); 199 return context3d_.get();
191 } 200 }
192 201
193 void TestContextProvider::SetMemoryAllocation( 202 void TestContextProvider::SetMemoryAllocation(
194 const ManagedMemoryPolicy& policy) { 203 const ManagedMemoryPolicy& policy) {
195 if (memory_policy_changed_callback_.is_null()) 204 if (memory_policy_changed_callback_.is_null())
196 return; 205 return;
197 memory_policy_changed_callback_.Run(policy); 206 memory_policy_changed_callback_.Run(policy);
198 } 207 }
(...skipping 18 matching lines...) Expand all
217 DCHECK(memory_policy_changed_callback_.is_null() || cb.is_null()); 226 DCHECK(memory_policy_changed_callback_.is_null() || cb.is_null());
218 memory_policy_changed_callback_ = cb; 227 memory_policy_changed_callback_ = cb;
219 } 228 }
220 229
221 void TestContextProvider::SetMaxTransferBufferUsageBytes( 230 void TestContextProvider::SetMaxTransferBufferUsageBytes(
222 size_t max_transfer_buffer_usage_bytes) { 231 size_t max_transfer_buffer_usage_bytes) {
223 context3d_->SetMaxTransferBufferUsageBytes(max_transfer_buffer_usage_bytes); 232 context3d_->SetMaxTransferBufferUsageBytes(max_transfer_buffer_usage_bytes);
224 } 233 }
225 234
226 } // namespace cc 235 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/test_context_provider.h ('k') | cc/test/test_web_graphics_context_3d.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698