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

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

Issue 178103004: Removing the use of base::Time inside the LayerTreeHost system. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changing to a common ToWebKitTime function. Created 6 years, 9 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
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"
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 } 460 }
461 461
462 void ThreadProxy::SetNeedsCommitOnImplThread() { 462 void ThreadProxy::SetNeedsCommitOnImplThread() {
463 TRACE_EVENT0("cc", "ThreadProxy::SetNeedsCommitOnImplThread"); 463 TRACE_EVENT0("cc", "ThreadProxy::SetNeedsCommitOnImplThread");
464 DCHECK(IsImplThread()); 464 DCHECK(IsImplThread());
465 impl().scheduler->SetNeedsCommit(); 465 impl().scheduler->SetNeedsCommit();
466 } 466 }
467 467
468 void ThreadProxy::PostAnimationEventsToMainThreadOnImplThread( 468 void ThreadProxy::PostAnimationEventsToMainThreadOnImplThread(
469 scoped_ptr<AnimationEventsVector> events, 469 scoped_ptr<AnimationEventsVector> events,
470 base::Time wall_clock_time) { 470 base::TimeTicks clock_time) {
471 TRACE_EVENT0("cc", 471 TRACE_EVENT0("cc",
472 "ThreadProxy::PostAnimationEventsToMainThreadOnImplThread"); 472 "ThreadProxy::PostAnimationEventsToMainThreadOnImplThread");
473 DCHECK(IsImplThread()); 473 DCHECK(IsImplThread());
474 Proxy::MainThreadTaskRunner()->PostTask( 474 Proxy::MainThreadTaskRunner()->PostTask(
475 FROM_HERE, 475 FROM_HERE,
476 base::Bind(&ThreadProxy::SetAnimationEvents, 476 base::Bind(&ThreadProxy::SetAnimationEvents,
477 main_thread_weak_ptr_, 477 main_thread_weak_ptr_,
478 base::Passed(&events), 478 base::Passed(&events),
479 wall_clock_time)); 479 clock_time));
480 } 480 }
481 481
482 bool ThreadProxy::ReduceContentsTextureMemoryOnImplThread(size_t limit_bytes, 482 bool ThreadProxy::ReduceContentsTextureMemoryOnImplThread(size_t limit_bytes,
483 int priority_cutoff) { 483 int priority_cutoff) {
484 DCHECK(IsImplThread()); 484 DCHECK(IsImplThread());
485 485
486 if (!impl().contents_texture_manager) 486 if (!impl().contents_texture_manager)
487 return false; 487 return false;
488 if (!impl().layer_tree_host_impl->resource_provider()) 488 if (!impl().layer_tree_host_impl->resource_provider())
489 return false; 489 return false;
(...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after
1129 base::TimeDelta draw_duration_estimate = DrawDurationEstimate(); 1129 base::TimeDelta draw_duration_estimate = DrawDurationEstimate();
1130 base::AutoReset<bool> mark_inside(&impl().inside_draw, true); 1130 base::AutoReset<bool> mark_inside(&impl().inside_draw, true);
1131 1131
1132 // Advance our animations. 1132 // Advance our animations.
1133 base::TimeTicks monotonic_time; 1133 base::TimeTicks monotonic_time;
1134 if (impl().animations_frozen_until_next_draw) 1134 if (impl().animations_frozen_until_next_draw)
1135 monotonic_time = impl().animation_freeze_time; 1135 monotonic_time = impl().animation_freeze_time;
1136 else 1136 else
1137 monotonic_time = impl().layer_tree_host_impl->CurrentFrameTimeTicks(); 1137 monotonic_time = impl().layer_tree_host_impl->CurrentFrameTimeTicks();
1138 1138
1139 // TODO(ajuma): Remove wall_clock_time once the legacy implementation of
1140 // animations in Blink is removed.
1141 base::Time wall_clock_time = impl().layer_tree_host_impl->CurrentFrameTime();
1142
1143 // TODO(enne): This should probably happen post-animate. 1139 // TODO(enne): This should probably happen post-animate.
1144 if (impl().layer_tree_host_impl->pending_tree()) 1140 if (impl().layer_tree_host_impl->pending_tree())
1145 impl().layer_tree_host_impl->pending_tree()->UpdateDrawProperties(); 1141 impl().layer_tree_host_impl->pending_tree()->UpdateDrawProperties();
1146 impl().layer_tree_host_impl->Animate(monotonic_time, wall_clock_time); 1142 impl().layer_tree_host_impl->Animate(monotonic_time);
1147 1143
1148 // This method is called on a forced draw, regardless of whether we are able 1144 // This method is called on a forced draw, regardless of whether we are able
1149 // to produce a frame, as the calling site on main thread is blocked until its 1145 // to produce a frame, as the calling site on main thread is blocked until its
1150 // request completes, and we signal completion here. If CanDraw() is false, we 1146 // request completes, and we signal completion here. If CanDraw() is false, we
1151 // will indicate success=false to the caller, but we must still signal 1147 // will indicate success=false to the caller, but we must still signal
1152 // completion to avoid deadlock. 1148 // completion to avoid deadlock.
1153 1149
1154 // We guard PrepareToDraw() with CanDraw() because it always returns a valid 1150 // We guard PrepareToDraw() with CanDraw() because it always returns a valid
1155 // frame, so can only be used when such a frame is possible. Since 1151 // frame, so can only be used when such a frame is possible. Since
1156 // DrawLayers() depends on the result of PrepareToDraw(), it is guarded on 1152 // DrawLayers() depends on the result of PrepareToDraw(), it is guarded on
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
1396 } 1392 }
1397 1393
1398 void ThreadProxy::DidCompleteSwapBuffers() { 1394 void ThreadProxy::DidCompleteSwapBuffers() {
1399 DCHECK(IsMainThread()); 1395 DCHECK(IsMainThread());
1400 if (!layer_tree_host()) 1396 if (!layer_tree_host())
1401 return; 1397 return;
1402 layer_tree_host()->DidCompleteSwapBuffers(); 1398 layer_tree_host()->DidCompleteSwapBuffers();
1403 } 1399 }
1404 1400
1405 void ThreadProxy::SetAnimationEvents(scoped_ptr<AnimationEventsVector> events, 1401 void ThreadProxy::SetAnimationEvents(scoped_ptr<AnimationEventsVector> events,
1406 base::Time wall_clock_time) { 1402 base::TimeTicks clock_time) {
1407 TRACE_EVENT0("cc", "ThreadProxy::SetAnimationEvents"); 1403 TRACE_EVENT0("cc", "ThreadProxy::SetAnimationEvents");
1408 DCHECK(IsMainThread()); 1404 DCHECK(IsMainThread());
1409 if (!layer_tree_host()) 1405 if (!layer_tree_host())
1410 return; 1406 return;
1411 layer_tree_host()->SetAnimationEvents(events.Pass(), wall_clock_time); 1407 layer_tree_host()->SetAnimationEvents(events.Pass(), clock_time);
1412 } 1408 }
1413 1409
1414 void ThreadProxy::CreateAndInitializeOutputSurface() { 1410 void ThreadProxy::CreateAndInitializeOutputSurface() {
1415 TRACE_EVENT0("cc", "ThreadProxy::CreateAndInitializeOutputSurface"); 1411 TRACE_EVENT0("cc", "ThreadProxy::CreateAndInitializeOutputSurface");
1416 DCHECK(IsMainThread()); 1412 DCHECK(IsMainThread());
1417 1413
1418 // Check that output surface has not been recreated by CompositeAndReadback 1414 // Check that output surface has not been recreated by CompositeAndReadback
1419 // after this task is posted but before it is run. 1415 // after this task is posted but before it is run.
1420 bool has_initialized_output_surface = true; 1416 bool has_initialized_output_surface = true;
1421 { 1417 {
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
1714 1710
1715 impl().timing_history.DidActivatePendingTree(); 1711 impl().timing_history.DidActivatePendingTree();
1716 } 1712 }
1717 1713
1718 void ThreadProxy::DidManageTiles() { 1714 void ThreadProxy::DidManageTiles() {
1719 DCHECK(IsImplThread()); 1715 DCHECK(IsImplThread());
1720 impl().scheduler->DidManageTiles(); 1716 impl().scheduler->DidManageTiles();
1721 } 1717 }
1722 1718
1723 } // namespace cc 1719 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698