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

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

Issue 914403003: cc: Add main frame timing info to frame timing tracker. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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/layer_tree_host.h" 5 #include "cc/trees/layer_tree_host.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/synchronization/lock.h" 10 #include "base/synchronization/lock.h"
(...skipping 6424 matching lines...) Expand 10 before | Expand all | Expand 10 after
6435 void BeginCommitOnThread(LayerTreeHostImpl* host_impl) override { 6435 void BeginCommitOnThread(LayerTreeHostImpl* host_impl) override {
6436 if (!check_results_on_commit_) 6436 if (!check_results_on_commit_)
6437 return; 6437 return;
6438 6438
6439 // Since in reality, the events will be read by LayerTreeHost during commit, 6439 // Since in reality, the events will be read by LayerTreeHost during commit,
6440 // we check the requests here to ensure that they are correct at the next 6440 // we check the requests here to ensure that they are correct at the next
6441 // commit time (as opposed to checking in DrawLayers for instance). 6441 // commit time (as opposed to checking in DrawLayers for instance).
6442 // TODO(vmpstr): Change this to read things from the main thread when this 6442 // TODO(vmpstr): Change this to read things from the main thread when this
6443 // information is propagated to the main thread (not yet implemented). 6443 // information is propagated to the main thread (not yet implemented).
6444 FrameTimingTracker* tracker = host_impl->frame_timing_tracker(); 6444 FrameTimingTracker* tracker = host_impl->frame_timing_tracker();
6445 scoped_ptr<FrameTimingTracker::CompositeTimingSet> timing_set = 6445
6446 tracker->GroupCountsByRectId(); 6446 // Check composite events.
6447 EXPECT_EQ(1u, timing_set->size()); 6447 {
6448 auto rect_1_it = timing_set->find(1); 6448 scoped_ptr<FrameTimingTracker::CompositeTimingSet> timing_set =
6449 EXPECT_TRUE(rect_1_it != timing_set->end()); 6449 tracker->GroupCompositeCountsByRectId();
6450 const auto& timing_events = rect_1_it->second; 6450 EXPECT_EQ(1u, timing_set->size());
6451 EXPECT_EQ(1u, timing_events.size()); 6451 auto rect_1_it = timing_set->find(1);
6452 EXPECT_EQ(host_impl->active_tree()->source_frame_number(), 6452 EXPECT_TRUE(rect_1_it != timing_set->end());
6453 timing_events[0].frame_id); 6453 const auto& timing_events = rect_1_it->second;
6454 EXPECT_GT(timing_events[0].timestamp, base::TimeTicks()); 6454 EXPECT_EQ(1u, timing_events.size());
6455 EXPECT_EQ(host_impl->active_tree()->source_frame_number(),
6456 timing_events[0].frame_id);
6457 EXPECT_GT(timing_events[0].timestamp, base::TimeTicks());
6458 }
6459
6460 // Check main frame events.
6461 {
6462 scoped_ptr<FrameTimingTracker::MainFrameTimingSet> timing_set =
6463 tracker->GroupMainFrameCountsByRectId();
6464 EXPECT_EQ(2u, timing_set->size());
6465 auto rect_1_it = timing_set->find(1);
6466 EXPECT_TRUE(rect_1_it != timing_set->end());
6467 const auto& timing_events = rect_1_it->second;
6468 EXPECT_EQ(1u, timing_events.size());
6469 EXPECT_EQ(host_impl->active_tree()->source_frame_number(),
6470 timing_events[0].frame_id);
6471 EXPECT_GT(timing_events[0].timestamp, base::TimeTicks());
6472 EXPECT_GT(timing_events[0].end_time, timing_events[0].timestamp);
6473 }
6455 6474
6456 EndTest(); 6475 EndTest();
6457 } 6476 }
6458 6477
6459 void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override { 6478 void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override {
6460 check_results_on_commit_ = true; 6479 check_results_on_commit_ = true;
6461 PostSetNeedsCommitToMainThread(); 6480 PostSetNeedsCommitToMainThread();
6462 } 6481 }
6463 6482
6464 void AfterTest() override {} 6483 void AfterTest() override {}
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
6624 6643
6625 void AfterTest() override {} 6644 void AfterTest() override {}
6626 6645
6627 private: 6646 private:
6628 scoped_refptr<Layer> child_; 6647 scoped_refptr<Layer> child_;
6629 }; 6648 };
6630 6649
6631 SINGLE_AND_MULTI_THREAD_TEST_F(LayerPreserveRenderSurfaceFromOutputRequests); 6650 SINGLE_AND_MULTI_THREAD_TEST_F(LayerPreserveRenderSurfaceFromOutputRequests);
6632 6651
6633 } // namespace cc 6652 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698