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

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

Issue 12212007: cc: Route offscreen context creation for compositor to the browser. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove the GrContextProvider::ScopedContexts guard classes Created 7 years, 10 months 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
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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/layer_tree_test_common.h" 5 #include "cc/test/layer_tree_test_common.h"
6 6
7 #include "cc/animation.h" 7 #include "cc/animation.h"
8 #include "cc/animation_registrar.h" 8 #include "cc/animation_registrar.h"
9 #include "cc/content_layer.h" 9 #include "cc/content_layer.h"
10 #include "cc/font_atlas.h" 10 #include "cc/font_atlas.h"
(...skipping 11 matching lines...) Expand all
22 #include "cc/timing_function.h" 22 #include "cc/timing_function.h"
23 #include "testing/gmock/include/gmock/gmock.h" 23 #include "testing/gmock/include/gmock/gmock.h"
24 #include "third_party/WebKit/Source/Platform/chromium/public/WebFilterOperation. h" 24 #include "third_party/WebKit/Source/Platform/chromium/public/WebFilterOperation. h"
25 #include "third_party/WebKit/Source/Platform/chromium/public/WebFilterOperations .h" 25 #include "third_party/WebKit/Source/Platform/chromium/public/WebFilterOperations .h"
26 #include "ui/gfx/size_conversions.h" 26 #include "ui/gfx/size_conversions.h"
27 27
28 using namespace WebKit; 28 using namespace WebKit;
29 29
30 namespace cc { 30 namespace cc {
31 31
32 TestHooks::TestHooks()
33 : m_fakeClient(false, // use_software_rendering
34 false) // use_delegating_renderer
35 {
36 }
37
38 TestHooks::~TestHooks() { }
39
32 bool TestHooks::prepareToDrawOnThread(cc::LayerTreeHostImpl*, LayerTreeHostImpl: :FrameData&, bool) 40 bool TestHooks::prepareToDrawOnThread(cc::LayerTreeHostImpl*, LayerTreeHostImpl: :FrameData&, bool)
33 { 41 {
34 return true; 42 return true;
35 } 43 }
36 44
37 bool TestHooks::canActivatePendingTree() 45 bool TestHooks::canActivatePendingTree()
38 { 46 {
39 return true; 47 return true;
40 } 48 }
41 49
42 scoped_ptr<OutputSurface> TestHooks::createOutputSurface() 50 scoped_ptr<OutputSurface> TestHooks::createOutputSurface()
43 { 51 {
44 return createFakeOutputSurface(); 52 return createFakeOutputSurface();
45 } 53 }
46 54
55 WebKit::WebGraphicsContext3D* TestHooks::OffscreenContext3dForMainThread()
56 {
57 return m_fakeClient.OffscreenContext3dForMainThread();
58 }
59
60 WebKit::WebGraphicsContext3D* TestHooks::OffscreenContext3dForCompositorThread()
61 {
62 return m_fakeClient.OffscreenContext3dForCompositorThread();
63 }
64
65 GrContext* TestHooks::OffscreenGrContextForMainThread()
66 {
67 return m_fakeClient.OffscreenGrContextForMainThread();
68 }
69
70 GrContext* TestHooks::OffscreenGrContextForCompositorThread()
71 {
72 return m_fakeClient.OffscreenGrContextForCompositorThread();
73 }
74
75 void TestHooks::DestroyOffscreenContext3dForCompositorThread()
76 {
77 return m_fakeClient.DestroyOffscreenContext3dForCompositorThread();
78 }
79
47 scoped_ptr<MockLayerTreeHostImpl> MockLayerTreeHostImpl::create(TestHooks* testH ooks, const LayerTreeSettings& settings, LayerTreeHostImplClient* client, Proxy* proxy) 80 scoped_ptr<MockLayerTreeHostImpl> MockLayerTreeHostImpl::create(TestHooks* testH ooks, const LayerTreeSettings& settings, LayerTreeHostImplClient* client, Proxy* proxy)
48 { 81 {
49 return make_scoped_ptr(new MockLayerTreeHostImpl(testHooks, settings, client , proxy)); 82 return make_scoped_ptr(new MockLayerTreeHostImpl(testHooks, settings, client , proxy));
50 } 83 }
51 84
52 void MockLayerTreeHostImpl::beginCommit() 85 void MockLayerTreeHostImpl::beginCommit()
53 { 86 {
54 LayerTreeHostImpl::beginCommit(); 87 LayerTreeHostImpl::beginCommit();
55 m_testHooks->beginCommitOnThread(this); 88 m_testHooks->beginCommitOnThread(this);
56 } 89 }
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 virtual scoped_ptr<OutputSurface> createOutputSurface() OVERRIDE 225 virtual scoped_ptr<OutputSurface> createOutputSurface() OVERRIDE
193 { 226 {
194 return m_testHooks->createOutputSurface(); 227 return m_testHooks->createOutputSurface();
195 } 228 }
196 229
197 virtual void didRecreateOutputSurface(bool succeeded) OVERRIDE 230 virtual void didRecreateOutputSurface(bool succeeded) OVERRIDE
198 { 231 {
199 m_testHooks->didRecreateOutputSurface(succeeded); 232 m_testHooks->didRecreateOutputSurface(succeeded);
200 } 233 }
201 234
235 virtual void willRetryRecreateOutputSurface() OVERRIDE
236 {
237 m_testHooks->willRetryRecreateOutputSurface();
238 }
239
240 virtual WebKit::WebGraphicsContext3D* OffscreenContext3dForMainThread() OVER RIDE
241 {
242 return m_testHooks->OffscreenContext3dForMainThread();
243 }
244
245 virtual WebKit::WebGraphicsContext3D* OffscreenContext3dForCompositorThread( ) OVERRIDE
246 {
247 return m_testHooks->OffscreenContext3dForCompositorThread();
248 }
249
250 virtual GrContext* OffscreenGrContextForMainThread() OVERRIDE
251 {
252 return m_testHooks->OffscreenGrContextForMainThread();
253 }
254
255 virtual GrContext* OffscreenGrContextForCompositorThread() OVERRIDE
256 {
257 return m_testHooks->OffscreenGrContextForCompositorThread();
258 }
259
260 virtual void DestroyOffscreenContext3dForCompositorThread() OVERRIDE
261 {
262 return m_testHooks->DestroyOffscreenContext3dForCompositorThread();
263 }
264
202 virtual scoped_ptr<InputHandler> createInputHandler() OVERRIDE 265 virtual scoped_ptr<InputHandler> createInputHandler() OVERRIDE
203 { 266 {
204 return scoped_ptr<InputHandler>(); 267 return scoped_ptr<InputHandler>();
205 } 268 }
206 269
207 virtual void willCommit() OVERRIDE 270 virtual void willCommit() OVERRIDE
208 { 271 {
209 } 272 }
210 273
211 virtual void didCommit() OVERRIDE 274 virtual void didCommit() OVERRIDE
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 374
312 m_started = true; 375 m_started = true;
313 m_beginning = true; 376 m_beginning = true;
314 setupTree(); 377 setupTree();
315 m_layerTreeHost->setSurfaceReady(); 378 m_layerTreeHost->setSurfaceReady();
316 beginTest(); 379 beginTest();
317 m_beginning = false; 380 m_beginning = false;
318 if (m_endWhenBeginReturns) 381 if (m_endWhenBeginReturns)
319 realEndTest(); 382 realEndTest();
320 383
321 LayerTreeHost::setNeedsFilterContext(false);
322
323 // Allow commits to happen once beginTest() has had a chance to post tasks 384 // Allow commits to happen once beginTest() has had a chance to post tasks
324 // so that those tasks will happen before the first commit. 385 // so that those tasks will happen before the first commit.
325 if (m_layerTreeHost) 386 if (m_layerTreeHost)
326 static_cast<MockLayerTreeHost*>(m_layerTreeHost.get())->setTestStarted(t rue); 387 static_cast<MockLayerTreeHost*>(m_layerTreeHost.get())->setTestStarted(t rue);
327 } 388 }
328 389
329 void ThreadedTest::setupTree() 390 void ThreadedTest::setupTree()
330 { 391 {
331 if (!m_layerTreeHost->rootLayer()) { 392 if (!m_layerTreeHost->rootLayer()) {
332 scoped_refptr<Layer> rootLayer = Layer::create(); 393 scoped_refptr<Layer> rootLayer = Layer::create();
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 ASSERT_FALSE(m_layerTreeHost.get()); 504 ASSERT_FALSE(m_layerTreeHost.get());
444 m_client.reset(); 505 m_client.reset();
445 if (m_timedOut) { 506 if (m_timedOut) {
446 FAIL() << "Test timed out"; 507 FAIL() << "Test timed out";
447 return; 508 return;
448 } 509 }
449 afterTest(); 510 afterTest();
450 } 511 }
451 512
452 } // namespace cc 513 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698