| 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 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 // there as the main thread is not blocked, so any posted tasks inside | 362 // there as the main thread is not blocked, so any posted tasks inside |
| 363 // the swap buffers will execute first. | 363 // the swap buffers will execute first. |
| 364 BlockingTaskRunner::CapturePostTasks blocked; | 364 BlockingTaskRunner::CapturePostTasks blocked; |
| 365 | 365 |
| 366 layer_tree_host_impl_->SwapBuffers(frame); | 366 layer_tree_host_impl_->SwapBuffers(frame); |
| 367 } | 367 } |
| 368 DidSwapFrame(); | 368 DidSwapFrame(); |
| 369 } | 369 } |
| 370 } | 370 } |
| 371 | 371 |
| 372 scoped_ptr<base::Value> SingleThreadProxy::AsValue() const { | 372 void SingleThreadProxy::AsValueInto(base::debug::TracedValue* state) const { |
| 373 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); | 373 // The following line casts away const modifiers because it is just |
| 374 { | 374 // setting debug state. We still want the AsValue() function and its |
| 375 // The following line casts away const modifiers because it is just | 375 // call chain to be const throughout. |
| 376 // setting debug state. We still want the AsValue() function and its | 376 DebugScopedSetImplThread impl(const_cast<SingleThreadProxy*>(this)); |
| 377 // call chain to be const throughout. | |
| 378 DebugScopedSetImplThread impl(const_cast<SingleThreadProxy*>(this)); | |
| 379 | 377 |
| 380 state->Set("layer_tree_host_impl", | 378 state->BeginDictionary("layer_tree_host_impl"); |
| 381 layer_tree_host_impl_->AsValue().release()); | 379 layer_tree_host_impl_->AsValueInto(state); |
| 382 } | 380 state->EndDictionary(); |
| 383 return state.PassAs<base::Value>(); | |
| 384 } | 381 } |
| 385 | 382 |
| 386 void SingleThreadProxy::ForceSerializeOnSwapBuffers() { | 383 void SingleThreadProxy::ForceSerializeOnSwapBuffers() { |
| 387 { | 384 { |
| 388 DebugScopedSetImplThread impl(this); | 385 DebugScopedSetImplThread impl(this); |
| 389 if (layer_tree_host_impl_->renderer()) { | 386 if (layer_tree_host_impl_->renderer()) { |
| 390 DCHECK(!layer_tree_host_->output_surface_lost()); | 387 DCHECK(!layer_tree_host_->output_surface_lost()); |
| 391 layer_tree_host_impl_->renderer()->DoNoOp(); | 388 layer_tree_host_impl_->renderer()->DoNoOp(); |
| 392 } | 389 } |
| 393 } | 390 } |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 457 void SingleThreadProxy::DidSwapFrame() { | 454 void SingleThreadProxy::DidSwapFrame() { |
| 458 if (next_frame_is_newly_committed_frame_) { | 455 if (next_frame_is_newly_committed_frame_) { |
| 459 next_frame_is_newly_committed_frame_ = false; | 456 next_frame_is_newly_committed_frame_ = false; |
| 460 layer_tree_host_->DidCommitAndDrawFrame(); | 457 layer_tree_host_->DidCommitAndDrawFrame(); |
| 461 } | 458 } |
| 462 } | 459 } |
| 463 | 460 |
| 464 bool SingleThreadProxy::CommitPendingForTesting() { return false; } | 461 bool SingleThreadProxy::CommitPendingForTesting() { return false; } |
| 465 | 462 |
| 466 } // namespace cc | 463 } // namespace cc |
| OLD | NEW |