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