| OLD | NEW |
| 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 6140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6151 void BeginCommitOnThread(LayerTreeHostImpl* host_impl) override { | 6151 void BeginCommitOnThread(LayerTreeHostImpl* host_impl) override { |
| 6152 if (!check_results_on_commit_) | 6152 if (!check_results_on_commit_) |
| 6153 return; | 6153 return; |
| 6154 | 6154 |
| 6155 // Since in reality, the events will be read by LayerTreeHost during commit, | 6155 // Since in reality, the events will be read by LayerTreeHost during commit, |
| 6156 // we check the requests here to ensure that they are correct at the next | 6156 // we check the requests here to ensure that they are correct at the next |
| 6157 // commit time (as opposed to checking in DrawLayers for instance). | 6157 // commit time (as opposed to checking in DrawLayers for instance). |
| 6158 // TODO(vmpstr): Change this to read things from the main thread when this | 6158 // TODO(vmpstr): Change this to read things from the main thread when this |
| 6159 // information is propagated to the main thread (not yet implemented). | 6159 // information is propagated to the main thread (not yet implemented). |
| 6160 FrameTimingTracker* tracker = host_impl->frame_timing_tracker(); | 6160 FrameTimingTracker* tracker = host_impl->frame_timing_tracker(); |
| 6161 scoped_ptr<FrameTimingTracker::CompositeTimingSet> timing_set = | 6161 |
| 6162 tracker->GroupCountsByRectId(); | 6162 // Check composite events. |
| 6163 EXPECT_EQ(1u, timing_set->size()); | 6163 { |
| 6164 auto rect_1_it = timing_set->find(1); | 6164 scoped_ptr<FrameTimingTracker::CompositeTimingSet> timing_set = |
| 6165 EXPECT_TRUE(rect_1_it != timing_set->end()); | 6165 tracker->GroupCompositeCountsByRectId(); |
| 6166 const auto& timing_events = rect_1_it->second; | 6166 EXPECT_EQ(1u, timing_set->size()); |
| 6167 EXPECT_EQ(1u, timing_events.size()); | 6167 auto rect_1_it = timing_set->find(1); |
| 6168 EXPECT_EQ(host_impl->active_tree()->source_frame_number(), | 6168 EXPECT_TRUE(rect_1_it != timing_set->end()); |
| 6169 timing_events[0].frame_id); | 6169 const auto& timing_events = rect_1_it->second; |
| 6170 EXPECT_GT(timing_events[0].timestamp, base::TimeTicks()); | 6170 EXPECT_EQ(1u, timing_events.size()); |
| 6171 EXPECT_EQ(host_impl->active_tree()->source_frame_number(), |
| 6172 timing_events[0].frame_id); |
| 6173 EXPECT_GT(timing_events[0].timestamp, base::TimeTicks()); |
| 6174 } |
| 6175 |
| 6176 // Check main frame events. |
| 6177 { |
| 6178 scoped_ptr<FrameTimingTracker::MainFrameTimingSet> timing_set = |
| 6179 tracker->GroupMainFrameCountsByRectId(); |
| 6180 EXPECT_EQ(2u, timing_set->size()); |
| 6181 auto rect_1_it = timing_set->find(1); |
| 6182 EXPECT_TRUE(rect_1_it != timing_set->end()); |
| 6183 const auto& timing_events = rect_1_it->second; |
| 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 EXPECT_GT(timing_events[0].duration, base::TimeDelta()); |
| 6189 } |
| 6171 | 6190 |
| 6172 EndTest(); | 6191 EndTest(); |
| 6173 } | 6192 } |
| 6174 | 6193 |
| 6175 void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override { | 6194 void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override { |
| 6176 check_results_on_commit_ = true; | 6195 check_results_on_commit_ = true; |
| 6177 PostSetNeedsCommitToMainThread(); | 6196 PostSetNeedsCommitToMainThread(); |
| 6178 } | 6197 } |
| 6179 | 6198 |
| 6180 void AfterTest() override {} | 6199 void AfterTest() override {} |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6261 | 6280 |
| 6262 void AfterTest() override { EXPECT_TRUE(did_commit_); } | 6281 void AfterTest() override { EXPECT_TRUE(did_commit_); } |
| 6263 | 6282 |
| 6264 private: | 6283 private: |
| 6265 bool did_commit_; | 6284 bool did_commit_; |
| 6266 }; | 6285 }; |
| 6267 | 6286 |
| 6268 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestNoTasksBetweenWillAndDidCommit); | 6287 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestNoTasksBetweenWillAndDidCommit); |
| 6269 | 6288 |
| 6270 } // namespace cc | 6289 } // namespace cc |
| OLD | NEW |