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

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

Issue 937883002: cc: Change CallFunctionForSubtree to use lambdas. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.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
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/layer_tree_host_impl.h" 5 #include "cc/trees/layer_tree_host_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 1438 matching lines...) Expand 10 before | Expand all | Expand 10 after
1449 if (!InnerViewportScrollLayer()) 1449 if (!InnerViewportScrollLayer())
1450 return metadata; 1450 return metadata;
1451 1451
1452 // TODO(miletus) : Change the metadata to hold ScrollOffset. 1452 // TODO(miletus) : Change the metadata to hold ScrollOffset.
1453 metadata.root_scroll_offset = gfx::ScrollOffsetToVector2dF( 1453 metadata.root_scroll_offset = gfx::ScrollOffsetToVector2dF(
1454 active_tree_->TotalScrollOffset()); 1454 active_tree_->TotalScrollOffset());
1455 1455
1456 return metadata; 1456 return metadata;
1457 } 1457 }
1458 1458
1459 static void LayerTreeHostImplDidBeginTracingCallback(LayerImpl* layer) {
1460 layer->DidBeginTracing();
1461 }
1462
1463 void LayerTreeHostImpl::DrawLayers(FrameData* frame, 1459 void LayerTreeHostImpl::DrawLayers(FrameData* frame,
1464 base::TimeTicks frame_begin_time) { 1460 base::TimeTicks frame_begin_time) {
1465 TRACE_EVENT0("cc", "LayerTreeHostImpl::DrawLayers"); 1461 TRACE_EVENT0("cc", "LayerTreeHostImpl::DrawLayers");
1466 DCHECK(CanDraw()); 1462 DCHECK(CanDraw());
1467 1463
1468 if (!frame->composite_events.empty()) { 1464 if (!frame->composite_events.empty()) {
1469 frame_timing_tracker_->SaveTimeStamps(frame_begin_time, 1465 frame_timing_tracker_->SaveTimeStamps(frame_begin_time,
1470 frame->composite_events); 1466 frame->composite_events);
1471 } 1467 }
1472 1468
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
1504 paint_time_counter_->SavePaintTime( 1500 paint_time_counter_->SavePaintTime(
1505 stats.begin_main_frame_to_commit_duration.GetLastTimeDelta()); 1501 stats.begin_main_frame_to_commit_duration.GetLastTimeDelta());
1506 } 1502 }
1507 1503
1508 bool is_new_trace; 1504 bool is_new_trace;
1509 TRACE_EVENT_IS_NEW_TRACE(&is_new_trace); 1505 TRACE_EVENT_IS_NEW_TRACE(&is_new_trace);
1510 if (is_new_trace) { 1506 if (is_new_trace) {
1511 if (pending_tree_) { 1507 if (pending_tree_) {
1512 LayerTreeHostCommon::CallFunctionForSubtree( 1508 LayerTreeHostCommon::CallFunctionForSubtree(
1513 pending_tree_->root_layer(), 1509 pending_tree_->root_layer(),
1514 base::Bind(&LayerTreeHostImplDidBeginTracingCallback)); 1510 [](LayerImpl* layer) { layer->DidBeginTracing(); });
1515 } 1511 }
1516 LayerTreeHostCommon::CallFunctionForSubtree( 1512 LayerTreeHostCommon::CallFunctionForSubtree(
1517 active_tree_->root_layer(), 1513 active_tree_->root_layer(),
1518 base::Bind(&LayerTreeHostImplDidBeginTracingCallback)); 1514 [](LayerImpl* layer) { layer->DidBeginTracing(); });
1519 } 1515 }
1520 1516
1521 { 1517 {
1522 TRACE_EVENT0("cc", "DrawLayers.FrameViewerTracing"); 1518 TRACE_EVENT0("cc", "DrawLayers.FrameViewerTracing");
1523 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID( 1519 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID(
1524 TRACE_DISABLED_BY_DEFAULT("cc.debug") "," 1520 TRACE_DISABLED_BY_DEFAULT("cc.debug") ","
1525 TRACE_DISABLED_BY_DEFAULT("cc.debug.quads") "," 1521 TRACE_DISABLED_BY_DEFAULT("cc.debug.quads") ","
1526 TRACE_DISABLED_BY_DEFAULT("devtools.timeline.layers"), 1522 TRACE_DISABLED_BY_DEFAULT("devtools.timeline.layers"),
1527 "cc::LayerTreeHostImpl", 1523 "cc::LayerTreeHostImpl",
1528 id_, 1524 id_,
(...skipping 1956 matching lines...) Expand 10 before | Expand all | Expand 10 after
3485 (*it)->OnSetNeedsRedrawOnImpl(); 3481 (*it)->OnSetNeedsRedrawOnImpl();
3486 } 3482 }
3487 3483
3488 void LayerTreeHostImpl::NotifySwapPromiseMonitorsOfForwardingToMainThread() { 3484 void LayerTreeHostImpl::NotifySwapPromiseMonitorsOfForwardingToMainThread() {
3489 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin(); 3485 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin();
3490 for (; it != swap_promise_monitor_.end(); it++) 3486 for (; it != swap_promise_monitor_.end(); it++)
3491 (*it)->OnForwardScrollUpdateToMainThreadOnImpl(); 3487 (*it)->OnForwardScrollUpdateToMainThreadOnImpl();
3492 } 3488 }
3493 3489
3494 } // namespace cc 3490 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698