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

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: Restart with GrContext owned in cc 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/threading/thread.h" 9 #include "base/threading/thread.h"
10 #include "cc/layer_tree_host.h" 10 #include "cc/layer_tree_host.h"
11 #include "cc/layer_tree_host_impl.h" 11 #include "cc/layer_tree_host_impl.h"
12 #include "cc/thread.h" 12 #include "cc/thread.h"
13 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
14 #include "third_party/WebKit/Source/Platform/chromium/public/WebAnimationDelegat e.h" 14 #include "third_party/WebKit/Source/Platform/chromium/public/WebAnimationDelegat e.h"
15 15
16 namespace Webkit { class WebGraphicsContext3D; }
17
16 namespace cc { 18 namespace cc {
17 class LayerImpl; 19 class LayerImpl;
18 class LayerTreeHost; 20 class LayerTreeHost;
19 class LayerTreeHostClient; 21 class LayerTreeHostClient;
20 class LayerTreeHostImpl; 22 class LayerTreeHostImpl;
21 23
22 // Used by test stubs to notify the test when something interesting happens. 24 // Used by test stubs to notify the test when something interesting happens.
23 class TestHooks : public WebKit::WebAnimationDelegate { 25 class TestHooks : public WebKit::WebAnimationDelegate {
24 public: 26 public:
27 TestHooks();
28 virtual ~TestHooks();
29
25 virtual void beginCommitOnThread(LayerTreeHostImpl*) { } 30 virtual void beginCommitOnThread(LayerTreeHostImpl*) { }
26 virtual void commitCompleteOnThread(LayerTreeHostImpl*) { } 31 virtual void commitCompleteOnThread(LayerTreeHostImpl*) { }
27 virtual bool prepareToDrawOnThread( 32 virtual bool prepareToDrawOnThread(
28 LayerTreeHostImpl*, LayerTreeHostImpl::FrameData&, bool result); 33 LayerTreeHostImpl*, LayerTreeHostImpl::FrameData&, bool result);
29 virtual void drawLayersOnThread(LayerTreeHostImpl*) { } 34 virtual void drawLayersOnThread(LayerTreeHostImpl*) { }
30 virtual void animateLayers(LayerTreeHostImpl*, base::TimeTicks monotonicTime ) { } 35 virtual void animateLayers(LayerTreeHostImpl*, base::TimeTicks monotonicTime ) { }
31 virtual void updateAnimationState(LayerTreeHostImpl*, bool hasUnfinishedAnim ation) { } 36 virtual void updateAnimationState(LayerTreeHostImpl*, bool hasUnfinishedAnim ation) { }
32 virtual void willAnimateLayers(LayerTreeHostImpl*, base::TimeTicks monotonic Time) { } 37 virtual void willAnimateLayers(LayerTreeHostImpl*, base::TimeTicks monotonic Time) { }
33 virtual void applyScrollAndScale(gfx::Vector2d, float) { } 38 virtual void applyScrollAndScale(gfx::Vector2d, float) { }
34 virtual void animate(base::TimeTicks monotonicTime) { } 39 virtual void animate(base::TimeTicks monotonicTime) { }
35 virtual void layout() { } 40 virtual void layout() { }
36 virtual void didRecreateOutputSurface(bool succeeded) { } 41 virtual void didRecreateOutputSurface(bool succeeded) { }
42 virtual void willRetryRecreateOutputSurface() { }
37 virtual void didAddAnimation() { } 43 virtual void didAddAnimation() { }
38 virtual void didCommit() { } 44 virtual void didCommit() { }
39 virtual void didCommitAndDrawFrame() { } 45 virtual void didCommitAndDrawFrame() { }
40 virtual void scheduleComposite() { } 46 virtual void scheduleComposite() { }
41 virtual void didDeferCommit() { } 47 virtual void didDeferCommit() { }
42 virtual bool canActivatePendingTree(); 48 virtual bool canActivatePendingTree();
43 49
44 // Implementation of WebAnimationDelegate 50 // Implementation of WebAnimationDelegate
45 virtual void notifyAnimationStarted(double time) OVERRIDE { } 51 virtual void notifyAnimationStarted(double time) OVERRIDE { }
46 virtual void notifyAnimationFinished(double time) OVERRIDE { } 52 virtual void notifyAnimationFinished(double time) OVERRIDE { }
47 53
48 virtual scoped_ptr<OutputSurface> createOutputSurface(); 54 virtual scoped_ptr<OutputSurface> createOutputSurface();
55 virtual WebKit::WebGraphicsContext3D* OffscreenContext3dForMainThread();
56 virtual WebKit::WebGraphicsContext3D* OffscreenContext3dForCompositorThread( );
57 private:
58 scoped_ptr<WebKit::WebGraphicsContext3D> m_offscreenContext3d;
49 }; 59 };
50 60
51 class TimeoutTask; 61 class TimeoutTask;
52 class BeginTask; 62 class BeginTask;
53 63
54 class MockLayerImplTreeHostClient : public LayerTreeHostClient { 64 class MockLayerImplTreeHostClient : public LayerTreeHostClient {
55 }; 65 };
56 66
57 // The ThreadedTests runs with the main loop running. It instantiates a single M ockLayerTreeHost and associated 67 // The ThreadedTests runs with the main loop running. It instantiates a single M ockLayerTreeHost and associated
58 // MockLayerTreeHostImpl/ThreadedMockLayerTreeHostClient. 68 // MockLayerTreeHostImpl/ThreadedMockLayerTreeHostClient.
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 TEST_F(TEST_FIXTURE_NAME, runMultiThread) \ 183 TEST_F(TEST_FIXTURE_NAME, runMultiThread) \
174 { \ 184 { \
175 runTest(true); \ 185 runTest(true); \
176 } 186 }
177 187
178 #define SINGLE_AND_MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME) \ 188 #define SINGLE_AND_MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME) \
179 SINGLE_THREAD_TEST_F(TEST_FIXTURE_NAME) \ 189 SINGLE_THREAD_TEST_F(TEST_FIXTURE_NAME) \
180 MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME) 190 MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME)
181 191
182 #endif // CC_TEST_LAYER_TREE_TEST_COMMON_H_ 192 #endif // CC_TEST_LAYER_TREE_TEST_COMMON_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698