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

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: update 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 6154 matching lines...) Expand 10 before | Expand all | Expand 10 after
6165 void BeginCommitOnThread(LayerTreeHostImpl* host_impl) override { 6165 void BeginCommitOnThread(LayerTreeHostImpl* host_impl) override {
6166 if (!check_results_on_commit_) 6166 if (!check_results_on_commit_)
6167 return; 6167 return;
6168 6168
6169 // Since in reality, the events will be read by LayerTreeHost during commit, 6169 // Since in reality, the events will be read by LayerTreeHost during commit,
6170 // we check the requests here to ensure that they are correct at the next 6170 // we check the requests here to ensure that they are correct at the next
6171 // commit time (as opposed to checking in DrawLayers for instance). 6171 // commit time (as opposed to checking in DrawLayers for instance).
6172 // TODO(vmpstr): Change this to read things from the main thread when this 6172 // TODO(vmpstr): Change this to read things from the main thread when this
6173 // information is propagated to the main thread (not yet implemented). 6173 // information is propagated to the main thread (not yet implemented).
6174 FrameTimingTracker* tracker = host_impl->frame_timing_tracker(); 6174 FrameTimingTracker* tracker = host_impl->frame_timing_tracker();
6175 scoped_ptr<FrameTimingTracker::CompositeTimingSet> timing_set = 6175
6176 tracker->GroupCountsByRectId(); 6176 // Check composite events.
6177 EXPECT_EQ(1u, timing_set->size()); 6177 {
6178 auto rect_1_it = timing_set->find(1); 6178 scoped_ptr<FrameTimingTracker::CompositeTimingSet> timing_set =
6179 EXPECT_TRUE(rect_1_it != timing_set->end()); 6179 tracker->GroupCompositeCountsByRectId();
6180 const auto& timing_events = rect_1_it->second; 6180 EXPECT_EQ(1u, timing_set->size());
6181 EXPECT_EQ(1u, timing_events.size()); 6181 auto rect_1_it = timing_set->find(1);
6182 EXPECT_EQ(host_impl->active_tree()->source_frame_number(), 6182 EXPECT_TRUE(rect_1_it != timing_set->end());
6183 timing_events[0].frame_id); 6183 const auto& timing_events = rect_1_it->second;
6184 EXPECT_GT(timing_events[0].timestamp, base::TimeTicks()); 6184 EXPECT_EQ(1u, timing_events.size());
6185 EXPECT_EQ(host_impl->active_tree()->source_frame_number(),
6186 timing_events[0].frame_id);
6187 EXPECT_GT(timing_events[0].timestamp, base::TimeTicks());
6188 }
6189
6190 // Check main frame events.
6191 {
6192 scoped_ptr<FrameTimingTracker::MainFrameTimingSet> timing_set =
6193 tracker->GroupMainFrameCountsByRectId();
6194 EXPECT_EQ(2u, timing_set->size());
6195 auto rect_1_it = timing_set->find(1);
6196 EXPECT_TRUE(rect_1_it != timing_set->end());
6197 const auto& timing_events = rect_1_it->second;
6198 EXPECT_EQ(1u, timing_events.size());
6199 EXPECT_EQ(host_impl->active_tree()->source_frame_number(),
6200 timing_events[0].frame_id);
6201 EXPECT_GT(timing_events[0].timestamp, base::TimeTicks());
6202 EXPECT_GT(timing_events[0].end_time, timing_events[0].timestamp);
6203 }
6185 6204
6186 EndTest(); 6205 EndTest();
6187 } 6206 }
6188 6207
6189 void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override { 6208 void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override {
6190 check_results_on_commit_ = true; 6209 check_results_on_commit_ = true;
6191 PostSetNeedsCommitToMainThread(); 6210 PostSetNeedsCommitToMainThread();
6192 } 6211 }
6193 6212
6194 void AfterTest() override {} 6213 void AfterTest() override {}
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
6354 6373
6355 void AfterTest() override {} 6374 void AfterTest() override {}
6356 6375
6357 private: 6376 private:
6358 scoped_refptr<Layer> child_; 6377 scoped_refptr<Layer> child_;
6359 }; 6378 };
6360 6379
6361 SINGLE_AND_MULTI_THREAD_TEST_F(LayerPreserveRenderSurfaceFromOutputRequests); 6380 SINGLE_AND_MULTI_THREAD_TEST_F(LayerPreserveRenderSurfaceFromOutputRequests);
6362 6381
6363 } // namespace cc 6382 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698