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

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

Issue 93433004: Use GLES2Interface for shaders and programs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix android_aosp warning Created 7 years 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_gles2_interface.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"
11 #include "base/callback_helpers.h" 11 #include "base/callback_helpers.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/strings/string_split.h" 13 #include "base/strings/string_split.h"
14 #include "cc/test/test_gles2_interface.h"
14 #include "cc/test/test_web_graphics_context_3d.h" 15 #include "cc/test/test_web_graphics_context_3d.h"
15 16
16 namespace cc { 17 namespace cc {
17 18
18 class TestContextProvider::LostContextCallbackProxy 19 class TestContextProvider::LostContextCallbackProxy
19 : public blink::WebGraphicsContext3D::WebGraphicsContextLostCallback { 20 : public blink::WebGraphicsContext3D::WebGraphicsContextLostCallback {
20 public: 21 public:
21 explicit LostContextCallbackProxy(TestContextProvider* provider) 22 explicit LostContextCallbackProxy(TestContextProvider* provider)
22 : provider_(provider) { 23 : provider_(provider) {
23 provider_->context3d_->setContextLostCallback(this); 24 provider_->context3d_->setContextLostCallback(this);
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 scoped_refptr<TestContextProvider> TestContextProvider::Create( 66 scoped_refptr<TestContextProvider> TestContextProvider::Create(
66 scoped_ptr<TestWebGraphicsContext3D> context) { 67 scoped_ptr<TestWebGraphicsContext3D> context) {
67 if (!context) 68 if (!context)
68 return NULL; 69 return NULL;
69 return new TestContextProvider(context.Pass()); 70 return new TestContextProvider(context.Pass());
70 } 71 }
71 72
72 TestContextProvider::TestContextProvider( 73 TestContextProvider::TestContextProvider(
73 scoped_ptr<TestWebGraphicsContext3D> context) 74 scoped_ptr<TestWebGraphicsContext3D> context)
74 : context3d_(context.Pass()), 75 : context3d_(context.Pass()),
76 context_gl_(new TestGLES2Interface(context3d_.get())),
75 bound_(false), 77 bound_(false),
76 destroyed_(false) { 78 destroyed_(false) {
77 DCHECK(main_thread_checker_.CalledOnValidThread()); 79 DCHECK(main_thread_checker_.CalledOnValidThread());
78 DCHECK(context3d_); 80 DCHECK(context3d_);
79 context_thread_checker_.DetachFromThread(); 81 context_thread_checker_.DetachFromThread();
80 context3d_->set_test_support(&support_); 82 context3d_->set_test_support(&support_);
81 } 83 }
82 84
83 TestContextProvider::~TestContextProvider() { 85 TestContextProvider::~TestContextProvider() {
84 DCHECK(main_thread_checker_.CalledOnValidThread() || 86 DCHECK(main_thread_checker_.CalledOnValidThread() ||
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 DCHECK(context_thread_checker_.CalledOnValidThread()); 120 DCHECK(context_thread_checker_.CalledOnValidThread());
119 121
120 return context3d_.get(); 122 return context3d_.get();
121 } 123 }
122 124
123 gpu::gles2::GLES2Interface* TestContextProvider::ContextGL() { 125 gpu::gles2::GLES2Interface* TestContextProvider::ContextGL() {
124 DCHECK(context3d_); 126 DCHECK(context3d_);
125 DCHECK(bound_); 127 DCHECK(bound_);
126 DCHECK(context_thread_checker_.CalledOnValidThread()); 128 DCHECK(context_thread_checker_.CalledOnValidThread());
127 129
128 return &context_gl_stub_; 130 return context_gl_.get();
129 } 131 }
130 132
131 gpu::ContextSupport* TestContextProvider::ContextSupport() { 133 gpu::ContextSupport* TestContextProvider::ContextSupport() {
132 DCHECK(bound_); 134 DCHECK(bound_);
133 DCHECK(context_thread_checker_.CalledOnValidThread()); 135 DCHECK(context_thread_checker_.CalledOnValidThread());
134 136
135 return &support_; 137 return &support_;
136 } 138 }
137 139
138 class GrContext* TestContextProvider::GrContext() { 140 class GrContext* TestContextProvider::GrContext() {
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 DCHECK(memory_policy_changed_callback_.is_null() || cb.is_null()); 225 DCHECK(memory_policy_changed_callback_.is_null() || cb.is_null());
224 memory_policy_changed_callback_ = cb; 226 memory_policy_changed_callback_ = cb;
225 } 227 }
226 228
227 void TestContextProvider::SetMaxTransferBufferUsageBytes( 229 void TestContextProvider::SetMaxTransferBufferUsageBytes(
228 size_t max_transfer_buffer_usage_bytes) { 230 size_t max_transfer_buffer_usage_bytes) {
229 context3d_->SetMaxTransferBufferUsageBytes(max_transfer_buffer_usage_bytes); 231 context3d_->SetMaxTransferBufferUsageBytes(max_transfer_buffer_usage_bytes);
230 } 232 }
231 233
232 } // namespace cc 234 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/test_context_provider.h ('k') | cc/test/test_gles2_interface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698