Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(218)

Side by Side Diff: cc/single_thread_proxy.cc

Issue 11189043: cc: Rename cc classes and members to match filenames (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #include "config.h" 5 #include "config.h"
6 6
7 #include "CCSingleThreadProxy.h" 7 #include "CCSingleThreadProxy.h"
8 8
9 #include "CCDrawQuad.h" 9 #include "CCDrawQuad.h"
10 #include "CCGraphicsContext.h" 10 #include "CCGraphicsContext.h"
11 #include "CCLayerTreeHost.h" 11 #include "CCLayerTreeHost.h"
12 #include "CCTextureUpdateController.h" 12 #include "CCTextureUpdateController.h"
13 #include "CCTimer.h" 13 #include "CCTimer.h"
14 #include "TraceEvent.h" 14 #include "TraceEvent.h"
15 #include <wtf/CurrentTime.h> 15 #include <wtf/CurrentTime.h>
16 16
17 namespace cc { 17 namespace cc {
18 18
19 scoped_ptr<CCProxy> CCSingleThreadProxy::create(CCLayerTreeHost* layerTreeHost) 19 scoped_ptr<Proxy> SingleThreadProxy::create(LayerTreeHost* layerTreeHost)
20 { 20 {
21 return make_scoped_ptr(new CCSingleThreadProxy(layerTreeHost)).PassAs<CCProx y>(); 21 return make_scoped_ptr(new SingleThreadProxy(layerTreeHost)).PassAs<Proxy>() ;
22 } 22 }
23 23
24 CCSingleThreadProxy::CCSingleThreadProxy(CCLayerTreeHost* layerTreeHost) 24 SingleThreadProxy::SingleThreadProxy(LayerTreeHost* layerTreeHost)
25 : m_layerTreeHost(layerTreeHost) 25 : m_layerTreeHost(layerTreeHost)
26 , m_contextLost(false) 26 , m_contextLost(false)
27 , m_rendererInitialized(false) 27 , m_rendererInitialized(false)
28 , m_nextFrameIsNewlyCommittedFrame(false) 28 , m_nextFrameIsNewlyCommittedFrame(false)
29 , m_totalCommitCount(0) 29 , m_totalCommitCount(0)
30 { 30 {
31 TRACE_EVENT0("cc", "CCSingleThreadProxy::CCSingleThreadProxy"); 31 TRACE_EVENT0("cc", "SingleThreadProxy::SingleThreadProxy");
32 ASSERT(CCProxy::isMainThread()); 32 ASSERT(Proxy::isMainThread());
33 } 33 }
34 34
35 void CCSingleThreadProxy::start() 35 void SingleThreadProxy::start()
36 { 36 {
37 DebugScopedSetImplThread impl; 37 DebugScopedSetImplThread impl;
38 m_layerTreeHostImpl = m_layerTreeHost->createLayerTreeHostImpl(this); 38 m_layerTreeHostImpl = m_layerTreeHost->createLayerTreeHostImpl(this);
39 } 39 }
40 40
41 CCSingleThreadProxy::~CCSingleThreadProxy() 41 SingleThreadProxy::~SingleThreadProxy()
42 { 42 {
43 TRACE_EVENT0("cc", "CCSingleThreadProxy::~CCSingleThreadProxy"); 43 TRACE_EVENT0("cc", "SingleThreadProxy::~SingleThreadProxy");
44 ASSERT(CCProxy::isMainThread()); 44 ASSERT(Proxy::isMainThread());
45 ASSERT(!m_layerTreeHostImpl.get() && !m_layerTreeHost); // make sure stop() got called. 45 ASSERT(!m_layerTreeHostImpl.get() && !m_layerTreeHost); // make sure stop() got called.
46 } 46 }
47 47
48 bool CCSingleThreadProxy::compositeAndReadback(void *pixels, const IntRect& rect ) 48 bool SingleThreadProxy::compositeAndReadback(void *pixels, const IntRect& rect)
49 { 49 {
50 TRACE_EVENT0("cc", "CCSingleThreadProxy::compositeAndReadback"); 50 TRACE_EVENT0("cc", "SingleThreadProxy::compositeAndReadback");
51 ASSERT(CCProxy::isMainThread()); 51 ASSERT(Proxy::isMainThread());
52 52
53 if (!commitAndComposite()) 53 if (!commitAndComposite())
54 return false; 54 return false;
55 55
56 m_layerTreeHostImpl->readback(pixels, rect); 56 m_layerTreeHostImpl->readback(pixels, rect);
57 57
58 if (m_layerTreeHostImpl->isContextLost()) 58 if (m_layerTreeHostImpl->isContextLost())
59 return false; 59 return false;
60 60
61 m_layerTreeHostImpl->swapBuffers(); 61 m_layerTreeHostImpl->swapBuffers();
62 didSwapFrame(); 62 didSwapFrame();
63 63
64 return true; 64 return true;
65 } 65 }
66 66
67 void CCSingleThreadProxy::startPageScaleAnimation(const IntSize& targetPosition, bool useAnchor, float scale, double duration) 67 void SingleThreadProxy::startPageScaleAnimation(const IntSize& targetPosition, b ool useAnchor, float scale, double duration)
68 { 68 {
69 m_layerTreeHostImpl->startPageScaleAnimation(targetPosition, useAnchor, scal e, monotonicallyIncreasingTime(), duration); 69 m_layerTreeHostImpl->startPageScaleAnimation(targetPosition, useAnchor, scal e, monotonicallyIncreasingTime(), duration);
70 } 70 }
71 71
72 void CCSingleThreadProxy::finishAllRendering() 72 void SingleThreadProxy::finishAllRendering()
73 { 73 {
74 ASSERT(CCProxy::isMainThread()); 74 ASSERT(Proxy::isMainThread());
75 { 75 {
76 DebugScopedSetImplThread impl; 76 DebugScopedSetImplThread impl;
77 m_layerTreeHostImpl->finishAllRendering(); 77 m_layerTreeHostImpl->finishAllRendering();
78 } 78 }
79 } 79 }
80 80
81 bool CCSingleThreadProxy::isStarted() const 81 bool SingleThreadProxy::isStarted() const
82 { 82 {
83 ASSERT(CCProxy::isMainThread()); 83 ASSERT(Proxy::isMainThread());
84 return m_layerTreeHostImpl.get(); 84 return m_layerTreeHostImpl.get();
85 } 85 }
86 86
87 bool CCSingleThreadProxy::initializeContext() 87 bool SingleThreadProxy::initializeContext()
88 { 88 {
89 ASSERT(CCProxy::isMainThread()); 89 ASSERT(Proxy::isMainThread());
90 scoped_ptr<CCGraphicsContext> context = m_layerTreeHost->createContext(); 90 scoped_ptr<GraphicsContext> context = m_layerTreeHost->createContext();
91 if (!context.get()) 91 if (!context.get())
92 return false; 92 return false;
93 m_contextBeforeInitialization = context.Pass(); 93 m_contextBeforeInitialization = context.Pass();
94 return true; 94 return true;
95 } 95 }
96 96
97 void CCSingleThreadProxy::setSurfaceReady() 97 void SingleThreadProxy::setSurfaceReady()
98 { 98 {
99 // Scheduling is controlled by the embedder in the single thread case, so no thing to do. 99 // Scheduling is controlled by the embedder in the single thread case, so no thing to do.
100 } 100 }
101 101
102 void CCSingleThreadProxy::setVisible(bool visible) 102 void SingleThreadProxy::setVisible(bool visible)
103 { 103 {
104 DebugScopedSetImplThread impl; 104 DebugScopedSetImplThread impl;
105 m_layerTreeHostImpl->setVisible(visible); 105 m_layerTreeHostImpl->setVisible(visible);
106 } 106 }
107 107
108 bool CCSingleThreadProxy::initializeRenderer() 108 bool SingleThreadProxy::initializeRenderer()
109 { 109 {
110 ASSERT(CCProxy::isMainThread()); 110 ASSERT(Proxy::isMainThread());
111 ASSERT(m_contextBeforeInitialization.get()); 111 ASSERT(m_contextBeforeInitialization.get());
112 { 112 {
113 DebugScopedSetImplThread impl; 113 DebugScopedSetImplThread impl;
114 bool ok = m_layerTreeHostImpl->initializeRenderer(m_contextBeforeInitial ization.Pass()); 114 bool ok = m_layerTreeHostImpl->initializeRenderer(m_contextBeforeInitial ization.Pass());
115 if (ok) { 115 if (ok) {
116 m_rendererInitialized = true; 116 m_rendererInitialized = true;
117 m_RendererCapabilitiesForMainThread = m_layerTreeHostImpl->rendererC apabilities(); 117 m_RendererCapabilitiesForMainThread = m_layerTreeHostImpl->rendererC apabilities();
118 } 118 }
119 119
120 return ok; 120 return ok;
121 } 121 }
122 } 122 }
123 123
124 bool CCSingleThreadProxy::recreateContext() 124 bool SingleThreadProxy::recreateContext()
125 { 125 {
126 TRACE_EVENT0("cc", "CCSingleThreadProxy::recreateContext"); 126 TRACE_EVENT0("cc", "SingleThreadProxy::recreateContext");
127 ASSERT(CCProxy::isMainThread()); 127 ASSERT(Proxy::isMainThread());
128 ASSERT(m_contextLost); 128 ASSERT(m_contextLost);
129 129
130 scoped_ptr<CCGraphicsContext> context = m_layerTreeHost->createContext(); 130 scoped_ptr<GraphicsContext> context = m_layerTreeHost->createContext();
131 if (!context.get()) 131 if (!context.get())
132 return false; 132 return false;
133 133
134 bool initialized; 134 bool initialized;
135 { 135 {
136 DebugScopedSetMainThreadBlocked mainThreadBlocked; 136 DebugScopedSetMainThreadBlocked mainThreadBlocked;
137 DebugScopedSetImplThread impl; 137 DebugScopedSetImplThread impl;
138 if (!m_layerTreeHostImpl->contentsTexturesPurged()) 138 if (!m_layerTreeHostImpl->contentsTexturesPurged())
139 m_layerTreeHost->deleteContentsTexturesOnImplThread(m_layerTreeHostI mpl->resourceProvider()); 139 m_layerTreeHost->deleteContentsTexturesOnImplThread(m_layerTreeHostI mpl->resourceProvider());
140 initialized = m_layerTreeHostImpl->initializeRenderer(context.Pass()); 140 initialized = m_layerTreeHostImpl->initializeRenderer(context.Pass());
141 if (initialized) { 141 if (initialized) {
142 m_RendererCapabilitiesForMainThread = m_layerTreeHostImpl->rendererC apabilities(); 142 m_RendererCapabilitiesForMainThread = m_layerTreeHostImpl->rendererC apabilities();
143 } 143 }
144 } 144 }
145 145
146 if (initialized) 146 if (initialized)
147 m_contextLost = false; 147 m_contextLost = false;
148 148
149 return initialized; 149 return initialized;
150 } 150 }
151 151
152 void CCSingleThreadProxy::renderingStats(CCRenderingStats* stats) 152 void SingleThreadProxy::renderingStats(RenderingStats* stats)
153 { 153 {
154 stats->totalCommitTimeInSeconds = m_totalCommitTime.InSecondsF(); 154 stats->totalCommitTimeInSeconds = m_totalCommitTime.InSecondsF();
155 stats->totalCommitCount = m_totalCommitCount; 155 stats->totalCommitCount = m_totalCommitCount;
156 m_layerTreeHostImpl->renderingStats(stats); 156 m_layerTreeHostImpl->renderingStats(stats);
157 } 157 }
158 158
159 const RendererCapabilities& CCSingleThreadProxy::rendererCapabilities() const 159 const RendererCapabilities& SingleThreadProxy::rendererCapabilities() const
160 { 160 {
161 ASSERT(m_rendererInitialized); 161 ASSERT(m_rendererInitialized);
162 // Note: this gets called during the commit by the "impl" thread 162 // Note: this gets called during the commit by the "impl" thread
163 return m_RendererCapabilitiesForMainThread; 163 return m_RendererCapabilitiesForMainThread;
164 } 164 }
165 165
166 void CCSingleThreadProxy::loseContext() 166 void SingleThreadProxy::loseContext()
167 { 167 {
168 ASSERT(CCProxy::isMainThread()); 168 ASSERT(Proxy::isMainThread());
169 m_layerTreeHost->didLoseContext(); 169 m_layerTreeHost->didLoseContext();
170 m_contextLost = true; 170 m_contextLost = true;
171 } 171 }
172 172
173 void CCSingleThreadProxy::setNeedsAnimate() 173 void SingleThreadProxy::setNeedsAnimate()
174 { 174 {
175 // CCThread-only feature 175 // Thread-only feature
176 ASSERT_NOT_REACHED(); 176 ASSERT_NOT_REACHED();
177 } 177 }
178 178
179 void CCSingleThreadProxy::doCommit(scoped_ptr<CCTextureUpdateQueue> queue) 179 void SingleThreadProxy::doCommit(scoped_ptr<TextureUpdateQueue> queue)
180 { 180 {
181 ASSERT(CCProxy::isMainThread()); 181 ASSERT(Proxy::isMainThread());
182 // Commit immediately 182 // Commit immediately
183 { 183 {
184 DebugScopedSetMainThreadBlocked mainThreadBlocked; 184 DebugScopedSetMainThreadBlocked mainThreadBlocked;
185 DebugScopedSetImplThread impl; 185 DebugScopedSetImplThread impl;
186 186
187 base::TimeTicks startTime = base::TimeTicks::HighResNow(); 187 base::TimeTicks startTime = base::TimeTicks::HighResNow();
188 m_layerTreeHostImpl->beginCommit(); 188 m_layerTreeHostImpl->beginCommit();
189 189
190 m_layerTreeHost->contentsTextureManager()->pushTexturePrioritiesToBackin gs(); 190 m_layerTreeHost->contentsTextureManager()->pushTexturePrioritiesToBackin gs();
191 m_layerTreeHost->beginCommitOnImplThread(m_layerTreeHostImpl.get()); 191 m_layerTreeHost->beginCommitOnImplThread(m_layerTreeHostImpl.get());
192 192
193 scoped_ptr<CCTextureUpdateController> updateController = 193 scoped_ptr<TextureUpdateController> updateController =
194 CCTextureUpdateController::create( 194 TextureUpdateController::create(
195 NULL, 195 NULL,
196 CCProxy::mainThread(), 196 Proxy::mainThread(),
197 queue.Pass(), 197 queue.Pass(),
198 m_layerTreeHostImpl->resourceProvider(), 198 m_layerTreeHostImpl->resourceProvider(),
199 m_layerTreeHostImpl->resourceProvider()->textureUploader()); 199 m_layerTreeHostImpl->resourceProvider()->textureUploader());
200 updateController->finalize(); 200 updateController->finalize();
201 201
202 m_layerTreeHost->finishCommitOnImplThread(m_layerTreeHostImpl.get()); 202 m_layerTreeHost->finishCommitOnImplThread(m_layerTreeHostImpl.get());
203 203
204 m_layerTreeHostImpl->commitComplete(); 204 m_layerTreeHostImpl->commitComplete();
205 205
206 #if !ASSERT_DISABLED 206 #if !ASSERT_DISABLED
207 // In the single-threaded case, the scroll deltas should never be 207 // In the single-threaded case, the scroll deltas should never be
208 // touched on the impl layer tree. 208 // touched on the impl layer tree.
209 scoped_ptr<CCScrollAndScaleSet> scrollInfo = m_layerTreeHostImpl->proces sScrollDeltas(); 209 scoped_ptr<ScrollAndScaleSet> scrollInfo = m_layerTreeHostImpl->processS crollDeltas();
210 ASSERT(!scrollInfo->scrolls.size()); 210 ASSERT(!scrollInfo->scrolls.size());
211 #endif 211 #endif
212 212
213 base::TimeTicks endTime = base::TimeTicks::HighResNow(); 213 base::TimeTicks endTime = base::TimeTicks::HighResNow();
214 m_totalCommitTime += endTime - startTime; 214 m_totalCommitTime += endTime - startTime;
215 m_totalCommitCount++; 215 m_totalCommitCount++;
216 } 216 }
217 m_layerTreeHost->commitComplete(); 217 m_layerTreeHost->commitComplete();
218 m_nextFrameIsNewlyCommittedFrame = true; 218 m_nextFrameIsNewlyCommittedFrame = true;
219 } 219 }
220 220
221 void CCSingleThreadProxy::setNeedsCommit() 221 void SingleThreadProxy::setNeedsCommit()
222 { 222 {
223 ASSERT(CCProxy::isMainThread()); 223 ASSERT(Proxy::isMainThread());
224 m_layerTreeHost->scheduleComposite(); 224 m_layerTreeHost->scheduleComposite();
225 } 225 }
226 226
227 void CCSingleThreadProxy::setNeedsRedraw() 227 void SingleThreadProxy::setNeedsRedraw()
228 { 228 {
229 // FIXME: Once we move render_widget scheduling into this class, we can 229 // FIXME: Once we move render_widget scheduling into this class, we can
230 // treat redraw requests more efficiently than commitAndRedraw requests. 230 // treat redraw requests more efficiently than commitAndRedraw requests.
231 m_layerTreeHostImpl->setFullRootLayerDamage(); 231 m_layerTreeHostImpl->setFullRootLayerDamage();
232 setNeedsCommit(); 232 setNeedsCommit();
233 } 233 }
234 234
235 bool CCSingleThreadProxy::commitRequested() const 235 bool SingleThreadProxy::commitRequested() const
236 { 236 {
237 return false; 237 return false;
238 } 238 }
239 239
240 void CCSingleThreadProxy::didAddAnimation() 240 void SingleThreadProxy::didAddAnimation()
241 { 241 {
242 } 242 }
243 243
244 size_t CCSingleThreadProxy::maxPartialTextureUpdates() const 244 size_t SingleThreadProxy::maxPartialTextureUpdates() const
245 { 245 {
246 return std::numeric_limits<size_t>::max(); 246 return std::numeric_limits<size_t>::max();
247 } 247 }
248 248
249 void CCSingleThreadProxy::stop() 249 void SingleThreadProxy::stop()
250 { 250 {
251 TRACE_EVENT0("cc", "CCSingleThreadProxy::stop"); 251 TRACE_EVENT0("cc", "SingleThreadProxy::stop");
252 ASSERT(CCProxy::isMainThread()); 252 ASSERT(Proxy::isMainThread());
253 { 253 {
254 DebugScopedSetMainThreadBlocked mainThreadBlocked; 254 DebugScopedSetMainThreadBlocked mainThreadBlocked;
255 DebugScopedSetImplThread impl; 255 DebugScopedSetImplThread impl;
256 256
257 if (!m_layerTreeHostImpl->contentsTexturesPurged()) 257 if (!m_layerTreeHostImpl->contentsTexturesPurged())
258 m_layerTreeHost->deleteContentsTexturesOnImplThread(m_layerTreeHostI mpl->resourceProvider()); 258 m_layerTreeHost->deleteContentsTexturesOnImplThread(m_layerTreeHostI mpl->resourceProvider());
259 m_layerTreeHostImpl.reset(); 259 m_layerTreeHostImpl.reset();
260 } 260 }
261 m_layerTreeHost = 0; 261 m_layerTreeHost = 0;
262 } 262 }
263 263
264 void CCSingleThreadProxy::setNeedsRedrawOnImplThread() 264 void SingleThreadProxy::setNeedsRedrawOnImplThread()
265 { 265 {
266 m_layerTreeHost->scheduleComposite(); 266 m_layerTreeHost->scheduleComposite();
267 } 267 }
268 268
269 void CCSingleThreadProxy::setNeedsCommitOnImplThread() 269 void SingleThreadProxy::setNeedsCommitOnImplThread()
270 { 270 {
271 m_layerTreeHost->scheduleComposite(); 271 m_layerTreeHost->scheduleComposite();
272 } 272 }
273 273
274 void CCSingleThreadProxy::postAnimationEventsToMainThreadOnImplThread(scoped_ptr <CCAnimationEventsVector> events, double wallClockTime) 274 void SingleThreadProxy::postAnimationEventsToMainThreadOnImplThread(scoped_ptr<A nimationEventsVector> events, double wallClockTime)
275 { 275 {
276 ASSERT(CCProxy::isImplThread()); 276 ASSERT(Proxy::isImplThread());
277 DebugScopedSetMainThread main; 277 DebugScopedSetMainThread main;
278 m_layerTreeHost->setAnimationEvents(events.Pass(), wallClockTime); 278 m_layerTreeHost->setAnimationEvents(events.Pass(), wallClockTime);
279 } 279 }
280 280
281 bool CCSingleThreadProxy::reduceContentsTextureMemoryOnImplThread(size_t limitBy tes) 281 bool SingleThreadProxy::reduceContentsTextureMemoryOnImplThread(size_t limitByte s)
282 { 282 {
283 ASSERT(isImplThread()); 283 ASSERT(isImplThread());
284 if (!m_layerTreeHost->contentsTextureManager()) 284 if (!m_layerTreeHost->contentsTextureManager())
285 return false; 285 return false;
286 286
287 return m_layerTreeHost->contentsTextureManager()->reduceMemoryOnImplThread(l imitBytes, m_layerTreeHostImpl->resourceProvider()); 287 return m_layerTreeHost->contentsTextureManager()->reduceMemoryOnImplThread(l imitBytes, m_layerTreeHostImpl->resourceProvider());
288 } 288 }
289 289
290 // Called by the legacy scheduling path (e.g. where render_widget does the sched uling) 290 // Called by the legacy scheduling path (e.g. where render_widget does the sched uling)
291 void CCSingleThreadProxy::compositeImmediately() 291 void SingleThreadProxy::compositeImmediately()
292 { 292 {
293 if (commitAndComposite()) { 293 if (commitAndComposite()) {
294 m_layerTreeHostImpl->swapBuffers(); 294 m_layerTreeHostImpl->swapBuffers();
295 didSwapFrame(); 295 didSwapFrame();
296 } 296 }
297 } 297 }
298 298
299 void CCSingleThreadProxy::forceSerializeOnSwapBuffers() 299 void SingleThreadProxy::forceSerializeOnSwapBuffers()
300 { 300 {
301 { 301 {
302 DebugScopedSetImplThread impl; 302 DebugScopedSetImplThread impl;
303 if (m_rendererInitialized) 303 if (m_rendererInitialized)
304 m_layerTreeHostImpl->renderer()->doNoOp(); 304 m_layerTreeHostImpl->renderer()->doNoOp();
305 } 305 }
306 } 306 }
307 307
308 void CCSingleThreadProxy::onSwapBuffersCompleteOnImplThread() 308 void SingleThreadProxy::onSwapBuffersCompleteOnImplThread()
309 { 309 {
310 ASSERT_NOT_REACHED(); 310 ASSERT_NOT_REACHED();
311 } 311 }
312 312
313 bool CCSingleThreadProxy::commitAndComposite() 313 bool SingleThreadProxy::commitAndComposite()
314 { 314 {
315 ASSERT(CCProxy::isMainThread()); 315 ASSERT(Proxy::isMainThread());
316 316
317 if (!m_layerTreeHost->initializeRendererIfNeeded()) 317 if (!m_layerTreeHost->initializeRendererIfNeeded())
318 return false; 318 return false;
319 319
320 // Unlink any texture backings that were deleted 320 // Unlink any texture backings that were deleted
321 CCPrioritizedTextureManager::BackingList evictedContentsTexturesBackings; 321 PrioritizedTextureManager::BackingList evictedContentsTexturesBackings;
322 { 322 {
323 DebugScopedSetImplThread implThread; 323 DebugScopedSetImplThread implThread;
324 m_layerTreeHost->contentsTextureManager()->getEvictedBackings(evictedCon tentsTexturesBackings); 324 m_layerTreeHost->contentsTextureManager()->getEvictedBackings(evictedCon tentsTexturesBackings);
325 } 325 }
326 m_layerTreeHost->contentsTextureManager()->unlinkEvictedBackings(evictedCont entsTexturesBackings); 326 m_layerTreeHost->contentsTextureManager()->unlinkEvictedBackings(evictedCont entsTexturesBackings);
327 327
328 scoped_ptr<CCTextureUpdateQueue> queue = make_scoped_ptr(new CCTextureUpdate Queue); 328 scoped_ptr<TextureUpdateQueue> queue = make_scoped_ptr(new TextureUpdateQueu e);
329 m_layerTreeHost->updateLayers(*(queue.get()), m_layerTreeHostImpl->memoryAll ocationLimitBytes()); 329 m_layerTreeHost->updateLayers(*(queue.get()), m_layerTreeHostImpl->memoryAll ocationLimitBytes());
330 330
331 if (m_layerTreeHostImpl->contentsTexturesPurged()) 331 if (m_layerTreeHostImpl->contentsTexturesPurged())
332 m_layerTreeHostImpl->resetContentsTexturesPurged(); 332 m_layerTreeHostImpl->resetContentsTexturesPurged();
333 333
334 m_layerTreeHost->willCommit(); 334 m_layerTreeHost->willCommit();
335 doCommit(queue.Pass()); 335 doCommit(queue.Pass());
336 bool result = doComposite(); 336 bool result = doComposite();
337 m_layerTreeHost->didBeginFrame(); 337 m_layerTreeHost->didBeginFrame();
338 return result; 338 return result;
339 } 339 }
340 340
341 bool CCSingleThreadProxy::doComposite() 341 bool SingleThreadProxy::doComposite()
342 { 342 {
343 ASSERT(!m_contextLost); 343 ASSERT(!m_contextLost);
344 { 344 {
345 DebugScopedSetImplThread impl; 345 DebugScopedSetImplThread impl;
346 346
347 if (!m_layerTreeHostImpl->visible()) 347 if (!m_layerTreeHostImpl->visible())
348 return false; 348 return false;
349 349
350 double monotonicTime = monotonicallyIncreasingTime(); 350 double monotonicTime = monotonicallyIncreasingTime();
351 double wallClockTime = currentTime(); 351 double wallClockTime = currentTime();
352 m_layerTreeHostImpl->animate(monotonicTime, wallClockTime); 352 m_layerTreeHostImpl->animate(monotonicTime, wallClockTime);
353 353
354 // We guard prepareToDraw() with canDraw() because it always returns a v alid frame, so can only 354 // We guard prepareToDraw() with canDraw() because it always returns a v alid frame, so can only
355 // be used when such a frame is possible. Since drawLayers() depends on the result of 355 // be used when such a frame is possible. Since drawLayers() depends on the result of
356 // prepareToDraw(), it is guarded on canDraw() as well. 356 // prepareToDraw(), it is guarded on canDraw() as well.
357 if (!m_layerTreeHostImpl->canDraw()) 357 if (!m_layerTreeHostImpl->canDraw())
358 return false; 358 return false;
359 359
360 CCLayerTreeHostImpl::FrameData frame; 360 LayerTreeHostImpl::FrameData frame;
361 m_layerTreeHostImpl->prepareToDraw(frame); 361 m_layerTreeHostImpl->prepareToDraw(frame);
362 m_layerTreeHostImpl->drawLayers(frame); 362 m_layerTreeHostImpl->drawLayers(frame);
363 m_layerTreeHostImpl->didDrawAllLayers(frame); 363 m_layerTreeHostImpl->didDrawAllLayers(frame);
364 } 364 }
365 365
366 if (m_layerTreeHostImpl->isContextLost()) { 366 if (m_layerTreeHostImpl->isContextLost()) {
367 m_contextLost = true; 367 m_contextLost = true;
368 m_layerTreeHost->didLoseContext(); 368 m_layerTreeHost->didLoseContext();
369 return false; 369 return false;
370 } 370 }
371 371
372 return true; 372 return true;
373 } 373 }
374 374
375 void CCSingleThreadProxy::didSwapFrame() 375 void SingleThreadProxy::didSwapFrame()
376 { 376 {
377 if (m_nextFrameIsNewlyCommittedFrame) { 377 if (m_nextFrameIsNewlyCommittedFrame) {
378 m_nextFrameIsNewlyCommittedFrame = false; 378 m_nextFrameIsNewlyCommittedFrame = false;
379 m_layerTreeHost->didCommitAndDrawFrame(); 379 m_layerTreeHost->didCommitAndDrawFrame();
380 } 380 }
381 } 381 }
382 382
383 } 383 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698