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

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: rebase Created 5 years, 8 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/layer_tree_host_impl.cc ('k') | cc/trees/layer_tree_impl.h » ('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/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 6445 matching lines...) Expand 10 before | Expand all | Expand 10 after
6456 void BeginCommitOnThread(LayerTreeHostImpl* host_impl) override { 6456 void BeginCommitOnThread(LayerTreeHostImpl* host_impl) override {
6457 if (!check_results_on_commit_) 6457 if (!check_results_on_commit_)
6458 return; 6458 return;
6459 6459
6460 // Since in reality, the events will be read by LayerTreeHost during commit, 6460 // Since in reality, the events will be read by LayerTreeHost during commit,
6461 // we check the requests here to ensure that they are correct at the next 6461 // we check the requests here to ensure that they are correct at the next
6462 // commit time (as opposed to checking in DrawLayers for instance). 6462 // commit time (as opposed to checking in DrawLayers for instance).
6463 // TODO(vmpstr): Change this to read things from the main thread when this 6463 // TODO(vmpstr): Change this to read things from the main thread when this
6464 // information is propagated to the main thread (not yet implemented). 6464 // information is propagated to the main thread (not yet implemented).
6465 FrameTimingTracker* tracker = host_impl->frame_timing_tracker(); 6465 FrameTimingTracker* tracker = host_impl->frame_timing_tracker();
6466 scoped_ptr<FrameTimingTracker::CompositeTimingSet> timing_set = 6466
6467 tracker->GroupCountsByRectId(); 6467 // Check composite events.
6468 EXPECT_EQ(1u, timing_set->size()); 6468 {
6469 auto rect_1_it = timing_set->find(1); 6469 scoped_ptr<FrameTimingTracker::CompositeTimingSet> timing_set =
6470 EXPECT_TRUE(rect_1_it != timing_set->end()); 6470 tracker->GroupCompositeCountsByRectId();
6471 const auto& timing_events = rect_1_it->second; 6471 EXPECT_EQ(1u, timing_set->size());
6472 EXPECT_EQ(1u, timing_events.size()); 6472 auto rect_1_it = timing_set->find(1);
6473 EXPECT_EQ(host_impl->active_tree()->source_frame_number(), 6473 EXPECT_TRUE(rect_1_it != timing_set->end());
6474 timing_events[0].frame_id); 6474 const auto& timing_events = rect_1_it->second;
6475 EXPECT_GT(timing_events[0].timestamp, base::TimeTicks()); 6475 EXPECT_EQ(1u, timing_events.size());
6476 EXPECT_EQ(host_impl->active_tree()->source_frame_number(),
6477 timing_events[0].frame_id);
6478 EXPECT_GT(timing_events[0].timestamp, base::TimeTicks());
6479 }
6480
6481 // Check main frame events.
6482 {
6483 scoped_ptr<FrameTimingTracker::MainFrameTimingSet> timing_set =
6484 tracker->GroupMainFrameCountsByRectId();
6485 EXPECT_EQ(2u, timing_set->size());
6486 auto rect_1_it = timing_set->find(1);
6487 EXPECT_TRUE(rect_1_it != timing_set->end());
6488 const auto& timing_events = rect_1_it->second;
6489 EXPECT_EQ(1u, timing_events.size());
6490 EXPECT_EQ(host_impl->active_tree()->source_frame_number(),
6491 timing_events[0].frame_id);
6492 EXPECT_GT(timing_events[0].timestamp, base::TimeTicks());
6493 EXPECT_GT(timing_events[0].end_time, timing_events[0].timestamp);
6494 }
6476 6495
6477 EndTest(); 6496 EndTest();
6478 } 6497 }
6479 6498
6480 void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override { 6499 void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override {
6481 check_results_on_commit_ = true; 6500 check_results_on_commit_ = true;
6482 PostSetNeedsCommitToMainThread(); 6501 PostSetNeedsCommitToMainThread();
6483 } 6502 }
6484 6503
6485 void AfterTest() override {} 6504 void AfterTest() override {}
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
6645 6664
6646 void AfterTest() override {} 6665 void AfterTest() override {}
6647 6666
6648 private: 6667 private:
6649 scoped_refptr<Layer> child_; 6668 scoped_refptr<Layer> child_;
6650 }; 6669 };
6651 6670
6652 SINGLE_AND_MULTI_THREAD_TEST_F(LayerPreserveRenderSurfaceFromOutputRequests); 6671 SINGLE_AND_MULTI_THREAD_TEST_F(LayerPreserveRenderSurfaceFromOutputRequests);
6653 6672
6654 } // namespace cc 6673 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_impl.cc ('k') | cc/trees/layer_tree_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698