OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 struct LayerRendererCapabilities; | 52 struct LayerRendererCapabilities; |
53 | 53 |
54 // CCLayerTreeHost->CCProxy callback interface. | 54 // CCLayerTreeHost->CCProxy callback interface. |
55 class CCLayerTreeHostImplClient { | 55 class CCLayerTreeHostImplClient { |
56 public: | 56 public: |
57 virtual void didLoseContextOnImplThread() = 0; | 57 virtual void didLoseContextOnImplThread() = 0; |
58 virtual void onSwapBuffersCompleteOnImplThread() = 0; | 58 virtual void onSwapBuffersCompleteOnImplThread() = 0; |
59 virtual void setNeedsRedrawOnImplThread() = 0; | 59 virtual void setNeedsRedrawOnImplThread() = 0; |
60 virtual void setNeedsCommitOnImplThread() = 0; | 60 virtual void setNeedsCommitOnImplThread() = 0; |
61 virtual void postAnimationEventsToMainThreadOnImplThread(PassOwnPtr<CCAnimat
ionEventsVector>, double wallClockTime) = 0; | 61 virtual void postAnimationEventsToMainThreadOnImplThread(PassOwnPtr<CCAnimat
ionEventsVector>, double wallClockTime) = 0; |
62 virtual void postSetContentsMemoryAllocationLimitBytesToMainThreadOnImplThre
ad(size_t) = 0; | |
63 }; | 62 }; |
64 | 63 |
65 // CCLayerTreeHostImpl owns the CCLayerImpl tree as well as associated rendering
state | 64 // CCLayerTreeHostImpl owns the CCLayerImpl tree as well as associated rendering
state |
66 class CCLayerTreeHostImpl : public CCInputHandlerClient, CCRendererClient { | 65 class CCLayerTreeHostImpl : public CCInputHandlerClient, CCRendererClient { |
67 WTF_MAKE_NONCOPYABLE(CCLayerTreeHostImpl); | 66 WTF_MAKE_NONCOPYABLE(CCLayerTreeHostImpl); |
68 typedef Vector<CCLayerImpl*> CCLayerList; | 67 typedef Vector<CCLayerImpl*> CCLayerList; |
69 | 68 |
70 public: | 69 public: |
71 static PassOwnPtr<CCLayerTreeHostImpl> create(const CCLayerTreeSettings&, CC
LayerTreeHostImplClient*); | 70 static PassOwnPtr<CCLayerTreeHostImpl> create(const CCLayerTreeSettings&, CC
LayerTreeHostImplClient*); |
72 virtual ~CCLayerTreeHostImpl(); | 71 virtual ~CCLayerTreeHostImpl(); |
(...skipping 30 matching lines...) Expand all Loading... |
103 virtual void drawLayers(const FrameData&); | 102 virtual void drawLayers(const FrameData&); |
104 // Must be called if and only if prepareToDraw was called. | 103 // Must be called if and only if prepareToDraw was called. |
105 void didDrawAllLayers(const FrameData&); | 104 void didDrawAllLayers(const FrameData&); |
106 | 105 |
107 // CCRendererClient implementation | 106 // CCRendererClient implementation |
108 virtual const IntSize& deviceViewportSize() const OVERRIDE { return m_device
ViewportSize; } | 107 virtual const IntSize& deviceViewportSize() const OVERRIDE { return m_device
ViewportSize; } |
109 virtual const CCLayerTreeSettings& settings() const OVERRIDE { return m_sett
ings; } | 108 virtual const CCLayerTreeSettings& settings() const OVERRIDE { return m_sett
ings; } |
110 virtual void didLoseContext() OVERRIDE; | 109 virtual void didLoseContext() OVERRIDE; |
111 virtual void onSwapBuffersComplete() OVERRIDE; | 110 virtual void onSwapBuffersComplete() OVERRIDE; |
112 virtual void setFullRootLayerDamage() OVERRIDE; | 111 virtual void setFullRootLayerDamage() OVERRIDE; |
113 virtual void setContentsMemoryAllocationLimitBytes(size_t) OVERRIDE; | 112 virtual void releaseContentsTextures() OVERRIDE; |
| 113 virtual void setMemoryAllocationLimitBytes(size_t) OVERRIDE; |
114 | 114 |
115 // Implementation | 115 // Implementation |
116 bool canDraw(); | 116 bool canDraw(); |
117 CCGraphicsContext* context(); | 117 CCGraphicsContext* context() const; |
118 | 118 |
119 String layerTreeAsText() const; | 119 String layerTreeAsText() const; |
120 void setFontAtlas(PassOwnPtr<CCFontAtlas>); | 120 void setFontAtlas(PassOwnPtr<CCFontAtlas>); |
121 | 121 |
122 void finishAllRendering(); | 122 void finishAllRendering(); |
123 int frameNumber() const { return m_frameNumber; } | 123 int frameNumber() const { return m_frameNumber; } |
124 | 124 |
125 bool initializeLayerRenderer(PassRefPtr<CCGraphicsContext>, TextureUploaderO
ption); | 125 bool initializeLayerRenderer(PassRefPtr<CCGraphicsContext>, TextureUploaderO
ption); |
126 bool isContextLost(); | 126 bool isContextLost(); |
127 CCRenderer* layerRenderer() { return m_layerRenderer.get(); } | 127 CCRenderer* layerRenderer() { return m_layerRenderer.get(); } |
(...skipping 12 matching lines...) Expand all Loading... |
140 PassOwnPtr<CCLayerImpl> detachLayerTree(); | 140 PassOwnPtr<CCLayerImpl> detachLayerTree(); |
141 | 141 |
142 CCLayerImpl* rootScrollLayer() const { return m_rootScrollLayerImpl; } | 142 CCLayerImpl* rootScrollLayer() const { return m_rootScrollLayerImpl; } |
143 | 143 |
144 bool visible() const { return m_visible; } | 144 bool visible() const { return m_visible; } |
145 void setVisible(bool); | 145 void setVisible(bool); |
146 | 146 |
147 int sourceFrameNumber() const { return m_sourceFrameNumber; } | 147 int sourceFrameNumber() const { return m_sourceFrameNumber; } |
148 void setSourceFrameNumber(int frameNumber) { m_sourceFrameNumber = frameNumb
er; } | 148 void setSourceFrameNumber(int frameNumber) { m_sourceFrameNumber = frameNumb
er; } |
149 | 149 |
150 bool sourceFrameCanBeDrawn() const { return m_sourceFrameCanBeDrawn; } | 150 bool contentsTexturesWerePurgedSinceLastCommit() const { return m_contentsTe
xturesWerePurgedSinceLastCommit; } |
151 void setSourceFrameCanBeDrawn(bool sourceFrameCanBeDrawn) { m_sourceFrameCan
BeDrawn = sourceFrameCanBeDrawn; } | 151 size_t memoryAllocationLimitBytes() const { return m_memoryAllocationLimitBy
tes; } |
152 | 152 |
153 const IntSize& viewportSize() const { return m_viewportSize; } | 153 const IntSize& viewportSize() const { return m_viewportSize; } |
154 void setViewportSize(const IntSize&); | 154 void setViewportSize(const IntSize&); |
155 | 155 |
156 float deviceScaleFactor() const { return m_deviceScaleFactor; } | 156 float deviceScaleFactor() const { return m_deviceScaleFactor; } |
157 void setDeviceScaleFactor(float); | 157 void setDeviceScaleFactor(float); |
158 | 158 |
159 float pageScale() const { return m_pageScale; } | 159 float pageScale() const { return m_pageScale; } |
160 void setPageScaleFactorAndLimits(float pageScale, float minPageScale, float
maxPageScale); | 160 void setPageScaleFactorAndLimits(float pageScale, float minPageScale, float
maxPageScale); |
161 | 161 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 OwnPtr<CCRenderer> m_layerRenderer; | 223 OwnPtr<CCRenderer> m_layerRenderer; |
224 OwnPtr<CCLayerImpl> m_rootLayerImpl; | 224 OwnPtr<CCLayerImpl> m_rootLayerImpl; |
225 CCLayerImpl* m_rootScrollLayerImpl; | 225 CCLayerImpl* m_rootScrollLayerImpl; |
226 CCLayerImpl* m_currentlyScrollingLayerImpl; | 226 CCLayerImpl* m_currentlyScrollingLayerImpl; |
227 int m_scrollingLayerIdFromPreviousTree; | 227 int m_scrollingLayerIdFromPreviousTree; |
228 CCLayerTreeSettings m_settings; | 228 CCLayerTreeSettings m_settings; |
229 IntSize m_viewportSize; | 229 IntSize m_viewportSize; |
230 IntSize m_deviceViewportSize; | 230 IntSize m_deviceViewportSize; |
231 float m_deviceScaleFactor; | 231 float m_deviceScaleFactor; |
232 bool m_visible; | 232 bool m_visible; |
233 bool m_sourceFrameCanBeDrawn; | 233 bool m_contentsTexturesWerePurgedSinceLastCommit; |
| 234 size_t m_memoryAllocationLimitBytes; |
234 | 235 |
235 OwnPtr<CCHeadsUpDisplay> m_headsUpDisplay; | 236 OwnPtr<CCHeadsUpDisplay> m_headsUpDisplay; |
236 | 237 |
237 float m_pageScale; | 238 float m_pageScale; |
238 float m_pageScaleDelta; | 239 float m_pageScaleDelta; |
239 float m_sentPageScaleDelta; | 240 float m_sentPageScaleDelta; |
240 float m_minPageScale, m_maxPageScale; | 241 float m_minPageScale, m_maxPageScale; |
241 | 242 |
242 Color m_backgroundColor; | 243 Color m_backgroundColor; |
243 bool m_hasTransparentBackground; | 244 bool m_hasTransparentBackground; |
(...skipping 17 matching lines...) Expand all Loading... |
261 // rendering and input event hit testing. | 262 // rendering and input event hit testing. |
262 CCLayerList m_renderSurfaceLayerList; | 263 CCLayerList m_renderSurfaceLayerList; |
263 | 264 |
264 OwnPtr<CCFrameRateCounter> m_fpsCounter; | 265 OwnPtr<CCFrameRateCounter> m_fpsCounter; |
265 OwnPtr<CCDebugRectHistory> m_debugRectHistory; | 266 OwnPtr<CCDebugRectHistory> m_debugRectHistory; |
266 }; | 267 }; |
267 | 268 |
268 }; | 269 }; |
269 | 270 |
270 #endif | 271 #endif |
OLD | NEW |