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

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

Issue 2193293004: cc: Make LayerTreeTests use a DelegatingRenderer and Display. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: display-layertreetest: withperftestsfix Created 4 years, 4 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
« no previous file with comments | « cc/test/test_delegating_output_surface.cc ('k') | cc/test/test_web_graphics_context_3d.cc » ('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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_TEST_HOOKS_H_ 5 #ifndef CC_TEST_TEST_HOOKS_H_
6 #define CC_TEST_TEST_HOOKS_H_ 6 #define CC_TEST_TEST_HOOKS_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "cc/animation/animation_delegate.h" 9 #include "cc/animation/animation_delegate.h"
10 #include "cc/trees/layer_tree_host.h" 10 #include "cc/trees/layer_tree_host.h"
11 #include "cc/trees/layer_tree_host_impl.h" 11 #include "cc/trees/layer_tree_host_impl.h"
12 12
13 namespace cc { 13 namespace cc {
14 14
15 namespace proto { 15 namespace proto {
16 class CompositorMessageToImpl; 16 class CompositorMessageToImpl;
17 } 17 }
18 18
19 // Used by test stubs to notify the test when something interesting happens. 19 // Used by test stubs to notify the test when something interesting happens.
20 class TestHooks : public AnimationDelegate { 20 class TestHooks : public AnimationDelegate {
21 public: 21 public:
22 TestHooks(); 22 TestHooks();
23 ~TestHooks() override; 23 ~TestHooks() override;
24 24
25 // Compositor thread hooks.
25 virtual void CreateResourceAndRasterBufferProvider( 26 virtual void CreateResourceAndRasterBufferProvider(
26 LayerTreeHostImpl* host_impl, 27 LayerTreeHostImpl* host_impl,
27 std::unique_ptr<RasterBufferProvider>* raster_buffer_provider, 28 std::unique_ptr<RasterBufferProvider>* raster_buffer_provider,
28 std::unique_ptr<ResourcePool>* resource_pool); 29 std::unique_ptr<ResourcePool>* resource_pool);
29 virtual void WillBeginImplFrameOnThread(LayerTreeHostImpl* host_impl, 30 virtual void WillBeginImplFrameOnThread(LayerTreeHostImpl* host_impl,
30 const BeginFrameArgs& args) {} 31 const BeginFrameArgs& args) {}
31 virtual void DidFinishImplFrameOnThread(LayerTreeHostImpl* host_impl) {} 32 virtual void DidFinishImplFrameOnThread(LayerTreeHostImpl* host_impl) {}
32 virtual void BeginMainFrameAbortedOnThread(LayerTreeHostImpl* host_impl, 33 virtual void BeginMainFrameAbortedOnThread(LayerTreeHostImpl* host_impl,
33 CommitEarlyOutReason reason) {} 34 CommitEarlyOutReason reason) {}
34 virtual void ReadyToCommitOnThread(LayerTreeHostImpl* host_impl) {} 35 virtual void ReadyToCommitOnThread(LayerTreeHostImpl* host_impl) {}
35 virtual void WillPrepareTilesOnThread(LayerTreeHostImpl* host_impl) {} 36 virtual void WillPrepareTilesOnThread(LayerTreeHostImpl* host_impl) {}
36 virtual void BeginCommitOnThread(LayerTreeHostImpl* host_impl) {} 37 virtual void BeginCommitOnThread(LayerTreeHostImpl* host_impl) {}
37 virtual void WillCommitCompleteOnThread(LayerTreeHostImpl* host_impl) {} 38 virtual void WillCommitCompleteOnThread(LayerTreeHostImpl* host_impl) {}
38 virtual void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) {} 39 virtual void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) {}
39 virtual void WillActivateTreeOnThread(LayerTreeHostImpl* host_impl) {} 40 virtual void WillActivateTreeOnThread(LayerTreeHostImpl* host_impl) {}
40 virtual void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) {} 41 virtual void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) {}
41 virtual void InitializedRendererOnThread(LayerTreeHostImpl* host_impl, 42 virtual void InitializedRendererOnThread(LayerTreeHostImpl* host_impl,
42 bool success) {} 43 bool success) {}
43 virtual DrawResult PrepareToDrawOnThread( 44 virtual DrawResult PrepareToDrawOnThread(
44 LayerTreeHostImpl* host_impl, 45 LayerTreeHostImpl* host_impl,
45 LayerTreeHostImpl::FrameData* frame_data, 46 LayerTreeHostImpl::FrameData* frame_data,
46 DrawResult draw_result); 47 DrawResult draw_result);
47 virtual void DrawLayersOnThread(LayerTreeHostImpl* host_impl) {} 48 virtual void DrawLayersOnThread(LayerTreeHostImpl* host_impl) {}
48 // Note that this is called asynchronously from the LayerTreeHostImpl
49 // performing its draw, so you should record state you want to use here
50 // in DrawLayersOnThread() instead. For that reason this method does not
51 // receive a LayerTreeHostImpl pointer.
52 virtual void SwapBuffersCompleteOnThread() {}
53 virtual void NotifyReadyToActivateOnThread(LayerTreeHostImpl* host_impl) {} 49 virtual void NotifyReadyToActivateOnThread(LayerTreeHostImpl* host_impl) {}
54 virtual void NotifyReadyToDrawOnThread(LayerTreeHostImpl* host_impl) {} 50 virtual void NotifyReadyToDrawOnThread(LayerTreeHostImpl* host_impl) {}
55 virtual void NotifyAllTileTasksCompleted(LayerTreeHostImpl* host_impl) {} 51 virtual void NotifyAllTileTasksCompleted(LayerTreeHostImpl* host_impl) {}
56 virtual void NotifyTileStateChangedOnThread(LayerTreeHostImpl* host_impl, 52 virtual void NotifyTileStateChangedOnThread(LayerTreeHostImpl* host_impl,
57 const Tile* tile) {} 53 const Tile* tile) {}
54 virtual void DidSetVisibleOnImplTree(LayerTreeHostImpl* host_impl,
55 bool visible) {}
58 virtual void AnimateLayers(LayerTreeHostImpl* host_impl, 56 virtual void AnimateLayers(LayerTreeHostImpl* host_impl,
59 base::TimeTicks monotonic_time) {} 57 base::TimeTicks monotonic_time) {}
60 virtual void UpdateAnimationState(LayerTreeHostImpl* host_impl, 58 virtual void UpdateAnimationState(LayerTreeHostImpl* host_impl,
61 bool has_unfinished_animation) {} 59 bool has_unfinished_animation) {}
62 virtual void WillAnimateLayers(LayerTreeHostImpl* host_impl, 60 virtual void WillAnimateLayers(LayerTreeHostImpl* host_impl,
63 base::TimeTicks monotonic_time) {} 61 base::TimeTicks monotonic_time) {}
62
63 // Asynchronous compositor thread hooks.
64 // These are called asynchronously from the LayerTreeHostImpl performing its
65 // draw, so you should record state you want to use here in
66 // DrawLayersOnThread() instead. For that reason these methods do not receive
67 // a LayerTreeHostImpl pointer.
68 virtual void DisplayReceivedCompositorFrameOnThread(
69 const CompositorFrame& frame) {}
70 virtual void DisplayWillDrawAndSwapOnThread(
71 bool will_draw_and_swap,
72 const RenderPassList& render_passes) {}
73 virtual void DisplayDidDrawAndSwapOnThread() {}
74
75 // Main thread hooks.
64 virtual void ApplyViewportDeltas( 76 virtual void ApplyViewportDeltas(
65 const gfx::Vector2dF& inner_delta, 77 const gfx::Vector2dF& inner_delta,
66 const gfx::Vector2dF& outer_delta, 78 const gfx::Vector2dF& outer_delta,
67 const gfx::Vector2dF& elastic_overscroll_delta, 79 const gfx::Vector2dF& elastic_overscroll_delta,
68 float scale, 80 float scale,
69 float top_controls_delta) {} 81 float top_controls_delta) {}
70 virtual void BeginMainFrameNotExpectedSoon() {} 82 virtual void BeginMainFrameNotExpectedSoon() {}
71 virtual void BeginMainFrame(const BeginFrameArgs& args) {} 83 virtual void BeginMainFrame(const BeginFrameArgs& args) {}
72 virtual void WillBeginMainFrame() {} 84 virtual void WillBeginMainFrame() {}
73 virtual void DidBeginMainFrame() {} 85 virtual void DidBeginMainFrame() {}
74 virtual void UpdateLayerTreeHost() {} 86 virtual void UpdateLayerTreeHost() {}
75 virtual void DidInitializeOutputSurface() {} 87 virtual void DidInitializeOutputSurface() {}
76 virtual void DidFailToInitializeOutputSurface() {} 88 virtual void DidFailToInitializeOutputSurface() {}
77 virtual void DidAddAnimation() {} 89 virtual void DidAddAnimation() {}
78 virtual void WillCommit() {} 90 virtual void WillCommit() {}
79 virtual void DidCommit() {} 91 virtual void DidCommit() {}
80 virtual void DidCommitAndDrawFrame() {} 92 virtual void DidCommitAndDrawFrame() {}
81 virtual void DidCompleteSwapBuffers() {} 93 virtual void DidCompleteSwapBuffers() {}
82 virtual void DidSetVisibleOnImplTree(LayerTreeHostImpl* host_impl,
83 bool visible) {}
84 virtual void ScheduleComposite() {} 94 virtual void ScheduleComposite() {}
85 virtual void DidActivateSyncTree() {} 95 virtual void DidActivateSyncTree() {}
86 96
87 // AnimationDelegate implementation. 97 // AnimationDelegate implementation.
88 void NotifyAnimationStarted(base::TimeTicks monotonic_time, 98 void NotifyAnimationStarted(base::TimeTicks monotonic_time,
89 TargetProperty::Type target_property, 99 TargetProperty::Type target_property,
90 int group) override {} 100 int group) override {}
91 void NotifyAnimationFinished(base::TimeTicks monotonic_time, 101 void NotifyAnimationFinished(base::TimeTicks monotonic_time,
92 TargetProperty::Type target_property, 102 TargetProperty::Type target_property,
93 int group) override {} 103 int group) override {}
(...skipping 14 matching lines...) Expand all
108 const proto::CompositorMessageToImpl& proto) {} 118 const proto::CompositorMessageToImpl& proto) {}
109 119
110 // Used to notify the test to destroy the Remote client LayerTreeHost on 120 // Used to notify the test to destroy the Remote client LayerTreeHost on
111 // receiving a CompositorMessageToImpl of type CLOSE_IMPL. 121 // receiving a CompositorMessageToImpl of type CLOSE_IMPL.
112 virtual void DestroyRemoteClientHost() {} 122 virtual void DestroyRemoteClientHost() {}
113 }; 123 };
114 124
115 } // namespace cc 125 } // namespace cc
116 126
117 #endif // CC_TEST_TEST_HOOKS_H_ 127 #endif // CC_TEST_TEST_HOOKS_H_
OLDNEW
« no previous file with comments | « cc/test/test_delegating_output_surface.cc ('k') | cc/test/test_web_graphics_context_3d.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698