| 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 DebugScopedSetImplThread impl; | 105 DebugScopedSetImplThread impl; |
| 106 m_layerTreeHostImpl->setVisible(visible); | 106 m_layerTreeHostImpl->setVisible(visible); |
| 107 } | 107 } |
| 108 | 108 |
| 109 bool CCSingleThreadProxy::initializeRenderer() | 109 bool CCSingleThreadProxy::initializeRenderer() |
| 110 { | 110 { |
| 111 ASSERT(CCProxy::isMainThread()); | 111 ASSERT(CCProxy::isMainThread()); |
| 112 ASSERT(m_contextBeforeInitialization); | 112 ASSERT(m_contextBeforeInitialization); |
| 113 { | 113 { |
| 114 DebugScopedSetImplThread impl; | 114 DebugScopedSetImplThread impl; |
| 115 bool ok = m_layerTreeHostImpl->initializeRenderer(m_contextBeforeInitial
ization.release(), UnthrottledUploader); | 115 bool ok = m_layerTreeHostImpl->initializeRenderer(m_contextBeforeInitial
ization.release()); |
| 116 if (ok) { | 116 if (ok) { |
| 117 m_rendererInitialized = true; | 117 m_rendererInitialized = true; |
| 118 m_RendererCapabilitiesForMainThread = m_layerTreeHostImpl->rendererC
apabilities(); | 118 m_RendererCapabilitiesForMainThread = m_layerTreeHostImpl->rendererC
apabilities(); |
| 119 } | 119 } |
| 120 | 120 |
| 121 return ok; | 121 return ok; |
| 122 } | 122 } |
| 123 } | 123 } |
| 124 | 124 |
| 125 bool CCSingleThreadProxy::recreateContext() | 125 bool CCSingleThreadProxy::recreateContext() |
| 126 { | 126 { |
| 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 DebugScopedSetMainThreadBlocked mainThreadBlocked; |
| 138 DebugScopedSetImplThread impl; | 138 DebugScopedSetImplThread impl; |
| 139 if (!m_layerTreeHostImpl->contentsTexturesPurged()) | 139 if (!m_layerTreeHostImpl->contentsTexturesPurged()) |
| 140 m_layerTreeHost->deleteContentsTexturesOnImplThread(m_layerTreeHostI
mpl->resourceProvider()); | 140 m_layerTreeHost->deleteContentsTexturesOnImplThread(m_layerTreeHostI
mpl->resourceProvider()); |
| 141 initialized = m_layerTreeHostImpl->initializeRenderer(context.release(),
UnthrottledUploader); | 141 initialized = m_layerTreeHostImpl->initializeRenderer(context.release())
; |
| 142 if (initialized) { | 142 if (initialized) { |
| 143 m_RendererCapabilitiesForMainThread = m_layerTreeHostImpl->rendererC
apabilities(); | 143 m_RendererCapabilitiesForMainThread = m_layerTreeHostImpl->rendererC
apabilities(); |
| 144 } | 144 } |
| 145 } | 145 } |
| 146 | 146 |
| 147 if (initialized) | 147 if (initialized) |
| 148 m_contextLost = false; | 148 m_contextLost = false; |
| 149 | 149 |
| 150 return initialized; | 150 return initialized; |
| 151 } | 151 } |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 | 368 |
| 369 void CCSingleThreadProxy::didSwapFrame() | 369 void CCSingleThreadProxy::didSwapFrame() |
| 370 { | 370 { |
| 371 if (m_nextFrameIsNewlyCommittedFrame) { | 371 if (m_nextFrameIsNewlyCommittedFrame) { |
| 372 m_nextFrameIsNewlyCommittedFrame = false; | 372 m_nextFrameIsNewlyCommittedFrame = false; |
| 373 m_layerTreeHost->didCommitAndDrawFrame(); | 373 m_layerTreeHost->didCommitAndDrawFrame(); |
| 374 } | 374 } |
| 375 } | 375 } |
| 376 | 376 |
| 377 } | 377 } |
| OLD | NEW |