| 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 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 | 370 |
| 371 // This CapturePostTasks should be destroyed before | 371 // This CapturePostTasks should be destroyed before |
| 372 // DidCommitAndDrawFrame() is called since that goes out to the embedder, | 372 // DidCommitAndDrawFrame() is called since that goes out to the embedder, |
| 373 // and we want the embedder to receive its callbacks before that. | 373 // and we want the embedder to receive its callbacks before that. |
| 374 // NOTE: This maintains consistent ordering with the ThreadProxy since | 374 // NOTE: This maintains consistent ordering with the ThreadProxy since |
| 375 // the DidCommitAndDrawFrame() must be post-tasked from the impl thread | 375 // the DidCommitAndDrawFrame() must be post-tasked from the impl thread |
| 376 // there as the main thread is not blocked, so any posted tasks inside | 376 // there as the main thread is not blocked, so any posted tasks inside |
| 377 // the swap buffers will execute first. | 377 // the swap buffers will execute first. |
| 378 BlockingTaskRunner::CapturePostTasks blocked; | 378 BlockingTaskRunner::CapturePostTasks blocked; |
| 379 | 379 |
| 380 layer_tree_host_impl_->SwapBuffers(frame); | 380 bool did_swap = layer_tree_host_impl_->SwapBuffers(frame); |
| 381 if (did_swap) |
| 382 layer_tree_host_impl_->active_tree()->FinishSwapPromise(); |
| 383 else |
| 384 layer_tree_host_impl_->active_tree()->BreakSwapPromise("DID NOT SWAP"); |
| 381 } | 385 } |
| 382 DidSwapFrame(); | 386 DidSwapFrame(); |
| 383 } | 387 } |
| 384 } | 388 } |
| 385 | 389 |
| 386 scoped_ptr<base::Value> SingleThreadProxy::AsValue() const { | 390 scoped_ptr<base::Value> SingleThreadProxy::AsValue() const { |
| 387 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); | 391 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); |
| 388 { | 392 { |
| 389 // The following line casts away const modifiers because it is just | 393 // The following line casts away const modifiers because it is just |
| 390 // setting debug state. We still want the AsValue() function and its | 394 // setting debug state. We still want the AsValue() function and its |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 527 void SingleThreadProxy::DidSwapFrame() { | 531 void SingleThreadProxy::DidSwapFrame() { |
| 528 if (next_frame_is_newly_committed_frame_) { | 532 if (next_frame_is_newly_committed_frame_) { |
| 529 next_frame_is_newly_committed_frame_ = false; | 533 next_frame_is_newly_committed_frame_ = false; |
| 530 layer_tree_host_->DidCommitAndDrawFrame(); | 534 layer_tree_host_->DidCommitAndDrawFrame(); |
| 531 } | 535 } |
| 532 } | 536 } |
| 533 | 537 |
| 534 bool SingleThreadProxy::CommitPendingForTesting() { return false; } | 538 bool SingleThreadProxy::CommitPendingForTesting() { return false; } |
| 535 | 539 |
| 536 } // namespace cc | 540 } // namespace cc |
| OLD | NEW |