OLD | NEW |
---|---|
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 CCThreadProxy_h | 5 #ifndef CCThreadProxy_h |
6 #define CCThreadProxy_h | 6 #define CCThreadProxy_h |
7 | 7 |
8 #include "CCAnimationEvents.h" | 8 #include "CCAnimationEvents.h" |
9 #include "CCCompletionEvent.h" | 9 #include "CCCompletionEvent.h" |
10 #include "CCLayerTreeHostImpl.h" | 10 #include "CCLayerTreeHostImpl.h" |
11 #include "CCProxy.h" | 11 #include "CCProxy.h" |
12 #include "CCScheduler.h" | 12 #include "CCScheduler.h" |
13 #include "CCTextureUpdateController.h" | |
13 #include <wtf/OwnPtr.h> | 14 #include <wtf/OwnPtr.h> |
14 | 15 |
15 namespace WebCore { | 16 namespace WebCore { |
16 | 17 |
17 class CCInputHandler; | 18 class CCInputHandler; |
18 class CCLayerTreeHost; | 19 class CCLayerTreeHost; |
19 class CCScheduler; | 20 class CCScheduler; |
20 class CCScopedThreadProxy; | 21 class CCScopedThreadProxy; |
21 class CCTextureUpdateQueue; | 22 class CCTextureUpdateQueue; |
22 class CCTextureUpdateController; | |
23 class CCThread; | 23 class CCThread; |
24 class CCThreadProxyContextRecreationTimer; | 24 class CCThreadProxyContextRecreationTimer; |
25 | 25 |
26 class CCThreadProxy : public CCProxy, CCLayerTreeHostImplClient, CCSchedulerClie nt { | 26 class CCThreadProxy : public CCProxy, CCLayerTreeHostImplClient, CCSchedulerClie nt { |
27 public: | 27 public: |
28 static PassOwnPtr<CCProxy> create(CCLayerTreeHost*); | 28 static PassOwnPtr<CCProxy> create(CCLayerTreeHost*); |
29 | 29 |
30 virtual ~CCThreadProxy(); | 30 virtual ~CCThreadProxy(); |
31 | 31 |
32 // CCProxy implementation | 32 // CCProxy implementation |
33 virtual bool compositeAndReadback(void *pixels, const IntRect&) OVERRIDE; | 33 virtual bool compositeAndReadback(void *pixels, const IntRect&) OVERRIDE; |
34 virtual void startPageScaleAnimation(const IntSize& targetPosition, bool use Anchor, float scale, double duration) OVERRIDE; | 34 virtual void startPageScaleAnimation(const IntSize& targetPosition, bool use Anchor, float scale, double duration) OVERRIDE; |
35 virtual void finishAllRendering() OVERRIDE; | 35 virtual void finishAllRendering() OVERRIDE; |
36 virtual bool isStarted() const OVERRIDE; | 36 virtual bool isStarted() const OVERRIDE; |
37 virtual bool initializeContext() OVERRIDE; | 37 virtual bool initializeContext() OVERRIDE; |
38 virtual void setSurfaceReady() OVERRIDE; | 38 virtual void setSurfaceReady() OVERRIDE; |
39 virtual void setVisible(bool) OVERRIDE; | 39 virtual void setVisible(bool) OVERRIDE; |
40 virtual bool initializeRenderer() OVERRIDE; | 40 virtual bool initializeRenderer() OVERRIDE; |
41 virtual bool recreateContext() OVERRIDE; | 41 virtual bool recreateContext() OVERRIDE; |
42 virtual void implSideRenderingStats(CCRenderingStats&) OVERRIDE; | 42 virtual void implSideRenderingStats(CCRenderingStats&) OVERRIDE; |
43 virtual const RendererCapabilities& rendererCapabilities() const OVERRIDE; | 43 virtual const RendererCapabilities& rendererCapabilities() const OVERRIDE; |
44 virtual void loseContext() OVERRIDE; | 44 virtual void loseContext() OVERRIDE; |
45 virtual void setNeedsAnimate() OVERRIDE; | 45 virtual void setNeedsAnimate() OVERRIDE; |
46 virtual void setNeedsCommit() OVERRIDE; | 46 virtual void setNeedsCommit() OVERRIDE; |
47 virtual void setNeedsRedraw() OVERRIDE; | 47 virtual void setNeedsRedraw() OVERRIDE; |
48 virtual bool commitRequested() const OVERRIDE; | 48 virtual bool commitRequested() const OVERRIDE; |
49 virtual void didAddAnimation() OVERRIDE { } | 49 virtual void didAddAnimation() OVERRIDE { } |
50 virtual void start() OVERRIDE; | 50 virtual void start() OVERRIDE; |
51 virtual void stop() OVERRIDE; | 51 virtual void stop() OVERRIDE; |
52 virtual size_t maxPartialTextureUpdates() const OVERRIDE; | |
53 virtual void acquireLayerTextures() OVERRIDE; | 52 virtual void acquireLayerTextures() OVERRIDE; |
54 virtual void forceSerializeOnSwapBuffers() OVERRIDE; | 53 virtual void forceSerializeOnSwapBuffers() OVERRIDE; |
55 | 54 |
56 // CCLayerTreeHostImplClient implementation | 55 // CCLayerTreeHostImplClient implementation |
57 virtual void didLoseContextOnImplThread() OVERRIDE; | 56 virtual void didLoseContextOnImplThread() OVERRIDE; |
58 virtual void onSwapBuffersCompleteOnImplThread() OVERRIDE; | 57 virtual void onSwapBuffersCompleteOnImplThread() OVERRIDE; |
59 virtual void onVSyncParametersChanged(double monotonicTimebase, double inter valInSeconds) OVERRIDE; | 58 virtual void onVSyncParametersChanged(double monotonicTimebase, double inter valInSeconds) OVERRIDE; |
60 virtual void onCanDrawStateChanged(bool canDraw) OVERRIDE; | 59 virtual void onCanDrawStateChanged(bool canDraw) OVERRIDE; |
61 virtual void setNeedsRedrawOnImplThread() OVERRIDE; | 60 virtual void setNeedsRedrawOnImplThread() OVERRIDE; |
62 virtual void setNeedsCommitOnImplThread() OVERRIDE; | 61 virtual void setNeedsCommitOnImplThread() OVERRIDE; |
(...skipping 22 matching lines...) Expand all Loading... | |
85 } | 84 } |
86 | 85 |
87 double monotonicFrameBeginTime; | 86 double monotonicFrameBeginTime; |
88 OwnPtr<CCScrollAndScaleSet> scrollInfo; | 87 OwnPtr<CCScrollAndScaleSet> scrollInfo; |
89 bool contentsTexturesWereDeleted; | 88 bool contentsTexturesWereDeleted; |
90 size_t memoryAllocationLimitBytes; | 89 size_t memoryAllocationLimitBytes; |
91 }; | 90 }; |
92 OwnPtr<BeginFrameAndCommitState> m_pendingBeginFrameRequest; | 91 OwnPtr<BeginFrameAndCommitState> m_pendingBeginFrameRequest; |
93 | 92 |
94 // Called on main thread | 93 // Called on main thread |
95 void beginFrame(); | 94 void beginFrame(size_t maxTextureUpdates); |
reveman
2012/09/15 17:26:19
should this be maxPartialTextureUpdates?
brianderson
2012/09/17 22:48:27
Done.
| |
96 void didCommitAndDrawFrame(); | 95 void didCommitAndDrawFrame(); |
97 void didCompleteSwapBuffers(); | 96 void didCompleteSwapBuffers(); |
98 void setAnimationEvents(PassOwnPtr<CCAnimationEventsVector>, double wallCloc kTime); | 97 void setAnimationEvents(PassOwnPtr<CCAnimationEventsVector>, double wallCloc kTime); |
99 void beginContextRecreation(); | 98 void beginContextRecreation(); |
100 void tryToRecreateContext(); | 99 void tryToRecreateContext(); |
101 | 100 |
102 // Called on impl thread | 101 // Called on impl thread |
103 struct ReadbackRequest { | 102 struct ReadbackRequest { |
104 CCCompletionEvent completion; | 103 CCCompletionEvent completion; |
105 bool success; | 104 bool success; |
106 void* pixels; | 105 void* pixels; |
107 IntRect rect; | 106 IntRect rect; |
108 }; | 107 }; |
109 void forceBeginFrameOnImplThread(CCCompletionEvent*); | 108 void forceBeginFrameOnImplThread(CCCompletionEvent*); |
110 void beginFrameCompleteOnImplThread(CCCompletionEvent*, PassOwnPtr<CCTexture UpdateQueue>, bool contentsTexturesWereDeleted); | 109 void beginFrameCompleteOnImplThread(CCCompletionEvent*, PassOwnPtr<CCTexture UpdateQueue>, bool contentsTexturesWereDeleted, size_t maxTextureUpdates); |
111 void beginFrameAbortedOnImplThread(); | 110 void beginFrameAbortedOnImplThread(); |
112 void requestReadbackOnImplThread(ReadbackRequest*); | 111 void requestReadbackOnImplThread(ReadbackRequest*); |
113 void requestStartPageScaleAnimationOnImplThread(IntSize targetPosition, bool useAnchor, float scale, double durationSec); | 112 void requestStartPageScaleAnimationOnImplThread(IntSize targetPosition, bool useAnchor, float scale, double durationSec); |
114 void finishAllRenderingOnImplThread(CCCompletionEvent*); | 113 void finishAllRenderingOnImplThread(CCCompletionEvent*); |
115 void initializeImplOnImplThread(CCCompletionEvent*, PassOwnPtr<CCInputHandle r>); | 114 void initializeImplOnImplThread(CCCompletionEvent*, PassOwnPtr<CCInputHandle r>); |
116 void setSurfaceReadyOnImplThread(); | 115 void setSurfaceReadyOnImplThread(); |
117 void setVisibleOnImplThread(CCCompletionEvent*, bool); | 116 void setVisibleOnImplThread(CCCompletionEvent*, bool); |
118 void initializeContextOnImplThread(CCGraphicsContext*); | 117 void initializeContextOnImplThread(CCGraphicsContext*); |
119 void initializeRendererOnImplThread(CCCompletionEvent*, bool* initializeSucc eeded, RendererCapabilities*); | 118 void initializeRendererOnImplThread(CCCompletionEvent*, bool* initializeSucc eeded, RendererCapabilities*); |
120 void layerTreeHostClosedOnImplThread(CCCompletionEvent*); | 119 void layerTreeHostClosedOnImplThread(CCCompletionEvent*); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
165 | 164 |
166 OwnPtr<CCTextureUpdateController> m_currentTextureUpdateControllerOnImplThre ad; | 165 OwnPtr<CCTextureUpdateController> m_currentTextureUpdateControllerOnImplThre ad; |
167 | 166 |
168 // Set when we need to reset the contentsTexturesPurged flag after the | 167 // Set when we need to reset the contentsTexturesPurged flag after the |
169 // commit. | 168 // commit. |
170 bool m_resetContentsTexturesPurgedAfterCommitOnImplThread; | 169 bool m_resetContentsTexturesPurgedAfterCommitOnImplThread; |
171 | 170 |
172 // Set when the next draw should post didCommitAndDrawFrame to the main thre ad. | 171 // Set when the next draw should post didCommitAndDrawFrame to the main thre ad. |
173 bool m_nextFrameIsNewlyCommittedFrameOnImplThread; | 172 bool m_nextFrameIsNewlyCommittedFrameOnImplThread; |
174 | 173 |
174 // We store this for when we initiate beginFrame from the main thread. | |
175 size_t m_mostRecentMaxTextureUpdatesOnMainThread; | |
176 | |
175 bool m_renderVSyncEnabled; | 177 bool m_renderVSyncEnabled; |
176 }; | 178 }; |
177 | 179 |
178 } | 180 } |
179 | 181 |
180 #endif | 182 #endif |
OLD | NEW |