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

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

Issue 12212007: cc: Route offscreen context creation for compositor to the browser. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 #ifndef CC_TEST_LAYER_TREE_TEST_COMMON_H_ 5 #ifndef CC_TEST_LAYER_TREE_TEST_COMMON_H_
6 #define CC_TEST_LAYER_TREE_TEST_COMMON_H_ 6 #define CC_TEST_LAYER_TREE_TEST_COMMON_H_
7 7
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/memory/scoped_ptr.h"
9 #include "base/threading/thread.h" 10 #include "base/threading/thread.h"
10 #include "cc/layer_tree_host.h" 11 #include "cc/layer_tree_host.h"
11 #include "cc/layer_tree_host_impl.h" 12 #include "cc/layer_tree_host_impl.h"
13 #include "cc/test/fake_layer_tree_host_client.h"
12 #include "cc/thread.h" 14 #include "cc/thread.h"
13 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
14 #include "third_party/WebKit/Source/Platform/chromium/public/WebAnimationDelegat e.h" 16 #include "third_party/WebKit/Source/Platform/chromium/public/WebAnimationDelegat e.h"
15 17
18 namespace Webkit {
19 class WebGraphicsContext3D;
20 }
21
16 namespace cc { 22 namespace cc {
17 class LayerImpl; 23 class LayerImpl;
18 class LayerTreeHost; 24 class LayerTreeHost;
19 class LayerTreeHostClient; 25 class LayerTreeHostClient;
20 class LayerTreeHostImpl; 26 class LayerTreeHostImpl;
21 27
22 // Used by test stubs to notify the test when something interesting happens. 28 // Used by test stubs to notify the test when something interesting happens.
23 class TestHooks : public WebKit::WebAnimationDelegate { 29 class TestHooks : public WebKit::WebAnimationDelegate {
24 public: 30 public:
31 TestHooks();
32 virtual ~TestHooks();
33
25 virtual void beginCommitOnThread(LayerTreeHostImpl*) { } 34 virtual void beginCommitOnThread(LayerTreeHostImpl*) { }
26 virtual void commitCompleteOnThread(LayerTreeHostImpl*) { } 35 virtual void commitCompleteOnThread(LayerTreeHostImpl*) { }
27 virtual bool prepareToDrawOnThread( 36 virtual bool prepareToDrawOnThread(
28 LayerTreeHostImpl*, LayerTreeHostImpl::FrameData&, bool result); 37 LayerTreeHostImpl*, LayerTreeHostImpl::FrameData&, bool result);
29 virtual void drawLayersOnThread(LayerTreeHostImpl*) { } 38 virtual void drawLayersOnThread(LayerTreeHostImpl*) { }
30 virtual void animateLayers(LayerTreeHostImpl*, base::TimeTicks monotonicTime , bool hasUnfinishedAnimation) { } 39 virtual void animateLayers(LayerTreeHostImpl*, base::TimeTicks monotonicTime , bool hasUnfinishedAnimation) { }
31 virtual void willAnimateLayers(LayerTreeHostImpl*, base::TimeTicks monotonic Time) { } 40 virtual void willAnimateLayers(LayerTreeHostImpl*, base::TimeTicks monotonic Time) { }
32 virtual void applyScrollAndScale(gfx::Vector2d, float) { } 41 virtual void applyScrollAndScale(gfx::Vector2d, float) { }
33 virtual void animate(base::TimeTicks monotonicTime) { } 42 virtual void animate(base::TimeTicks monotonicTime) { }
34 virtual void layout() { } 43 virtual void layout() { }
35 virtual void didRecreateOutputSurface(bool succeeded) { } 44 virtual void didRecreateOutputSurface(bool succeeded) { }
45 virtual void willRetryRecreateOutputSurface() { }
36 virtual void didAddAnimation() { } 46 virtual void didAddAnimation() { }
37 virtual void didCommit() { } 47 virtual void didCommit() { }
38 virtual void didCommitAndDrawFrame() { } 48 virtual void didCommitAndDrawFrame() { }
39 virtual void scheduleComposite() { } 49 virtual void scheduleComposite() { }
40 virtual void didDeferCommit() { } 50 virtual void didDeferCommit() { }
41 virtual bool canActivatePendingTree(); 51 virtual bool canActivatePendingTree();
42 52
43 // Implementation of WebAnimationDelegate 53 // Implementation of WebAnimationDelegate
44 virtual void notifyAnimationStarted(double time) OVERRIDE { } 54 virtual void notifyAnimationStarted(double time) OVERRIDE { }
45 virtual void notifyAnimationFinished(double time) OVERRIDE { } 55 virtual void notifyAnimationFinished(double time) OVERRIDE { }
46 56
47 virtual scoped_ptr<OutputSurface> createOutputSurface(); 57 virtual scoped_ptr<OutputSurface> createOutputSurface();
58 virtual WebKit::WebGraphicsContext3D* createOrGetOffscreenContext3dForMainTh read();
59 virtual WebKit::WebGraphicsContext3D* createOrGetOffscreenContext3dForCompos itorThread();
60 virtual GrContext* createOrGetOffscreenGrContextForMainThread();
61 virtual GrContext* createOrGetOffscreenGrContextForCompositorThread();
62
63 private:
64 FakeLayerImplTreeHostClient m_fakeClient;
48 }; 65 };
49 66
50 class TimeoutTask; 67 class TimeoutTask;
51 class BeginTask; 68 class BeginTask;
52 69
53 class MockLayerImplTreeHostClient : public LayerTreeHostClient { 70 class MockLayerImplTreeHostClient : public LayerTreeHostClient {
54 }; 71 };
55 72
56 // The ThreadedTests runs with the main loop running. It instantiates a single M ockLayerTreeHost and associated 73 // The ThreadedTests runs with the main loop running. It instantiates a single M ockLayerTreeHost and associated
57 // MockLayerTreeHostImpl/ThreadedMockLayerTreeHostClient. 74 // MockLayerTreeHostImpl/ThreadedMockLayerTreeHostClient.
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 TEST_F(TEST_FIXTURE_NAME, runMultiThread) \ 188 TEST_F(TEST_FIXTURE_NAME, runMultiThread) \
172 { \ 189 { \
173 runTest(true); \ 190 runTest(true); \
174 } 191 }
175 192
176 #define SINGLE_AND_MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME) \ 193 #define SINGLE_AND_MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME) \
177 SINGLE_THREAD_TEST_F(TEST_FIXTURE_NAME) \ 194 SINGLE_THREAD_TEST_F(TEST_FIXTURE_NAME) \
178 MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME) 195 MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME)
179 196
180 #endif // CC_TEST_LAYER_TREE_TEST_COMMON_H_ 197 #endif // CC_TEST_LAYER_TREE_TEST_COMMON_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698