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/thread_proxy.h" | 5 #include "cc/trees/thread_proxy.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 54 bool commit_pending; | 54 bool commit_pending; |
| 55 }; | 55 }; |
| 56 | 56 |
| 57 struct ThreadProxy::SchedulerStateRequest { | 57 struct ThreadProxy::SchedulerStateRequest { |
| 58 CompletionEvent completion; | 58 CompletionEvent completion; |
| 59 scoped_ptr<base::Value> state; | 59 scoped_ptr<base::Value> state; |
| 60 }; | 60 }; |
| 61 | 61 |
| 62 scoped_ptr<Proxy> ThreadProxy::Create( | 62 scoped_ptr<Proxy> ThreadProxy::Create( |
| 63 LayerTreeHost* layer_tree_host, | 63 LayerTreeHost* layer_tree_host, |
| 64 scoped_refptr<cc::MainThreadTaskRunner> main_task_runner, | |
| 64 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner) { | 65 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner) { |
| 65 return make_scoped_ptr(new ThreadProxy(layer_tree_host, impl_task_runner)) | 66 return make_scoped_ptr(new ThreadProxy(layer_tree_host, |
| 67 main_task_runner, | |
| 68 impl_task_runner)) | |
| 66 .PassAs<Proxy>(); | 69 .PassAs<Proxy>(); |
| 67 } | 70 } |
| 68 | 71 |
| 69 ThreadProxy::ThreadProxy( | 72 ThreadProxy::ThreadProxy( |
| 70 LayerTreeHost* layer_tree_host, | 73 LayerTreeHost* layer_tree_host, |
| 74 scoped_refptr<cc::MainThreadTaskRunner> main_task_runner, | |
| 71 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner) | 75 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner) |
| 72 : Proxy(impl_task_runner), | 76 : Proxy(main_task_runner, impl_task_runner), |
| 73 main_thread_only_vars_unsafe_(this, layer_tree_host->id()), | 77 main_thread_only_vars_unsafe_(this, layer_tree_host->id()), |
| 74 main_thread_or_blocked_vars_unsafe_(layer_tree_host), | 78 main_thread_or_blocked_vars_unsafe_(layer_tree_host), |
| 75 compositor_thread_vars_unsafe_(this, layer_tree_host->id()) { | 79 compositor_thread_vars_unsafe_(this, layer_tree_host->id()) { |
| 76 TRACE_EVENT0("cc", "ThreadProxy::ThreadProxy"); | 80 TRACE_EVENT0("cc", "ThreadProxy::ThreadProxy"); |
| 77 DCHECK(IsMainThread()); | 81 DCHECK(IsMainThread()); |
| 78 DCHECK(this->layer_tree_host()); | 82 DCHECK(this->layer_tree_host()); |
| 79 } | 83 } |
| 80 | 84 |
| 81 ThreadProxy::MainThreadOnly::MainThreadOnly(ThreadProxy* proxy, | 85 ThreadProxy::MainThreadOnly::MainThreadOnly(ThreadProxy* proxy, |
| 82 int layer_tree_host_id) | 86 int layer_tree_host_id) |
| (...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 455 void ThreadProxy::SetDeferCommits(bool defer_commits) { | 459 void ThreadProxy::SetDeferCommits(bool defer_commits) { |
| 456 DCHECK(IsMainThread()); | 460 DCHECK(IsMainThread()); |
| 457 DCHECK_NE(main().defer_commits, defer_commits); | 461 DCHECK_NE(main().defer_commits, defer_commits); |
| 458 main().defer_commits = defer_commits; | 462 main().defer_commits = defer_commits; |
| 459 | 463 |
| 460 if (main().defer_commits) | 464 if (main().defer_commits) |
| 461 TRACE_EVENT_ASYNC_BEGIN0("cc", "ThreadProxy::SetDeferCommits", this); | 465 TRACE_EVENT_ASYNC_BEGIN0("cc", "ThreadProxy::SetDeferCommits", this); |
| 462 else | 466 else |
| 463 TRACE_EVENT_ASYNC_END0("cc", "ThreadProxy::SetDeferCommits", this); | 467 TRACE_EVENT_ASYNC_END0("cc", "ThreadProxy::SetDeferCommits", this); |
| 464 | 468 |
| 465 if (!main().defer_commits && main().pending_deferred_commit) | 469 if (!main().defer_commits && main().pending_deferred_commit) { |
| 466 Proxy::MainThreadTaskRunner()->PostTask( | 470 Proxy::MainThreadTaskRunner()->PostBeginMainFrameTask( |
| 467 FROM_HERE, | 471 FROM_HERE, |
| 468 base::Bind(&ThreadProxy::BeginMainFrame, | 472 base::Bind(&ThreadProxy::BeginMainFrame, |
| 469 main_thread_weak_ptr_, | 473 main_thread_weak_ptr_, |
| 470 base::Passed(&main().pending_deferred_commit))); | 474 base::Passed(&main().pending_deferred_commit)), |
| 475 0, 0, 0); | |
| 476 } | |
| 471 } | 477 } |
| 472 | 478 |
| 473 bool ThreadProxy::CommitRequested() const { | 479 bool ThreadProxy::CommitRequested() const { |
| 474 DCHECK(IsMainThread()); | 480 DCHECK(IsMainThread()); |
| 475 return main().commit_requested; | 481 return main().commit_requested; |
| 476 } | 482 } |
| 477 | 483 |
| 478 bool ThreadProxy::BeginMainFrameRequested() const { | 484 bool ThreadProxy::BeginMainFrameRequested() const { |
| 479 DCHECK(IsMainThread()); | 485 DCHECK(IsMainThread()); |
| 480 return main().commit_request_sent_to_impl_thread; | 486 return main().commit_request_sent_to_impl_thread; |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 698 | 704 |
| 699 if (!impl().layer_tree_host_impl->settings().impl_side_painting) { | 705 if (!impl().layer_tree_host_impl->settings().impl_side_painting) { |
| 700 DCHECK_GT(impl().layer_tree_host_impl->memory_allocation_limit_bytes(), 0u); | 706 DCHECK_GT(impl().layer_tree_host_impl->memory_allocation_limit_bytes(), 0u); |
| 701 } | 707 } |
| 702 begin_main_frame_state->memory_allocation_limit_bytes = | 708 begin_main_frame_state->memory_allocation_limit_bytes = |
| 703 impl().layer_tree_host_impl->memory_allocation_limit_bytes(); | 709 impl().layer_tree_host_impl->memory_allocation_limit_bytes(); |
| 704 begin_main_frame_state->memory_allocation_priority_cutoff = | 710 begin_main_frame_state->memory_allocation_priority_cutoff = |
| 705 impl().layer_tree_host_impl->memory_allocation_priority_cutoff(); | 711 impl().layer_tree_host_impl->memory_allocation_priority_cutoff(); |
| 706 begin_main_frame_state->evicted_ui_resources = | 712 begin_main_frame_state->evicted_ui_resources = |
| 707 impl().layer_tree_host_impl->EvictedUIResourcesExist(); | 713 impl().layer_tree_host_impl->EvictedUIResourcesExist(); |
| 708 Proxy::MainThreadTaskRunner()->PostTask( | 714 Proxy::MainThreadTaskRunner()->PostBeginMainFrameTask( |
| 709 FROM_HERE, | 715 FROM_HERE, |
| 710 base::Bind(&ThreadProxy::BeginMainFrame, | 716 base::Bind(&ThreadProxy::BeginMainFrame, |
| 711 main_thread_weak_ptr_, | 717 main_thread_weak_ptr_, |
| 712 base::Passed(&begin_main_frame_state))); | 718 base::Passed(&begin_main_frame_state)), |
| 719 0, 0, 0); | |
|
mithro-old
2014/07/08 11:18:51
This line I don't quite understand? Isn't all the
Sami
2014/07/08 11:23:15
Yes, the data is inside begin_main_frame_state, bu
| |
| 713 devtools_instrumentation::DidRequestMainThreadFrame( | 720 devtools_instrumentation::DidRequestMainThreadFrame( |
| 714 impl().layer_tree_host_id); | 721 impl().layer_tree_host_id); |
| 715 impl().timing_history.DidBeginMainFrame(); | 722 impl().timing_history.DidBeginMainFrame(); |
| 716 } | 723 } |
| 717 | 724 |
| 718 void ThreadProxy::BeginMainFrame( | 725 void ThreadProxy::BeginMainFrame( |
| 719 scoped_ptr<BeginMainFrameAndCommitState> begin_main_frame_state) { | 726 scoped_ptr<BeginMainFrameAndCommitState> begin_main_frame_state) { |
| 720 TRACE_EVENT0("cc", "ThreadProxy::BeginMainFrame"); | 727 TRACE_EVENT0("cc", "ThreadProxy::BeginMainFrame"); |
| 721 TRACE_EVENT_SYNTHETIC_DELAY_BEGIN("cc.BeginMainFrame"); | 728 TRACE_EVENT_SYNTHETIC_DELAY_BEGIN("cc.BeginMainFrame"); |
| 722 DCHECK(IsMainThread()); | 729 DCHECK(IsMainThread()); |
| (...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1439 | 1446 |
| 1440 impl().timing_history.DidActivatePendingTree(); | 1447 impl().timing_history.DidActivatePendingTree(); |
| 1441 } | 1448 } |
| 1442 | 1449 |
| 1443 void ThreadProxy::DidManageTiles() { | 1450 void ThreadProxy::DidManageTiles() { |
| 1444 DCHECK(IsImplThread()); | 1451 DCHECK(IsImplThread()); |
| 1445 impl().scheduler->DidManageTiles(); | 1452 impl().scheduler->DidManageTiles(); |
| 1446 } | 1453 } |
| 1447 | 1454 |
| 1448 } // namespace cc | 1455 } // namespace cc |
| OLD | NEW |