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