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/thread_proxy.h" | 7 #include "cc/thread_proxy.h" |
8 | 8 |
9 #include "CCDelayBasedTimeSource.h" | 9 #include "CCDelayBasedTimeSource.h" |
10 #include "CCDrawQuad.h" | 10 #include "CCDrawQuad.h" |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
282 } | 282 } |
283 | 283 |
284 void ThreadProxy::setNeedsCommit() | 284 void ThreadProxy::setNeedsCommit() |
285 { | 285 { |
286 DCHECK(isMainThread()); | 286 DCHECK(isMainThread()); |
287 if (m_commitRequested) | 287 if (m_commitRequested) |
288 return; | 288 return; |
289 TRACE_EVENT0("cc", "ThreadProxy::setNeedsCommit"); | 289 TRACE_EVENT0("cc", "ThreadProxy::setNeedsCommit"); |
290 m_commitRequested = true; | 290 m_commitRequested = true; |
291 | 291 |
292 // FIXME(backer): Necessary? | |
jamesr
2012/10/23 17:50:44
No, this is wrong.
jonathan.backer
2012/10/23 19:26:42
Done.
| |
293 if (m_deferredBeginFrameRequest.get()) | |
294 return; | |
292 if (m_commitRequestSentToImplThread) | 295 if (m_commitRequestSentToImplThread) |
293 return; | 296 return; |
294 m_commitRequestSentToImplThread = true; | 297 m_commitRequestSentToImplThread = true; |
295 Proxy::implThread()->postTask(createThreadTask(this, &ThreadProxy::setNeedsC ommitOnImplThread)); | 298 Proxy::implThread()->postTask(createThreadTask(this, &ThreadProxy::setNeedsC ommitOnImplThread)); |
296 } | 299 } |
297 | 300 |
298 void ThreadProxy::didLoseContextOnImplThread() | 301 void ThreadProxy::didLoseContextOnImplThread() |
299 { | 302 { |
300 DCHECK(isImplThread()); | 303 DCHECK(isImplThread()); |
301 TRACE_EVENT0("cc", "ThreadProxy::didLoseContextOnImplThread"); | 304 TRACE_EVENT0("cc", "ThreadProxy::didLoseContextOnImplThread"); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
366 } | 369 } |
367 | 370 |
368 void ThreadProxy::setNeedsRedraw() | 371 void ThreadProxy::setNeedsRedraw() |
369 { | 372 { |
370 DCHECK(isMainThread()); | 373 DCHECK(isMainThread()); |
371 TRACE_EVENT0("cc", "ThreadProxy::setNeedsRedraw"); | 374 TRACE_EVENT0("cc", "ThreadProxy::setNeedsRedraw"); |
372 Proxy::implThread()->postTask(createThreadTask(this, &ThreadProxy::setFullRo otLayerDamageOnImplThread)); | 375 Proxy::implThread()->postTask(createThreadTask(this, &ThreadProxy::setFullRo otLayerDamageOnImplThread)); |
373 Proxy::implThread()->postTask(createThreadTask(this, &ThreadProxy::setNeedsR edrawOnImplThread)); | 376 Proxy::implThread()->postTask(createThreadTask(this, &ThreadProxy::setNeedsR edrawOnImplThread)); |
374 } | 377 } |
375 | 378 |
379 void ThreadProxy::setDeferCommits(bool deferCommits) | |
380 { | |
381 DCHECK(isMainThread()); | |
382 if (!deferCommits && m_deferredBeginFrameRequest.get()) { | |
383 DCHECK(!m_pendingBeginFrameRequest.get()); | |
384 m_deferredBeginFrameRequest.swap(m_pendingBeginFrameRequest); | |
385 m_mainThreadProxy->postTask(createThreadTask(this, &ThreadProxy::beginFr ame)); | |
386 } | |
387 } | |
388 | |
376 bool ThreadProxy::commitRequested() const | 389 bool ThreadProxy::commitRequested() const |
377 { | 390 { |
378 DCHECK(isMainThread()); | 391 DCHECK(isMainThread()); |
379 return m_commitRequested; | 392 return m_commitRequested; |
380 } | 393 } |
381 | 394 |
382 void ThreadProxy::setNeedsRedrawOnImplThread() | 395 void ThreadProxy::setNeedsRedrawOnImplThread() |
383 { | 396 { |
384 DCHECK(isImplThread()); | 397 DCHECK(isImplThread()); |
385 TRACE_EVENT0("cc", "ThreadProxy::setNeedsRedrawOnImplThread"); | 398 TRACE_EVENT0("cc", "ThreadProxy::setNeedsRedrawOnImplThread"); |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
480 } | 493 } |
481 } | 494 } |
482 | 495 |
483 void ThreadProxy::beginFrame() | 496 void ThreadProxy::beginFrame() |
484 { | 497 { |
485 TRACE_EVENT0("cc", "ThreadProxy::beginFrame"); | 498 TRACE_EVENT0("cc", "ThreadProxy::beginFrame"); |
486 DCHECK(isMainThread()); | 499 DCHECK(isMainThread()); |
487 if (!m_layerTreeHost) | 500 if (!m_layerTreeHost) |
488 return; | 501 return; |
489 | 502 |
503 if (m_layerTreeHost->deferCommits()) { | |
504 TRACE_EVENT0("cc", "EarlyOut_DeferCommits"); | |
505 DCHECK(!m_deferredBeginFrameRequest.get()); | |
jamesr
2012/10/23 17:50:44
!m_deferredBeginFrameRequest works fine. no need f
jonathan.backer
2012/10/23 19:26:42
Done.
| |
506 m_deferredBeginFrameRequest.swap(m_pendingBeginFrameRequest); | |
jamesr
2012/10/23 17:50:44
This swap is unnecessary
jonathan.backer
2012/10/23 19:26:42
Done.
| |
507 return; | |
508 } | |
509 | |
490 if (!m_pendingBeginFrameRequest) { | 510 if (!m_pendingBeginFrameRequest) { |
491 TRACE_EVENT0("cc", "EarlyOut_StaleBeginFrameMessage"); | 511 TRACE_EVENT0("cc", "EarlyOut_StaleBeginFrameMessage"); |
492 return; | 512 return; |
493 } | 513 } |
494 | 514 |
495 if (m_layerTreeHost->needsSharedContext() && !WebSharedGraphicsContext3D::ha veCompositorThreadContext()) | 515 if (m_layerTreeHost->needsSharedContext() && !WebSharedGraphicsContext3D::ha veCompositorThreadContext()) |
496 WebSharedGraphicsContext3D::createCompositorThreadContext(); | 516 WebSharedGraphicsContext3D::createCompositorThreadContext(); |
497 | 517 |
498 scoped_ptr<BeginFrameAndCommitState> request(m_pendingBeginFrameRequest.Pass ()); | 518 scoped_ptr<BeginFrameAndCommitState> request(m_pendingBeginFrameRequest.Pass ()); |
499 | 519 |
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
948 ThreadProxy::BeginFrameAndCommitState::BeginFrameAndCommitState() | 968 ThreadProxy::BeginFrameAndCommitState::BeginFrameAndCommitState() |
949 : monotonicFrameBeginTime(0) | 969 : monotonicFrameBeginTime(0) |
950 { | 970 { |
951 } | 971 } |
952 | 972 |
953 ThreadProxy::BeginFrameAndCommitState::~BeginFrameAndCommitState() | 973 ThreadProxy::BeginFrameAndCommitState::~BeginFrameAndCommitState() |
954 { | 974 { |
955 } | 975 } |
956 | 976 |
957 } // namespace cc | 977 } // namespace cc |
OLD | NEW |