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 #include "config.h" | 5 #include "config.h" |
6 | 6 |
7 #include "cc/layer_tree_host.h" | 7 #include "cc/layer_tree_host.h" |
8 | 8 |
9 #include "CCFontAtlas.h" | 9 #include "CCFontAtlas.h" |
10 #include "CCGraphicsContext.h" | 10 #include "CCGraphicsContext.h" |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
103 , m_settings(settings) | 103 , m_settings(settings) |
104 , m_deviceScaleFactor(1) | 104 , m_deviceScaleFactor(1) |
105 , m_visible(true) | 105 , m_visible(true) |
106 , m_pageScaleFactor(1) | 106 , m_pageScaleFactor(1) |
107 , m_minPageScaleFactor(1) | 107 , m_minPageScaleFactor(1) |
108 , m_maxPageScaleFactor(1) | 108 , m_maxPageScaleFactor(1) |
109 , m_triggerIdleUpdates(true) | 109 , m_triggerIdleUpdates(true) |
110 , m_backgroundColor(SK_ColorWHITE) | 110 , m_backgroundColor(SK_ColorWHITE) |
111 , m_hasTransparentBackground(false) | 111 , m_hasTransparentBackground(false) |
112 , m_partialTextureUpdateRequests(0) | 112 , m_partialTextureUpdateRequests(0) |
113 , m_deferCommits(false) | |
jamesr
2012/10/23 17:50:44
There's no reason to shadow state here on LayerTre
jonathan.backer
2012/10/23 19:26:42
Done.
| |
113 { | 114 { |
114 DCHECK(Proxy::isMainThread()); | 115 DCHECK(Proxy::isMainThread()); |
115 numLayerTreeInstances++; | 116 numLayerTreeInstances++; |
116 } | 117 } |
117 | 118 |
118 bool LayerTreeHost::initialize() | 119 bool LayerTreeHost::initialize() |
119 { | 120 { |
120 TRACE_EVENT0("cc", "LayerTreeHost::initialize"); | 121 TRACE_EVENT0("cc", "LayerTreeHost::initialize"); |
121 | 122 |
122 if (Proxy::hasImplThread()) | 123 if (Proxy::hasImplThread()) |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
323 { | 324 { |
324 TRACE_EVENT0("cc", "LayerTreeHost::didLoseContext"); | 325 TRACE_EVENT0("cc", "LayerTreeHost::didLoseContext"); |
325 DCHECK(Proxy::isMainThread()); | 326 DCHECK(Proxy::isMainThread()); |
326 m_contextLost = true; | 327 m_contextLost = true; |
327 m_numFailedRecreateAttempts = 0; | 328 m_numFailedRecreateAttempts = 0; |
328 setNeedsCommit(); | 329 setNeedsCommit(); |
329 } | 330 } |
330 | 331 |
331 bool LayerTreeHost::compositeAndReadback(void *pixels, const IntRect& rect) | 332 bool LayerTreeHost::compositeAndReadback(void *pixels, const IntRect& rect) |
332 { | 333 { |
334 // Clear any pending commits. | |
335 setDeferCommits(false); | |
jamesr
2012/10/23 17:50:44
This doesn't look right at all - what this will do
jonathan.backer
2012/10/23 19:26:42
We're more than happy to bail out of non-deferred
| |
336 | |
333 m_triggerIdleUpdates = false; | 337 m_triggerIdleUpdates = false; |
334 bool ret = m_proxy->compositeAndReadback(pixels, rect); | 338 bool ret = m_proxy->compositeAndReadback(pixels, rect); |
335 m_triggerIdleUpdates = true; | 339 m_triggerIdleUpdates = true; |
336 return ret; | 340 return ret; |
337 } | 341 } |
338 | 342 |
339 void LayerTreeHost::finishAllRendering() | 343 void LayerTreeHost::finishAllRendering() |
340 { | 344 { |
341 if (!m_rendererInitialized) | 345 if (!m_rendererInitialized) |
342 return; | 346 return; |
347 | |
348 // Clear any pending commits. | |
349 setDeferCommits(false); | |
jamesr
2012/10/23 17:50:44
There are the same sorts of problems here as with
jonathan.backer
2012/10/23 19:26:42
'git gs' says no. Just doing it for completeness.
| |
350 | |
343 m_proxy->finishAllRendering(); | 351 m_proxy->finishAllRendering(); |
344 } | 352 } |
345 | 353 |
354 void LayerTreeHost::setDeferCommits(bool deferCommits) | |
355 { | |
356 if (m_deferCommits == deferCommits) | |
357 return; | |
358 m_deferCommits = deferCommits; | |
359 | |
360 if (deferCommits) | |
361 TRACE_EVENT_ASYNC_BEGIN0("cc", "LayerTreeHost::setDeferCommits", this); | |
362 else | |
363 TRACE_EVENT_ASYNC_END0("cc", "LayerTreeHost::setDeferCommits", this); | |
364 | |
365 m_proxy->setDeferCommits(deferCommits); | |
366 } | |
367 | |
346 void LayerTreeHost::renderingStats(RenderingStats* stats) const | 368 void LayerTreeHost::renderingStats(RenderingStats* stats) const |
347 { | 369 { |
348 *stats = m_renderingStats; | 370 *stats = m_renderingStats; |
349 m_proxy->renderingStats(stats); | 371 m_proxy->renderingStats(stats); |
350 } | 372 } |
351 | 373 |
352 const RendererCapabilities& LayerTreeHost::rendererCapabilities() const | 374 const RendererCapabilities& LayerTreeHost::rendererCapabilities() const |
353 { | 375 { |
354 return m_proxy->rendererCapabilities(); | 376 return m_proxy->rendererCapabilities(); |
355 } | 377 } |
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
817 else | 839 else |
818 layer->notifyAnimationFinished(wallClockTime); | 840 layer->notifyAnimationFinished(wallClockTime); |
819 } | 841 } |
820 } | 842 } |
821 | 843 |
822 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn dex) | 844 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn dex) |
823 setAnimationEventsRecursive(events, layer->children()[childIndex].get(), wallClockTime); | 845 setAnimationEventsRecursive(events, layer->children()[childIndex].get(), wallClockTime); |
824 } | 846 } |
825 | 847 |
826 } // namespace cc | 848 } // namespace cc |
OLD | NEW |