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