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/single_thread_proxy.h" | 7 #include "cc/single_thread_proxy.h" |
8 | 8 |
9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "cc/draw_quad.h" | 10 #include "cc/draw_quad.h" |
11 #include "cc/graphics_context.h" | 11 #include "cc/graphics_context.h" |
12 #include "cc/layer_tree_host.h" | 12 #include "cc/layer_tree_host.h" |
13 #include "cc/texture_update_controller.h" | 13 #include "cc/resource_update_controller.h" |
14 #include "cc/timer.h" | 14 #include "cc/timer.h" |
15 #include <wtf/CurrentTime.h> | 15 #include <wtf/CurrentTime.h> |
16 | 16 |
17 namespace cc { | 17 namespace cc { |
18 | 18 |
19 scoped_ptr<Proxy> SingleThreadProxy::create(LayerTreeHost* layerTreeHost) | 19 scoped_ptr<Proxy> SingleThreadProxy::create(LayerTreeHost* layerTreeHost) |
20 { | 20 { |
21 return make_scoped_ptr(new SingleThreadProxy(layerTreeHost)).PassAs<Proxy>()
; | 21 return make_scoped_ptr(new SingleThreadProxy(layerTreeHost)).PassAs<Proxy>()
; |
22 } | 22 } |
23 | 23 |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 m_layerTreeHost->didLoseContext(); | 169 m_layerTreeHost->didLoseContext(); |
170 m_contextLost = true; | 170 m_contextLost = true; |
171 } | 171 } |
172 | 172 |
173 void SingleThreadProxy::setNeedsAnimate() | 173 void SingleThreadProxy::setNeedsAnimate() |
174 { | 174 { |
175 // Thread-only feature | 175 // Thread-only feature |
176 NOTREACHED(); | 176 NOTREACHED(); |
177 } | 177 } |
178 | 178 |
179 void SingleThreadProxy::doCommit(scoped_ptr<TextureUpdateQueue> queue) | 179 void SingleThreadProxy::doCommit(scoped_ptr<ResourceUpdateQueue> queue) |
180 { | 180 { |
181 DCHECK(Proxy::isMainThread()); | 181 DCHECK(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<TextureUpdateController> updateController = | 193 scoped_ptr<ResourceUpdateController> updateController = |
194 TextureUpdateController::create( | 194 ResourceUpdateController::create( |
195 NULL, | 195 NULL, |
196 Proxy::mainThread(), | 196 Proxy::mainThread(), |
197 queue.Pass(), | 197 queue.Pass(), |
198 m_layerTreeHostImpl->resourceProvider()); | 198 m_layerTreeHostImpl->resourceProvider()); |
199 updateController->finalize(); | 199 updateController->finalize(); |
200 | 200 |
201 m_layerTreeHost->finishCommitOnImplThread(m_layerTreeHostImpl.get()); | 201 m_layerTreeHost->finishCommitOnImplThread(m_layerTreeHostImpl.get()); |
202 | 202 |
203 m_layerTreeHostImpl->commitComplete(); | 203 m_layerTreeHostImpl->commitComplete(); |
204 | 204 |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 return false; | 317 return false; |
318 | 318 |
319 // Unlink any texture backings that were deleted | 319 // Unlink any texture backings that were deleted |
320 PrioritizedTextureManager::BackingList evictedContentsTexturesBackings; | 320 PrioritizedTextureManager::BackingList evictedContentsTexturesBackings; |
321 { | 321 { |
322 DebugScopedSetImplThread implThread; | 322 DebugScopedSetImplThread implThread; |
323 m_layerTreeHost->contentsTextureManager()->getEvictedBackings(evictedCon
tentsTexturesBackings); | 323 m_layerTreeHost->contentsTextureManager()->getEvictedBackings(evictedCon
tentsTexturesBackings); |
324 } | 324 } |
325 m_layerTreeHost->contentsTextureManager()->unlinkEvictedBackings(evictedCont
entsTexturesBackings); | 325 m_layerTreeHost->contentsTextureManager()->unlinkEvictedBackings(evictedCont
entsTexturesBackings); |
326 | 326 |
327 scoped_ptr<TextureUpdateQueue> queue = make_scoped_ptr(new TextureUpdateQueu
e); | 327 scoped_ptr<ResourceUpdateQueue> queue = make_scoped_ptr(new ResourceUpdateQu
eue); |
328 m_layerTreeHost->updateLayers(*(queue.get()), m_layerTreeHostImpl->memoryAll
ocationLimitBytes()); | 328 m_layerTreeHost->updateLayers(*(queue.get()), m_layerTreeHostImpl->memoryAll
ocationLimitBytes()); |
329 | 329 |
330 if (m_layerTreeHostImpl->contentsTexturesPurged()) | 330 if (m_layerTreeHostImpl->contentsTexturesPurged()) |
331 m_layerTreeHostImpl->resetContentsTexturesPurged(); | 331 m_layerTreeHostImpl->resetContentsTexturesPurged(); |
332 | 332 |
333 m_layerTreeHost->willCommit(); | 333 m_layerTreeHost->willCommit(); |
334 doCommit(queue.Pass()); | 334 doCommit(queue.Pass()); |
335 bool result = doComposite(); | 335 bool result = doComposite(); |
336 m_layerTreeHost->didBeginFrame(); | 336 m_layerTreeHost->didBeginFrame(); |
337 return result; | 337 return result; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 | 373 |
374 void SingleThreadProxy::didSwapFrame() | 374 void SingleThreadProxy::didSwapFrame() |
375 { | 375 { |
376 if (m_nextFrameIsNewlyCommittedFrame) { | 376 if (m_nextFrameIsNewlyCommittedFrame) { |
377 m_nextFrameIsNewlyCommittedFrame = false; | 377 m_nextFrameIsNewlyCommittedFrame = false; |
378 m_layerTreeHost->didCommitAndDrawFrame(); | 378 m_layerTreeHost->didCommitAndDrawFrame(); |
379 } | 379 } |
380 } | 380 } |
381 | 381 |
382 } | 382 } |
OLD | NEW |