| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 virtual ~CCThreadProxy(); | 51 virtual ~CCThreadProxy(); |
| 52 | 52 |
| 53 // CCProxy implementation | 53 // CCProxy implementation |
| 54 virtual bool compositeAndReadback(void *pixels, const IntRect&) OVERRIDE; | 54 virtual bool compositeAndReadback(void *pixels, const IntRect&) OVERRIDE; |
| 55 virtual void startPageScaleAnimation(const IntSize& targetPosition, bool use
Anchor, float scale, double duration) OVERRIDE; | 55 virtual void startPageScaleAnimation(const IntSize& targetPosition, bool use
Anchor, float scale, double duration) OVERRIDE; |
| 56 virtual CCGraphicsContext* context() OVERRIDE; | 56 virtual CCGraphicsContext* context() OVERRIDE; |
| 57 virtual void finishAllRendering() OVERRIDE; | 57 virtual void finishAllRendering() OVERRIDE; |
| 58 virtual bool isStarted() const OVERRIDE; | 58 virtual bool isStarted() const OVERRIDE; |
| 59 virtual bool initializeContext() OVERRIDE; | 59 virtual bool initializeContext() OVERRIDE; |
| 60 virtual void setSurfaceReady() OVERRIDE; | 60 virtual void setSurfaceReady() OVERRIDE; |
| 61 virtual void setVisible(bool) OVERRIDE; |
| 61 virtual bool initializeLayerRenderer() OVERRIDE; | 62 virtual bool initializeLayerRenderer() OVERRIDE; |
| 62 virtual bool recreateContext() OVERRIDE; | 63 virtual bool recreateContext() OVERRIDE; |
| 63 virtual int compositorIdentifier() const OVERRIDE; | 64 virtual int compositorIdentifier() const OVERRIDE; |
| 64 virtual const LayerRendererCapabilities& layerRendererCapabilities() const O
VERRIDE; | 65 virtual const LayerRendererCapabilities& layerRendererCapabilities() const O
VERRIDE; |
| 65 virtual void loseContext() OVERRIDE; | 66 virtual void loseContext() OVERRIDE; |
| 66 virtual void setNeedsAnimate() OVERRIDE; | 67 virtual void setNeedsAnimate() OVERRIDE; |
| 67 virtual void setNeedsCommit() OVERRIDE; | 68 virtual void setNeedsCommit() OVERRIDE; |
| 68 virtual void setNeedsForcedCommit() OVERRIDE; | |
| 69 virtual void setNeedsRedraw() OVERRIDE; | 69 virtual void setNeedsRedraw() OVERRIDE; |
| 70 virtual bool commitRequested() const OVERRIDE; | 70 virtual bool commitRequested() const OVERRIDE; |
| 71 virtual void didAddAnimation() OVERRIDE { } | 71 virtual void didAddAnimation() OVERRIDE { } |
| 72 virtual void start() OVERRIDE; | 72 virtual void start() OVERRIDE; |
| 73 virtual void stop() OVERRIDE; | 73 virtual void stop() OVERRIDE; |
| 74 virtual size_t maxPartialTextureUpdates() const OVERRIDE; | 74 virtual size_t maxPartialTextureUpdates() const OVERRIDE; |
| 75 virtual void acquireLayerTextures() OVERRIDE; | 75 virtual void acquireLayerTextures() OVERRIDE; |
| 76 virtual void setFontAtlas(PassOwnPtr<CCFontAtlas>) OVERRIDE; | 76 virtual void setFontAtlas(PassOwnPtr<CCFontAtlas>) OVERRIDE; |
| 77 virtual void forceSerializeOnSwapBuffers() OVERRIDE; | 77 virtual void forceSerializeOnSwapBuffers() OVERRIDE; |
| 78 | 78 |
| 79 // CCLayerTreeHostImplClient implementation | 79 // CCLayerTreeHostImplClient implementation |
| 80 virtual void didLoseContextOnImplThread() OVERRIDE; | 80 virtual void didLoseContextOnImplThread() OVERRIDE; |
| 81 virtual void onSwapBuffersCompleteOnImplThread() OVERRIDE; | 81 virtual void onSwapBuffersCompleteOnImplThread() OVERRIDE; |
| 82 virtual void setNeedsRedrawOnImplThread() OVERRIDE; | 82 virtual void setNeedsRedrawOnImplThread() OVERRIDE; |
| 83 virtual void setNeedsCommitOnImplThread() OVERRIDE; | 83 virtual void setNeedsCommitOnImplThread() OVERRIDE; |
| 84 virtual void postAnimationEventsToMainThreadOnImplThread(PassOwnPtr<CCAnimat
ionEventsVector>, double wallClockTime) OVERRIDE; | 84 virtual void postAnimationEventsToMainThreadOnImplThread(PassOwnPtr<CCAnimat
ionEventsVector>, double wallClockTime) OVERRIDE; |
| 85 virtual void postSetContentsMemoryAllocationLimitBytesToMainThreadOnImplThre
ad(size_t) OVERRIDE; | |
| 86 | 85 |
| 87 // CCSchedulerClient implementation | 86 // CCSchedulerClient implementation |
| 88 virtual bool canDraw() OVERRIDE; | 87 virtual bool canDraw() OVERRIDE; |
| 89 virtual bool hasMoreResourceUpdates() const OVERRIDE; | 88 virtual bool hasMoreResourceUpdates() const OVERRIDE; |
| 90 virtual void scheduledActionBeginFrame() OVERRIDE; | 89 virtual void scheduledActionBeginFrame() OVERRIDE; |
| 91 virtual CCScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapIfPossi
ble() OVERRIDE; | 90 virtual CCScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapIfPossi
ble() OVERRIDE; |
| 92 virtual CCScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapForced(
) OVERRIDE; | 91 virtual CCScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapForced(
) OVERRIDE; |
| 93 virtual void scheduledActionUpdateMoreResources() OVERRIDE; | 92 virtual void scheduledActionUpdateMoreResources() OVERRIDE; |
| 94 virtual void scheduledActionCommit() OVERRIDE; | 93 virtual void scheduledActionCommit() OVERRIDE; |
| 95 virtual void scheduledActionBeginContextRecreation() OVERRIDE; | 94 virtual void scheduledActionBeginContextRecreation() OVERRIDE; |
| 96 virtual void scheduledActionAcquireLayerTexturesForMainThread() OVERRIDE; | 95 virtual void scheduledActionAcquireLayerTexturesForMainThread() OVERRIDE; |
| 97 | 96 |
| 98 private: | 97 private: |
| 99 explicit CCThreadProxy(CCLayerTreeHost*); | 98 explicit CCThreadProxy(CCLayerTreeHost*); |
| 100 friend class CCThreadProxyContextRecreationTimer; | 99 friend class CCThreadProxyContextRecreationTimer; |
| 101 | 100 |
| 102 // Set on impl thread, read on main thread. | 101 // Set on impl thread, read on main thread. |
| 103 struct BeginFrameAndCommitState { | 102 struct BeginFrameAndCommitState { |
| 104 BeginFrameAndCommitState() | 103 BeginFrameAndCommitState() |
| 105 : monotonicFrameBeginTime(0) | 104 : monotonicFrameBeginTime(0) |
| 106 , updater(0) | 105 , updater(0) |
| 107 { | 106 { |
| 108 } | 107 } |
| 109 | 108 |
| 110 double monotonicFrameBeginTime; | 109 double monotonicFrameBeginTime; |
| 111 OwnPtr<CCScrollAndScaleSet> scrollInfo; | 110 OwnPtr<CCScrollAndScaleSet> scrollInfo; |
| 112 CCTextureUpdater* updater; | 111 CCTextureUpdater* updater; |
| 112 bool contentsTexturesWereDeleted; |
| 113 size_t memoryAllocationLimitBytes; |
| 113 }; | 114 }; |
| 114 OwnPtr<BeginFrameAndCommitState> m_pendingBeginFrameRequest; | 115 OwnPtr<BeginFrameAndCommitState> m_pendingBeginFrameRequest; |
| 115 | 116 |
| 116 // Called on main thread | 117 // Called on main thread |
| 117 void beginFrame(); | 118 void beginFrame(); |
| 118 void didCommitAndDrawFrame(); | 119 void didCommitAndDrawFrame(); |
| 119 void didCompleteSwapBuffers(); | 120 void didCompleteSwapBuffers(); |
| 120 void setAnimationEvents(PassOwnPtr<CCAnimationEventsVector>, double wallCloc
kTime); | 121 void setAnimationEvents(PassOwnPtr<CCAnimationEventsVector>, double wallCloc
kTime); |
| 121 void setContentsMemoryAllocationLimitBytes(size_t); | |
| 122 void beginContextRecreation(); | 122 void beginContextRecreation(); |
| 123 void tryToRecreateContext(); | 123 void tryToRecreateContext(); |
| 124 | 124 |
| 125 // Called on impl thread | 125 // Called on impl thread |
| 126 struct ReadbackRequest { | 126 struct ReadbackRequest { |
| 127 CCCompletionEvent completion; | 127 CCCompletionEvent completion; |
| 128 bool success; | 128 bool success; |
| 129 void* pixels; | 129 void* pixels; |
| 130 IntRect rect; | 130 IntRect rect; |
| 131 }; | 131 }; |
| 132 void forceBeginFrameOnImplThread(CCCompletionEvent*); | 132 void forceBeginFrameOnImplThread(CCCompletionEvent*); |
| 133 void beginFrameCompleteOnImplThread(CCCompletionEvent*); | 133 void beginFrameCompleteOnImplThread(CCCompletionEvent*); |
| 134 void beginFrameAbortedOnImplThread(); |
| 134 void requestReadbackOnImplThread(ReadbackRequest*); | 135 void requestReadbackOnImplThread(ReadbackRequest*); |
| 135 void requestStartPageScaleAnimationOnImplThread(IntSize targetPosition, bool
useAnchor, float scale, double durationSec); | 136 void requestStartPageScaleAnimationOnImplThread(IntSize targetPosition, bool
useAnchor, float scale, double durationSec); |
| 136 void finishAllRenderingOnImplThread(CCCompletionEvent*); | 137 void finishAllRenderingOnImplThread(CCCompletionEvent*); |
| 137 void initializeImplOnImplThread(CCCompletionEvent*); | 138 void initializeImplOnImplThread(CCCompletionEvent*); |
| 138 void setSurfaceReadyOnImplThread(); | 139 void setSurfaceReadyOnImplThread(); |
| 140 void setVisibleOnImplThread(CCCompletionEvent*, bool); |
| 139 void initializeContextOnImplThread(CCGraphicsContext*); | 141 void initializeContextOnImplThread(CCGraphicsContext*); |
| 140 void initializeLayerRendererOnImplThread(CCCompletionEvent*, bool* initializ
eSucceeded, LayerRendererCapabilities*); | 142 void initializeLayerRendererOnImplThread(CCCompletionEvent*, bool* initializ
eSucceeded, LayerRendererCapabilities*); |
| 141 void layerTreeHostClosedOnImplThread(CCCompletionEvent*); | 143 void layerTreeHostClosedOnImplThread(CCCompletionEvent*); |
| 142 void setFullRootLayerDamageOnImplThread(); | 144 void setFullRootLayerDamageOnImplThread(); |
| 143 void acquireLayerTexturesForMainThreadOnImplThread(CCCompletionEvent*); | 145 void acquireLayerTexturesForMainThreadOnImplThread(CCCompletionEvent*); |
| 144 void recreateContextOnImplThread(CCCompletionEvent*, CCGraphicsContext*, boo
l* recreateSucceeded, LayerRendererCapabilities*); | 146 void recreateContextOnImplThread(CCCompletionEvent*, CCGraphicsContext*, boo
l* recreateSucceeded, LayerRendererCapabilities*); |
| 145 CCScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapInternal(bool f
orcedDraw); | 147 CCScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapInternal(bool f
orcedDraw); |
| 146 void setFontAtlasOnImplThread(PassOwnPtr<CCFontAtlas>); | 148 void setFontAtlasOnImplThread(PassOwnPtr<CCFontAtlas>); |
| 147 void forceSerializeOnSwapBuffersOnImplThread(CCCompletionEvent*); | 149 void forceSerializeOnSwapBuffersOnImplThread(CCCompletionEvent*); |
| 148 void setNeedsForcedCommitOnImplThread(); | 150 void setNeedsForcedCommitOnImplThread(); |
| 149 | 151 |
| 150 // Accessed on main thread only. | 152 // Accessed on main thread only. |
| 151 bool m_animateRequested; | 153 bool m_animateRequested; |
| 152 bool m_commitRequested; | 154 bool m_commitRequested; |
| 153 bool m_forcedCommitRequested; | 155 bool m_forcedCommitRequested; |
| 154 bool m_contextLost; | 156 bool m_contextLost; |
| 155 OwnPtr<CCThreadProxyContextRecreationTimer> m_contextRecreationTimer; | 157 OwnPtr<CCThreadProxyContextRecreationTimer> m_contextRecreationTimer; |
| 156 CCLayerTreeHost* m_layerTreeHost; | 158 CCLayerTreeHost* m_layerTreeHost; |
| 157 int m_compositorIdentifier; | 159 int m_compositorIdentifier; |
| 158 bool m_layerRendererInitialized; | 160 bool m_layerRendererInitialized; |
| 159 LayerRendererCapabilities m_layerRendererCapabilitiesMainThreadCopy; | 161 LayerRendererCapabilities m_layerRendererCapabilitiesMainThreadCopy; |
| 160 bool m_started; | 162 bool m_started; |
| 161 bool m_texturesAcquired; | 163 bool m_texturesAcquired; |
| 164 bool m_inCompositeAndReadback; |
| 162 | 165 |
| 163 OwnPtr<CCLayerTreeHostImpl> m_layerTreeHostImpl; | 166 OwnPtr<CCLayerTreeHostImpl> m_layerTreeHostImpl; |
| 164 | 167 |
| 165 OwnPtr<CCInputHandler> m_inputHandlerOnImplThread; | 168 OwnPtr<CCInputHandler> m_inputHandlerOnImplThread; |
| 166 | 169 |
| 167 OwnPtr<CCScheduler> m_schedulerOnImplThread; | 170 OwnPtr<CCScheduler> m_schedulerOnImplThread; |
| 168 | 171 |
| 169 RefPtr<CCScopedThreadProxy> m_mainThreadProxy; | 172 RefPtr<CCScopedThreadProxy> m_mainThreadProxy; |
| 170 | 173 |
| 171 // Holds on to the context we might use for compositing in between initializ
eContext() | 174 // Holds on to the context we might use for compositing in between initializ
eContext() |
| (...skipping 14 matching lines...) Expand all Loading... |
| 186 | 189 |
| 187 OwnPtr<CCTextureUpdater> m_currentTextureUpdaterOnImplThread; | 190 OwnPtr<CCTextureUpdater> m_currentTextureUpdaterOnImplThread; |
| 188 | 191 |
| 189 // Set when the next draw should post didCommitAndDrawFrame to the main thre
ad. | 192 // Set when the next draw should post didCommitAndDrawFrame to the main thre
ad. |
| 190 bool m_nextFrameIsNewlyCommittedFrameOnImplThread; | 193 bool m_nextFrameIsNewlyCommittedFrameOnImplThread; |
| 191 }; | 194 }; |
| 192 | 195 |
| 193 } | 196 } |
| 194 | 197 |
| 195 #endif | 198 #endif |
| OLD | NEW |