2
* Copyright (C) 2011 Google Inc. All rights reserved.
4
* Redistribution and use in source and binary forms, with or without
5
* modification, are permitted provided that the following conditions
8
* 1. Redistributions of source code must retain the above copyright
9
* notice, this list of conditions and the following disclaimer.
10
* 2. Redistributions in binary form must reproduce the above copyright
11
* notice, this list of conditions and the following disclaimer in the
12
* documentation and/or other materials provided with the distribution.
14
* THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
15
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
16
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17
* DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
18
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
19
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
20
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
21
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
#ifndef WebLayerTreeViewClient_h
27
#define WebLayerTreeViewClient_h
32
class WebCompositorOutputSurface;
33
class WebInputHandler;
38
class WebLayerTreeViewClient {
40
// Indicates to the embedder that the compositor is about to begin a
41
// frame. This is is a signal to flow control mechanisms that a frame is
42
// beginning. This call will be followed by updateAnimations and then
43
// layout, which should be used for actual animation or tree manipulation
44
// tasks. FIXME: make pure virtual once upstream deps are satisfied.
45
virtual void willBeginFrame() { }
47
// Indicates that main thread tasks associated with frame rendering have completed.
48
// Issued unconditionally, even if the context was lost in the process.
49
virtual void didBeginFrame() { }
51
// Updates animation and layout. These are called before the compositing
52
// pass so that layers can be updated at the given frame time.
53
virtual void updateAnimations(double monotonicFrameBeginTime) = 0;
54
virtual void layout() = 0;
56
// Applies a scroll delta to the root layer, which is bundled with a page
57
// scale factor that may apply a CSS transform on the whole document (used
58
// for mobile-device pinch zooming). This is triggered by events sent to the
59
// compositor thread through the WebCompositor interface.
60
virtual void applyScrollAndScale(const WebSize& scrollDelta, float scaleFactor) = 0;
62
// Creates the output surface. This may be called more than once
63
// if the context gets lost.
64
virtual WebCompositorOutputSurface* createOutputSurface() { return 0; }
66
// Signals a successful recreation of the output surface (e.g. after a lost
68
virtual void didRecreateOutputSurface(bool success) { }
70
virtual WebInputHandler* createInputHandler() { return 0; }
72
// Indicates that a frame will be committed to the impl side of the compositor
74
virtual void willCommit() { }
76
// Indicates that a frame was committed to the impl side of the compositor
79
// FIXME: make this non-virtual when ui/compositor DEP is resolved.
80
virtual void didCommit() { }
82
// Indicates that a frame was committed to the impl side and drawing
83
// commands for it were issued to the GPU.
84
virtual void didCommitAndDrawFrame() = 0;
86
// Indicates that a frame previously issued to the GPU has completed
88
virtual void didCompleteSwapBuffers() = 0;
90
// Schedules a compositing pass, meaning the client should call
91
// WebLayerTreeView::composite at a later time. This is only called if the
92
// compositor thread is disabled; when enabled, the compositor will
93
// internally schedule a compositing pass when needed.
94
virtual void scheduleComposite() = 0;
96
// Creates a font atlas to use for debug visualizations. The atlas is a bitmap
97
// containing glyph data, a table of ASCII character values to a subrectangle
98
// of the atlas representing the corresponding glyph, and the glyph height.
99
virtual void createFontAtlas(SkBitmap&, WebRect asciiToRectTable[128], int& fontHeight) { }
102
virtual ~WebLayerTreeViewClient() { }
105
} // namespace WebKit
107
#endif // WebLayerTreeViewClient_h