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