Chromium Code Reviews| 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/trees/single_thread_proxy.h" | 5 #include "cc/trees/single_thread_proxy.h" |
| 6 | 6 |
| 7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
| 9 #include "cc/debug/benchmark_instrumentation.h" | 9 #include "cc/debug/benchmark_instrumentation.h" |
| 10 #include "cc/output/context_provider.h" | 10 #include "cc/output/context_provider.h" |
| (...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 385 | 385 |
| 386 // This CapturePostTasks should be destroyed before | 386 // This CapturePostTasks should be destroyed before |
| 387 // DidCommitAndDrawFrame() is called since that goes out to the embedder, | 387 // DidCommitAndDrawFrame() is called since that goes out to the embedder, |
| 388 // and we want the embedder to receive its callbacks before that. | 388 // and we want the embedder to receive its callbacks before that. |
| 389 // NOTE: This maintains consistent ordering with the ThreadProxy since | 389 // NOTE: This maintains consistent ordering with the ThreadProxy since |
| 390 // the DidCommitAndDrawFrame() must be post-tasked from the impl thread | 390 // the DidCommitAndDrawFrame() must be post-tasked from the impl thread |
| 391 // there as the main thread is not blocked, so any posted tasks inside | 391 // there as the main thread is not blocked, so any posted tasks inside |
| 392 // the swap buffers will execute first. | 392 // the swap buffers will execute first. |
| 393 BlockingTaskRunner::CapturePostTasks blocked; | 393 BlockingTaskRunner::CapturePostTasks blocked; |
| 394 | 394 |
| 395 layer_tree_host_impl_->SwapBuffers(frame); | 395 bool did_swap = layer_tree_host_impl_->SwapBuffers(frame); |
| 396 if (did_swap) | |
| 397 layer_tree_host_impl_->active_tree()->FinishSwapPromise(); | |
|
danakj
2013/11/13 23:22:09
Why doesn't LTHI do this directly inside SwapBuffe
Yufeng Shen (Slow to review)
2013/11/14 22:09:55
Done.
| |
| 398 else | |
| 399 layer_tree_host_impl_->active_tree()->BreakSwapPromise( | |
| 400 SwapPromise::SWAP_FAILS); | |
| 396 } | 401 } |
| 397 DidSwapFrame(); | 402 DidSwapFrame(); |
| 398 } | 403 } |
| 399 } | 404 } |
| 400 | 405 |
| 401 scoped_ptr<base::Value> SingleThreadProxy::AsValue() const { | 406 scoped_ptr<base::Value> SingleThreadProxy::AsValue() const { |
| 402 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); | 407 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); |
| 403 { | 408 { |
| 404 // The following line casts away const modifiers because it is just | 409 // The following line casts away const modifiers because it is just |
| 405 // setting debug state. We still want the AsValue() function and its | 410 // setting debug state. We still want the AsValue() function and its |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 542 void SingleThreadProxy::DidSwapFrame() { | 547 void SingleThreadProxy::DidSwapFrame() { |
| 543 if (next_frame_is_newly_committed_frame_) { | 548 if (next_frame_is_newly_committed_frame_) { |
| 544 next_frame_is_newly_committed_frame_ = false; | 549 next_frame_is_newly_committed_frame_ = false; |
| 545 layer_tree_host_->DidCommitAndDrawFrame(); | 550 layer_tree_host_->DidCommitAndDrawFrame(); |
| 546 } | 551 } |
| 547 } | 552 } |
| 548 | 553 |
| 549 bool SingleThreadProxy::CommitPendingForTesting() { return false; } | 554 bool SingleThreadProxy::CommitPendingForTesting() { return false; } |
| 550 | 555 |
| 551 } // namespace cc | 556 } // namespace cc |
| OLD | NEW |