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 "CCSingleThreadProxy.h" | 7 #include "CCSingleThreadProxy.h" |
8 | 8 |
9 #include "CCDrawQuad.h" | 9 #include "CCDrawQuad.h" |
10 #include "CCGraphicsContext.h" | 10 #include "CCGraphicsContext.h" |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 TRACE_EVENT0("cc", "CCSingleThreadProxy::recreateContext"); | 127 TRACE_EVENT0("cc", "CCSingleThreadProxy::recreateContext"); |
128 ASSERT(CCProxy::isMainThread()); | 128 ASSERT(CCProxy::isMainThread()); |
129 ASSERT(m_contextLost); | 129 ASSERT(m_contextLost); |
130 | 130 |
131 OwnPtr<CCGraphicsContext> context = m_layerTreeHost->createContext(); | 131 OwnPtr<CCGraphicsContext> context = m_layerTreeHost->createContext(); |
132 if (!context) | 132 if (!context) |
133 return false; | 133 return false; |
134 | 134 |
135 bool initialized; | 135 bool initialized; |
136 { | 136 { |
| 137 DebugScopedSetMainThreadBlocked mainThreadBlocked; |
137 DebugScopedSetImplThread impl; | 138 DebugScopedSetImplThread impl; |
138 if (!m_layerTreeHostImpl->contentsTexturesPurged()) | 139 if (!m_layerTreeHostImpl->contentsTexturesPurged()) |
139 m_layerTreeHost->deleteContentsTexturesOnImplThread(m_layerTreeHostI
mpl->resourceProvider()); | 140 m_layerTreeHost->deleteContentsTexturesOnImplThread(m_layerTreeHostI
mpl->resourceProvider()); |
140 initialized = m_layerTreeHostImpl->initializeRenderer(context.release(),
UnthrottledUploader); | 141 initialized = m_layerTreeHostImpl->initializeRenderer(context.release(),
UnthrottledUploader); |
141 if (initialized) { | 142 if (initialized) { |
142 m_RendererCapabilitiesForMainThread = m_layerTreeHostImpl->rendererC
apabilities(); | 143 m_RendererCapabilitiesForMainThread = m_layerTreeHostImpl->rendererC
apabilities(); |
143 } | 144 } |
144 } | 145 } |
145 | 146 |
146 if (initialized) | 147 if (initialized) |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 DebugScopedSetImplThread impl; | 270 DebugScopedSetImplThread impl; |
270 if (m_rendererInitialized) | 271 if (m_rendererInitialized) |
271 m_layerTreeHostImpl->renderer()->doNoOp(); | 272 m_layerTreeHostImpl->renderer()->doNoOp(); |
272 } | 273 } |
273 } | 274 } |
274 | 275 |
275 bool CCSingleThreadProxy::commitAndComposite() | 276 bool CCSingleThreadProxy::commitAndComposite() |
276 { | 277 { |
277 ASSERT(CCProxy::isMainThread()); | 278 ASSERT(CCProxy::isMainThread()); |
278 | 279 |
279 | |
280 if (!m_layerTreeHost->initializeRendererIfNeeded()) | 280 if (!m_layerTreeHost->initializeRendererIfNeeded()) |
281 return false; | 281 return false; |
282 | 282 |
283 if (m_layerTreeHostImpl->contentsTexturesPurged()) | 283 if (m_layerTreeHostImpl->contentsTexturesPurged()) { |
284 m_layerTreeHost->evictAllContentTextures(); | 284 m_layerTreeHost->unlinkAllContentTextures(); |
| 285 DebugScopedSetImplThreadAndMainThreadBlocked implAndMainBlocked; |
| 286 m_layerTreeHost->deleteUnlinkedTextures(); |
| 287 } |
285 | 288 |
286 CCTextureUpdateQueue queue; | 289 CCTextureUpdateQueue queue; |
287 m_layerTreeHost->updateLayers(queue, m_layerTreeHostImpl->memoryAllocationLi
mitBytes()); | 290 m_layerTreeHost->updateLayers(queue, m_layerTreeHostImpl->memoryAllocationLi
mitBytes()); |
288 m_layerTreeHostImpl->resetContentsTexturesPurged(); | 291 m_layerTreeHostImpl->resetContentsTexturesPurged(); |
289 | 292 |
290 m_layerTreeHost->willCommit(); | 293 m_layerTreeHost->willCommit(); |
291 doCommit(queue); | 294 doCommit(queue); |
292 bool result = doComposite(); | 295 bool result = doComposite(); |
293 m_layerTreeHost->didBeginFrame(); | 296 m_layerTreeHost->didBeginFrame(); |
294 return result; | 297 return result; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 | 333 |
331 void CCSingleThreadProxy::didSwapFrame() | 334 void CCSingleThreadProxy::didSwapFrame() |
332 { | 335 { |
333 if (m_nextFrameIsNewlyCommittedFrame) { | 336 if (m_nextFrameIsNewlyCommittedFrame) { |
334 m_nextFrameIsNewlyCommittedFrame = false; | 337 m_nextFrameIsNewlyCommittedFrame = false; |
335 m_layerTreeHost->didCommitAndDrawFrame(); | 338 m_layerTreeHost->didCommitAndDrawFrame(); |
336 } | 339 } |
337 } | 340 } |
338 | 341 |
339 } | 342 } |
OLD | NEW |