Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(148)

Side by Side Diff: cc/trees/thread_proxy.cc

Issue 895853003: Update from https://crrev.com/314320 (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/trees/thread_proxy.h ('k') | cc/trees/tree_synchronizer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/debug/trace_event.h" 12 #include "base/trace_event/trace_event.h"
13 #include "base/debug/trace_event_argument.h" 13 #include "base/trace_event/trace_event_argument.h"
14 #include "base/debug/trace_event_synthetic_delay.h" 14 #include "base/trace_event/trace_event_synthetic_delay.h"
15 #include "cc/base/swap_promise.h" 15 #include "cc/base/swap_promise.h"
16 #include "cc/debug/benchmark_instrumentation.h" 16 #include "cc/debug/benchmark_instrumentation.h"
17 #include "cc/debug/devtools_instrumentation.h" 17 #include "cc/debug/devtools_instrumentation.h"
18 #include "cc/input/input_handler.h" 18 #include "cc/input/input_handler.h"
19 #include "cc/output/context_provider.h" 19 #include "cc/output/context_provider.h"
20 #include "cc/output/output_surface.h" 20 #include "cc/output/output_surface.h"
21 #include "cc/quads/draw_quad.h" 21 #include "cc/quads/draw_quad.h"
22 #include "cc/resources/prioritized_resource_manager.h" 22 #include "cc/resources/prioritized_resource_manager.h"
23 #include "cc/scheduler/commit_earlyout_reason.h" 23 #include "cc/scheduler/commit_earlyout_reason.h"
24 #include "cc/scheduler/delay_based_time_source.h" 24 #include "cc/scheduler/delay_based_time_source.h"
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 DCHECK(IsMainThread()); 445 DCHECK(IsMainThread());
446 if (main().defer_commits == defer_commits) 446 if (main().defer_commits == defer_commits)
447 return; 447 return;
448 448
449 main().defer_commits = defer_commits; 449 main().defer_commits = defer_commits;
450 if (main().defer_commits) 450 if (main().defer_commits)
451 TRACE_EVENT_ASYNC_BEGIN0("cc", "ThreadProxy::SetDeferCommits", this); 451 TRACE_EVENT_ASYNC_BEGIN0("cc", "ThreadProxy::SetDeferCommits", this);
452 else 452 else
453 TRACE_EVENT_ASYNC_END0("cc", "ThreadProxy::SetDeferCommits", this); 453 TRACE_EVENT_ASYNC_END0("cc", "ThreadProxy::SetDeferCommits", this);
454 454
455 if (!main().defer_commits && main().pending_deferred_commit) { 455 Proxy::ImplThreadTaskRunner()->PostTask(
456 Proxy::MainThreadTaskRunner()->PostTask( 456 FROM_HERE,
457 FROM_HERE, 457 base::Bind(&ThreadProxy::SetDeferCommitsOnImplThread,
458 base::Bind(&ThreadProxy::BeginMainFrame, 458 impl_thread_weak_ptr_,
459 main_thread_weak_ptr_, 459 defer_commits));
460 base::Passed(&main().pending_deferred_commit))); 460 }
461 } 461
462 void ThreadProxy::SetDeferCommitsOnImplThread(bool defer_commits) const {
463 DCHECK(IsImplThread());
464 impl().scheduler->SetDeferCommits(defer_commits);
462 } 465 }
463 466
464 bool ThreadProxy::CommitRequested() const { 467 bool ThreadProxy::CommitRequested() const {
465 DCHECK(IsMainThread()); 468 DCHECK(IsMainThread());
466 return main().commit_requested; 469 return main().commit_requested;
467 } 470 }
468 471
469 bool ThreadProxy::BeginMainFrameRequested() const { 472 bool ThreadProxy::BeginMainFrameRequested() const {
470 DCHECK(IsMainThread()); 473 DCHECK(IsMainThread());
471 return main().commit_request_sent_to_impl_thread; 474 return main().commit_request_sent_to_impl_thread;
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
694 697
695 void ThreadProxy::BeginMainFrame( 698 void ThreadProxy::BeginMainFrame(
696 scoped_ptr<BeginMainFrameAndCommitState> begin_main_frame_state) { 699 scoped_ptr<BeginMainFrameAndCommitState> begin_main_frame_state) {
697 benchmark_instrumentation::ScopedBeginFrameTask begin_frame_task( 700 benchmark_instrumentation::ScopedBeginFrameTask begin_frame_task(
698 benchmark_instrumentation::kDoBeginFrame, 701 benchmark_instrumentation::kDoBeginFrame,
699 begin_main_frame_state->begin_frame_id); 702 begin_main_frame_state->begin_frame_id);
700 TRACE_EVENT_SYNTHETIC_DELAY_BEGIN("cc.BeginMainFrame"); 703 TRACE_EVENT_SYNTHETIC_DELAY_BEGIN("cc.BeginMainFrame");
701 DCHECK(IsMainThread()); 704 DCHECK(IsMainThread());
702 705
703 if (main().defer_commits) { 706 if (main().defer_commits) {
704 main().pending_deferred_commit = begin_main_frame_state.Pass(); 707 TRACE_EVENT_INSTANT0("cc", "EarlyOut_DeferCommit",
705 layer_tree_host()->DidDeferCommit(); 708 TRACE_EVENT_SCOPE_THREAD);
706 TRACE_EVENT_INSTANT0( 709 Proxy::ImplThreadTaskRunner()->PostTask(
707 "cc", "EarlyOut_DeferCommits", TRACE_EVENT_SCOPE_THREAD); 710 FROM_HERE, base::Bind(&ThreadProxy::BeginMainFrameAbortedOnImplThread,
711 impl_thread_weak_ptr_,
712 CommitEarlyOutReason::ABORTED_DEFERRED_COMMIT));
708 return; 713 return;
709 } 714 }
710 715
711 // If the commit finishes, LayerTreeHost will transfer its swap promises to 716 // If the commit finishes, LayerTreeHost will transfer its swap promises to
712 // LayerTreeImpl. The destructor of ScopedSwapPromiseChecker aborts the 717 // LayerTreeImpl. The destructor of ScopedSwapPromiseChecker aborts the
713 // remaining swap promises. 718 // remaining swap promises.
714 ScopedAbortRemainingSwapPromises swap_promise_checker(layer_tree_host()); 719 ScopedAbortRemainingSwapPromises swap_promise_checker(layer_tree_host());
715 720
716 main().commit_requested = false; 721 main().commit_requested = false;
717 main().commit_request_sent_to_impl_thread = false; 722 main().commit_request_sent_to_impl_thread = false;
(...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after
1360 } 1365 }
1361 1366
1362 void ThreadProxy::DidCompletePageScaleAnimationOnImplThread() { 1367 void ThreadProxy::DidCompletePageScaleAnimationOnImplThread() {
1363 DCHECK(IsImplThread()); 1368 DCHECK(IsImplThread());
1364 Proxy::MainThreadTaskRunner()->PostTask( 1369 Proxy::MainThreadTaskRunner()->PostTask(
1365 FROM_HERE, base::Bind(&ThreadProxy::DidCompletePageScaleAnimation, 1370 FROM_HERE, base::Bind(&ThreadProxy::DidCompletePageScaleAnimation,
1366 main_thread_weak_ptr_)); 1371 main_thread_weak_ptr_));
1367 } 1372 }
1368 1373
1369 } // namespace cc 1374 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/thread_proxy.h ('k') | cc/trees/tree_synchronizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698