| 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 CC_THREAD_PROXY_H_ | 5 #ifndef CC_THREAD_PROXY_H_ |
| 6 #define CC_THREAD_PROXY_H_ | 6 #define CC_THREAD_PROXY_H_ |
| 7 | 7 |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/time.h" | 9 #include "base/time.h" |
| 10 #include "cc/animation_events.h" | 10 #include "cc/animation_events.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 virtual void scheduledActionBeginContextRecreation() OVERRIDE; | 73 virtual void scheduledActionBeginContextRecreation() OVERRIDE; |
| 74 virtual void scheduledActionAcquireLayerTexturesForMainThread() OVERRIDE; | 74 virtual void scheduledActionAcquireLayerTexturesForMainThread() OVERRIDE; |
| 75 virtual void didAnticipatedDrawTimeChange(base::TimeTicks) OVERRIDE; | 75 virtual void didAnticipatedDrawTimeChange(base::TimeTicks) OVERRIDE; |
| 76 | 76 |
| 77 // ResourceUpdateControllerClient implementation | 77 // ResourceUpdateControllerClient implementation |
| 78 virtual void readyToFinalizeTextureUpdates() OVERRIDE; | 78 virtual void readyToFinalizeTextureUpdates() OVERRIDE; |
| 79 | 79 |
| 80 private: | 80 private: |
| 81 ThreadProxy(LayerTreeHost*, scoped_ptr<Thread> implThread); | 81 ThreadProxy(LayerTreeHost*, scoped_ptr<Thread> implThread); |
| 82 | 82 |
| 83 // Set on impl thread, read on main thread. | |
| 84 struct BeginFrameAndCommitState { | 83 struct BeginFrameAndCommitState { |
| 85 BeginFrameAndCommitState(); | 84 BeginFrameAndCommitState(); |
| 86 ~BeginFrameAndCommitState(); | 85 ~BeginFrameAndCommitState(); |
| 87 | 86 |
| 88 base::TimeTicks monotonicFrameBeginTime; | 87 base::TimeTicks monotonicFrameBeginTime; |
| 89 scoped_ptr<ScrollAndScaleSet> scrollInfo; | 88 scoped_ptr<ScrollAndScaleSet> scrollInfo; |
| 90 WebKit::WebTransformationMatrix implTransform; | 89 WebKit::WebTransformationMatrix implTransform; |
| 91 PrioritizedResourceManager::BackingList evictedContentsTexturesBackings; | 90 PrioritizedResourceManager::BackingList evictedContentsTexturesBackings; |
| 92 size_t memoryAllocationLimitBytes; | 91 size_t memoryAllocationLimitBytes; |
| 93 }; | 92 }; |
| 94 scoped_ptr<BeginFrameAndCommitState> m_pendingBeginFrameRequest; | |
| 95 | 93 |
| 96 // Called on main thread | 94 // Called on main thread |
| 97 void beginFrame(); | 95 void beginFrame(scoped_ptr<BeginFrameAndCommitState> beginFrameState); |
| 98 void didCommitAndDrawFrame(); | 96 void didCommitAndDrawFrame(); |
| 99 void didCompleteSwapBuffers(); | 97 void didCompleteSwapBuffers(); |
| 100 void setAnimationEvents(scoped_ptr<AnimationEventsVector>, base::Time wallCl
ockTime); | 98 void setAnimationEvents(scoped_ptr<AnimationEventsVector>, base::Time wallCl
ockTime); |
| 101 void beginContextRecreation(); | 99 void beginContextRecreation(); |
| 102 void tryToRecreateContext(); | 100 void tryToRecreateContext(); |
| 103 | 101 |
| 104 // Called on impl thread | 102 // Called on impl thread |
| 105 struct ReadbackRequest { | 103 struct ReadbackRequest { |
| 106 CompletionEvent completion; | 104 CompletionEvent completion; |
| 107 bool success; | 105 bool success; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 125 void recreateContextOnImplThread(CompletionEvent*, scoped_ptr<GraphicsContex
t>, bool* recreateSucceeded, RendererCapabilities*); | 123 void recreateContextOnImplThread(CompletionEvent*, scoped_ptr<GraphicsContex
t>, bool* recreateSucceeded, RendererCapabilities*); |
| 126 void renderingStatsOnImplThread(CompletionEvent*, RenderingStats*); | 124 void renderingStatsOnImplThread(CompletionEvent*, RenderingStats*); |
| 127 ScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapInternal(bool for
cedDraw); | 125 ScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapInternal(bool for
cedDraw); |
| 128 void forceSerializeOnSwapBuffersOnImplThread(CompletionEvent*); | 126 void forceSerializeOnSwapBuffersOnImplThread(CompletionEvent*); |
| 129 void setNeedsForcedCommitOnImplThread(); | 127 void setNeedsForcedCommitOnImplThread(); |
| 130 | 128 |
| 131 // Accessed on main thread only. | 129 // Accessed on main thread only. |
| 132 bool m_animateRequested; // Set only when setNeedsAnimate is called. | 130 bool m_animateRequested; // Set only when setNeedsAnimate is called. |
| 133 bool m_commitRequested; // Set only when setNeedsCommit is called. | 131 bool m_commitRequested; // Set only when setNeedsCommit is called. |
| 134 bool m_commitRequestSentToImplThread; // Set by setNeedsCommit and setNeedsA
nimate. | 132 bool m_commitRequestSentToImplThread; // Set by setNeedsCommit and setNeedsA
nimate. |
| 135 bool m_forcedCommitRequested; | |
| 136 base::CancelableClosure m_contextRecreationCallback; | 133 base::CancelableClosure m_contextRecreationCallback; |
| 137 LayerTreeHost* m_layerTreeHost; | 134 LayerTreeHost* m_layerTreeHost; |
| 138 bool m_rendererInitialized; | 135 bool m_rendererInitialized; |
| 139 RendererCapabilities m_RendererCapabilitiesMainThreadCopy; | 136 RendererCapabilities m_RendererCapabilitiesMainThreadCopy; |
| 140 bool m_started; | 137 bool m_started; |
| 141 bool m_texturesAcquired; | 138 bool m_texturesAcquired; |
| 142 bool m_inCompositeAndReadback; | 139 bool m_inCompositeAndReadback; |
| 143 | 140 |
| 144 scoped_ptr<LayerTreeHostImpl> m_layerTreeHostImpl; | 141 scoped_ptr<LayerTreeHostImpl> m_layerTreeHostImpl; |
| 145 | 142 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 169 | 166 |
| 170 // Set when the next draw should post didCommitAndDrawFrame to the main thre
ad. | 167 // Set when the next draw should post didCommitAndDrawFrame to the main thre
ad. |
| 171 bool m_nextFrameIsNewlyCommittedFrameOnImplThread; | 168 bool m_nextFrameIsNewlyCommittedFrameOnImplThread; |
| 172 | 169 |
| 173 bool m_renderVSyncEnabled; | 170 bool m_renderVSyncEnabled; |
| 174 | 171 |
| 175 base::TimeDelta m_totalCommitTime; | 172 base::TimeDelta m_totalCommitTime; |
| 176 size_t m_totalCommitCount; | 173 size_t m_totalCommitCount; |
| 177 | 174 |
| 178 bool m_deferCommits; | 175 bool m_deferCommits; |
| 179 bool m_deferredCommitPending; | 176 scoped_ptr<BeginFrameAndCommitState> m_pendingDeferredCommit; |
| 180 }; | 177 }; |
| 181 | 178 |
| 182 } // namespace cc | 179 } // namespace cc |
| 183 | 180 |
| 184 #endif // CC_THREAD_PROXY_H_ | 181 #endif // CC_THREAD_PROXY_H_ |
| OLD | NEW |