1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CC_TREES_LAYER_TREE_HOST_CLIENT_H_
6 #define CC_TREES_LAYER_TREE_HOST_CLIENT_H_
8 #include "base/memory/ref_counted.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "base/time/time.h"
11 #include "cc/debug/frame_timing_tracker.h"
19 class ContextProvider
;
20 class InputHandlerClient
;
22 struct BeginFrameArgs
;
24 class LayerTreeHostClient
{
26 virtual void WillBeginMainFrame() = 0;
27 // Marks finishing compositing-related tasks on the main thread. In threaded
28 // mode, this corresponds to DidCommit().
29 virtual void BeginMainFrame(const BeginFrameArgs
& args
) = 0;
30 virtual void BeginMainFrameNotExpectedSoon() = 0;
31 virtual void DidBeginMainFrame() = 0;
32 virtual void Layout() = 0;
33 virtual void ApplyViewportDeltas(
34 const gfx::Vector2dF
& inner_delta
,
35 const gfx::Vector2dF
& outer_delta
,
36 const gfx::Vector2dF
& elastic_overscroll_delta
,
38 float top_controls_delta
) = 0;
39 // Request an OutputSurface from the client. When the client has one it should
40 // call LayerTreeHost::SetOutputSurface. This will result in either
41 // DidFailToInitializeOutputSurface or DidInitializeOutputSurface being
43 virtual void RequestNewOutputSurface() = 0;
44 virtual void DidInitializeOutputSurface() = 0;
45 virtual void DidFailToInitializeOutputSurface() = 0;
46 virtual void WillCommit() = 0;
47 virtual void DidCommit() = 0;
48 virtual void DidCommitAndDrawFrame() = 0;
49 virtual void DidCompleteSwapBuffers() = 0;
50 virtual void RecordFrameTimingEvents(
51 scoped_ptr
<FrameTimingTracker::CompositeTimingSet
> composite_events
,
52 scoped_ptr
<FrameTimingTracker::MainFrameTimingSet
> main_frame_events
) = 0;
54 // Called when page scale animation has completed.
55 virtual void DidCompletePageScaleAnimation() = 0;
57 // TODO(simonhong): Makes this to pure virtual function when client
58 // implementation is ready.
59 virtual void SendBeginFramesToChildren(const BeginFrameArgs
& args
) {}
61 // Requests that the client insert a rate limiting token in the shared main
62 // thread context's command stream that will block if the context gets too far
63 // ahead of the compositor's command stream. Only needed if the tree contains
64 // a TextureLayer that calls SetRateLimitContext(true).
65 virtual void RateLimitSharedMainThreadContext() {}
68 virtual ~LayerTreeHostClient() {}
73 #endif // CC_TREES_LAYER_TREE_HOST_CLIENT_H_