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 "cc/thread_proxy.h" | 5 #include "cc/thread_proxy.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "cc/delay_based_time_source.h" | 10 #include "cc/delay_based_time_source.h" |
(...skipping 11 matching lines...) Expand all Loading... | |
22 using WebKit::WebSharedGraphicsContext3D; | 22 using WebKit::WebSharedGraphicsContext3D; |
23 | 23 |
24 namespace { | 24 namespace { |
25 | 25 |
26 // Measured in seconds. | 26 // Measured in seconds. |
27 const double contextRecreationTickRate = 0.03; | 27 const double contextRecreationTickRate = 0.03; |
28 | 28 |
29 // Measured in seconds. | 29 // Measured in seconds. |
30 const double smoothnessTakesPriorityExpirationDelay = 0.25; | 30 const double smoothnessTakesPriorityExpirationDelay = 0.25; |
31 | 31 |
32 // Measured in seconds. | |
33 const double checkForCompletedRasterTasksDelay = 0.004; | |
34 | |
32 } // namespace | 35 } // namespace |
33 | 36 |
34 namespace cc { | 37 namespace cc { |
35 | 38 |
36 scoped_ptr<Proxy> ThreadProxy::create(LayerTreeHost* layerTreeHost, scoped_ptr<T hread> implThread) | 39 scoped_ptr<Proxy> ThreadProxy::create(LayerTreeHost* layerTreeHost, scoped_ptr<T hread> implThread) |
37 { | 40 { |
38 return make_scoped_ptr(new ThreadProxy(layerTreeHost, implThread.Pass())).Pa ssAs<Proxy>(); | 41 return make_scoped_ptr(new ThreadProxy(layerTreeHost, implThread.Pass())).Pa ssAs<Proxy>(); |
39 } | 42 } |
40 | 43 |
41 ThreadProxy::ThreadProxy(LayerTreeHost* layerTreeHost, scoped_ptr<Thread> implTh read) | 44 ThreadProxy::ThreadProxy(LayerTreeHost* layerTreeHost, scoped_ptr<Thread> implTh read) |
(...skipping 13 matching lines...) Expand all Loading... | |
55 , m_readbackRequestOnImplThread(0) | 58 , m_readbackRequestOnImplThread(0) |
56 , m_commitCompletionEventOnImplThread(0) | 59 , m_commitCompletionEventOnImplThread(0) |
57 , m_completionEventForCommitHeldOnTreeActivation(0) | 60 , m_completionEventForCommitHeldOnTreeActivation(0) |
58 , m_textureAcquisitionCompletionEventOnImplThread(0) | 61 , m_textureAcquisitionCompletionEventOnImplThread(0) |
59 , m_nextFrameIsNewlyCommittedFrameOnImplThread(false) | 62 , m_nextFrameIsNewlyCommittedFrameOnImplThread(false) |
60 , m_renderVSyncEnabled(layerTreeHost->settings().renderVSyncEnabled) | 63 , m_renderVSyncEnabled(layerTreeHost->settings().renderVSyncEnabled) |
61 , m_insideDraw(false) | 64 , m_insideDraw(false) |
62 , m_totalCommitCount(0) | 65 , m_totalCommitCount(0) |
63 , m_deferCommits(false) | 66 , m_deferCommits(false) |
64 , m_renewTreePriorityOnImplThreadPending(false) | 67 , m_renewTreePriorityOnImplThreadPending(false) |
68 , m_checkForCompletedRasterTasksPending(false) | |
65 { | 69 { |
66 TRACE_EVENT0("cc", "ThreadProxy::ThreadProxy"); | 70 TRACE_EVENT0("cc", "ThreadProxy::ThreadProxy"); |
67 DCHECK(isMainThread()); | 71 DCHECK(isMainThread()); |
68 } | 72 } |
69 | 73 |
70 ThreadProxy::~ThreadProxy() | 74 ThreadProxy::~ThreadProxy() |
71 { | 75 { |
72 TRACE_EVENT0("cc", "ThreadProxy::~ThreadProxy"); | 76 TRACE_EVENT0("cc", "ThreadProxy::~ThreadProxy"); |
73 DCHECK(isMainThread()); | 77 DCHECK(isMainThread()); |
74 DCHECK(!m_started); | 78 DCHECK(!m_started); |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
362 } | 366 } |
363 | 367 |
364 void ThreadProxy::manageTilesOnImplThread() | 368 void ThreadProxy::manageTilesOnImplThread() |
365 { | 369 { |
366 // TODO(nduca): If needed, move this into CCSchedulerStateMachine. | 370 // TODO(nduca): If needed, move this into CCSchedulerStateMachine. |
367 m_manageTilesPending = false; | 371 m_manageTilesPending = false; |
368 if (m_layerTreeHostImpl) | 372 if (m_layerTreeHostImpl) |
369 m_layerTreeHostImpl->manageTiles(); | 373 m_layerTreeHostImpl->manageTiles(); |
370 } | 374 } |
371 | 375 |
376 void ThreadProxy::setNeedsCheckForCompletedRasterTasksOnImplThread() | |
377 { | |
brianderson
2013/02/12 01:44:31
DCHECK(isImplThread())?
reveman
2013/02/12 02:29:52
Sure. I'll add that to setNeedsManageTilesOnImplTh
| |
378 if (m_checkForCompletedRasterTasksPending) | |
379 return; | |
380 Proxy::implThread()->postDelayedTask( | |
381 base::Bind(&ThreadProxy::checkForCompletedRasterTasksOnImplThread, | |
382 m_weakFactoryOnImplThread.GetWeakPtr()), | |
383 checkForCompletedRasterTasksDelay * 1000); | |
384 m_checkForCompletedRasterTasksPending = true; | |
385 } | |
386 | |
387 void ThreadProxy::checkForCompletedRasterTasksOnImplThread() | |
388 { | |
brianderson
2013/02/12 01:44:31
DCHECK(isImplThread())?
reveman
2013/02/12 02:29:52
Done.
| |
389 m_checkForCompletedRasterTasksPending = false; | |
390 if (m_layerTreeHostImpl) | |
391 m_layerTreeHostImpl->checkForCompletedRasterTasks(); | |
392 } | |
393 | |
372 void ThreadProxy::setNeedsForcedCommitOnImplThread() | 394 void ThreadProxy::setNeedsForcedCommitOnImplThread() |
373 { | 395 { |
374 DCHECK(isImplThread()); | 396 DCHECK(isImplThread()); |
375 TRACE_EVENT0("cc", "ThreadProxy::setNeedsForcedCommitOnImplThread"); | 397 TRACE_EVENT0("cc", "ThreadProxy::setNeedsForcedCommitOnImplThread"); |
376 m_schedulerOnImplThread->setNeedsForcedCommit(); | 398 m_schedulerOnImplThread->setNeedsForcedCommit(); |
377 } | 399 } |
378 | 400 |
379 void ThreadProxy::postAnimationEventsToMainThreadOnImplThread(scoped_ptr<Animati onEventsVector> events, base::Time wallClockTime) | 401 void ThreadProxy::postAnimationEventsToMainThreadOnImplThread(scoped_ptr<Animati onEventsVector> events, base::Time wallClockTime) |
380 { | 402 { |
381 DCHECK(isImplThread()); | 403 DCHECK(isImplThread()); |
(...skipping 806 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1188 | 1210 |
1189 void ThreadProxy::renewTreePriorityOnImplThread() | 1211 void ThreadProxy::renewTreePriorityOnImplThread() |
1190 { | 1212 { |
1191 DCHECK(m_renewTreePriorityOnImplThreadPending); | 1213 DCHECK(m_renewTreePriorityOnImplThreadPending); |
1192 m_renewTreePriorityOnImplThreadPending = false; | 1214 m_renewTreePriorityOnImplThreadPending = false; |
1193 | 1215 |
1194 renewTreePriority(); | 1216 renewTreePriority(); |
1195 } | 1217 } |
1196 | 1218 |
1197 } // namespace cc | 1219 } // namespace cc |
OLD | NEW |