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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 | 115 |
116 CCLayerTreeHostImpl::CCLayerTreeHostImpl(const CCLayerTreeSettings& settings, CC
LayerTreeHostImplClient* client) | 116 CCLayerTreeHostImpl::CCLayerTreeHostImpl(const CCLayerTreeSettings& settings, CC
LayerTreeHostImplClient* client) |
117 : m_client(client) | 117 : m_client(client) |
118 , m_sourceFrameNumber(-1) | 118 , m_sourceFrameNumber(-1) |
119 , m_rootScrollLayerImpl(0) | 119 , m_rootScrollLayerImpl(0) |
120 , m_currentlyScrollingLayerImpl(0) | 120 , m_currentlyScrollingLayerImpl(0) |
121 , m_scrollingLayerIdFromPreviousTree(-1) | 121 , m_scrollingLayerIdFromPreviousTree(-1) |
122 , m_settings(settings) | 122 , m_settings(settings) |
123 , m_deviceScaleFactor(1) | 123 , m_deviceScaleFactor(1) |
124 , m_visible(true) | 124 , m_visible(true) |
125 , m_contentsTexturesWerePurgedSinceLastCommit(false) | 125 , m_contentsTexturesPurged(false) |
126 , m_memoryAllocationLimitBytes(CCPrioritizedTextureManager::defaultMemoryAll
ocationLimit()) | 126 , m_memoryAllocationLimitBytes(CCPrioritizedTextureManager::defaultMemoryAll
ocationLimit()) |
127 , m_pageScale(1) | 127 , m_pageScale(1) |
128 , m_pageScaleDelta(1) | 128 , m_pageScaleDelta(1) |
129 , m_sentPageScaleDelta(1) | 129 , m_sentPageScaleDelta(1) |
130 , m_minPageScale(0) | 130 , m_minPageScale(0) |
131 , m_maxPageScale(0) | 131 , m_maxPageScale(0) |
132 , m_backgroundColor(0) | 132 , m_backgroundColor(0) |
133 , m_hasTransparentBackground(false) | 133 , m_hasTransparentBackground(false) |
134 , m_needsAnimateLayers(false) | 134 , m_needsAnimateLayers(false) |
135 , m_pinchGestureActive(false) | 135 , m_pinchGestureActive(false) |
(...skipping 16 matching lines...) Expand all Loading... |
152 void CCLayerTreeHostImpl::beginCommit() | 152 void CCLayerTreeHostImpl::beginCommit() |
153 { | 153 { |
154 } | 154 } |
155 | 155 |
156 void CCLayerTreeHostImpl::commitComplete() | 156 void CCLayerTreeHostImpl::commitComplete() |
157 { | 157 { |
158 TRACE_EVENT0("cc", "CCLayerTreeHostImpl::commitComplete"); | 158 TRACE_EVENT0("cc", "CCLayerTreeHostImpl::commitComplete"); |
159 // Recompute max scroll position; must be after layer content bounds are | 159 // Recompute max scroll position; must be after layer content bounds are |
160 // updated. | 160 // updated. |
161 updateMaxScrollPosition(); | 161 updateMaxScrollPosition(); |
162 m_contentsTexturesWerePurgedSinceLastCommit = false; | |
163 } | 162 } |
164 | 163 |
165 bool CCLayerTreeHostImpl::canDraw() | 164 bool CCLayerTreeHostImpl::canDraw() |
166 { | 165 { |
167 if (!m_rootLayerImpl) { | 166 if (!m_rootLayerImpl) { |
168 TRACE_EVENT_INSTANT0("cc", "CCLayerTreeHostImpl::canDraw no root layer")
; | 167 TRACE_EVENT_INSTANT0("cc", "CCLayerTreeHostImpl::canDraw no root layer")
; |
169 return false; | 168 return false; |
170 } | 169 } |
171 if (deviceViewportSize().isEmpty()) { | 170 if (deviceViewportSize().isEmpty()) { |
172 TRACE_EVENT_INSTANT0("cc", "CCLayerTreeHostImpl::canDraw empty viewport"
); | 171 TRACE_EVENT_INSTANT0("cc", "CCLayerTreeHostImpl::canDraw empty viewport"
); |
173 return false; | 172 return false; |
174 } | 173 } |
175 if (!m_layerRenderer) { | 174 if (!m_layerRenderer) { |
176 TRACE_EVENT_INSTANT0("cc", "CCLayerTreeHostImpl::canDraw no layerRendere
r"); | 175 TRACE_EVENT_INSTANT0("cc", "CCLayerTreeHostImpl::canDraw no layerRendere
r"); |
177 return false; | 176 return false; |
178 } | 177 } |
179 if (m_contentsTexturesWerePurgedSinceLastCommit) { | 178 if (m_contentsTexturesPurged) { |
180 TRACE_EVENT_INSTANT0("cc", "CCLayerTreeHostImpl::canDraw contents textur
es purged"); | 179 TRACE_EVENT_INSTANT0("cc", "CCLayerTreeHostImpl::canDraw contents textur
es purged"); |
181 return false; | 180 return false; |
182 } | 181 } |
183 return true; | 182 return true; |
184 } | 183 } |
185 | 184 |
186 CCGraphicsContext* CCLayerTreeHostImpl::context() const | 185 CCGraphicsContext* CCLayerTreeHostImpl::context() const |
187 { | 186 { |
188 return m_context.get(); | 187 return m_context.get(); |
189 } | 188 } |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
512 | 511 |
513 if (!calculateRenderPasses(frame)) | 512 if (!calculateRenderPasses(frame)) |
514 return false; | 513 return false; |
515 | 514 |
516 // If we return true, then we expect drawLayers() to be called before this f
unction is called again. | 515 // If we return true, then we expect drawLayers() to be called before this f
unction is called again. |
517 return true; | 516 return true; |
518 } | 517 } |
519 | 518 |
520 void CCLayerTreeHostImpl::releaseContentsTextures() | 519 void CCLayerTreeHostImpl::releaseContentsTextures() |
521 { | 520 { |
| 521 if (m_contentsTexturesPurged) |
| 522 return; |
522 m_resourceProvider->deleteOwnedResources(CCRenderer::ContentPool); | 523 m_resourceProvider->deleteOwnedResources(CCRenderer::ContentPool); |
523 m_contentsTexturesWerePurgedSinceLastCommit = true; | 524 m_contentsTexturesPurged = true; |
524 m_client->setNeedsCommitOnImplThread(); | 525 m_client->setNeedsCommitOnImplThread(); |
525 } | 526 } |
526 | 527 |
527 void CCLayerTreeHostImpl::setMemoryAllocationLimitBytes(size_t bytes) | 528 void CCLayerTreeHostImpl::setMemoryAllocationLimitBytes(size_t bytes) |
528 { | 529 { |
529 if (m_memoryAllocationLimitBytes == bytes) | 530 if (m_memoryAllocationLimitBytes == bytes) |
530 return; | 531 return; |
531 m_memoryAllocationLimitBytes = bytes; | 532 m_memoryAllocationLimitBytes = bytes; |
532 | 533 |
533 ASSERT(bytes); | 534 ASSERT(bytes); |
(...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1198 | 1199 |
1199 CCScrollbarAnimationController* scrollbarController = layer->scrollbarAnimat
ionController(); | 1200 CCScrollbarAnimationController* scrollbarController = layer->scrollbarAnimat
ionController(); |
1200 if (scrollbarController && scrollbarController->animate(monotonicTime)) | 1201 if (scrollbarController && scrollbarController->animate(monotonicTime)) |
1201 m_client->setNeedsRedrawOnImplThread(); | 1202 m_client->setNeedsRedrawOnImplThread(); |
1202 | 1203 |
1203 for (size_t i = 0; i < layer->children().size(); ++i) | 1204 for (size_t i = 0; i < layer->children().size(); ++i) |
1204 animateScrollbarsRecursive(layer->children()[i].get(), monotonicTime); | 1205 animateScrollbarsRecursive(layer->children()[i].get(), monotonicTime); |
1205 } | 1206 } |
1206 | 1207 |
1207 } // namespace WebCore | 1208 } // namespace WebCore |
OLD | NEW |