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 6357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6368 void BeginCommitOnThread(LayerTreeHostImpl* host_impl) override { | 6368 void BeginCommitOnThread(LayerTreeHostImpl* host_impl) override { |
6369 if (!check_results_on_commit_) | 6369 if (!check_results_on_commit_) |
6370 return; | 6370 return; |
6371 | 6371 |
6372 // Since in reality, the events will be read by LayerTreeHost during commit, | 6372 // Since in reality, the events will be read by LayerTreeHost during commit, |
6373 // we check the requests here to ensure that they are correct at the next | 6373 // we check the requests here to ensure that they are correct at the next |
6374 // commit time (as opposed to checking in DrawLayers for instance). | 6374 // commit time (as opposed to checking in DrawLayers for instance). |
6375 // TODO(vmpstr): Change this to read things from the main thread when this | 6375 // TODO(vmpstr): Change this to read things from the main thread when this |
6376 // information is propagated to the main thread (not yet implemented). | 6376 // information is propagated to the main thread (not yet implemented). |
6377 FrameTimingTracker* tracker = host_impl->frame_timing_tracker(); | 6377 FrameTimingTracker* tracker = host_impl->frame_timing_tracker(); |
6378 scoped_ptr<FrameTimingTracker::CompositeTimingSet> timing_set = | 6378 |
6379 tracker->GroupCountsByRectId(); | 6379 // Check composite events. |
6380 EXPECT_EQ(1u, timing_set->size()); | 6380 { |
6381 auto rect_1_it = timing_set->find(1); | 6381 scoped_ptr<FrameTimingTracker::CompositeTimingSet> timing_set = |
6382 EXPECT_TRUE(rect_1_it != timing_set->end()); | 6382 tracker->GroupCompositeCountsByRectId(); |
6383 const auto& timing_events = rect_1_it->second; | 6383 EXPECT_EQ(1u, timing_set->size()); |
6384 EXPECT_EQ(1u, timing_events.size()); | 6384 auto rect_1_it = timing_set->find(1); |
6385 EXPECT_EQ(host_impl->active_tree()->source_frame_number(), | 6385 EXPECT_TRUE(rect_1_it != timing_set->end()); |
6386 timing_events[0].frame_id); | 6386 const auto& timing_events = rect_1_it->second; |
6387 EXPECT_GT(timing_events[0].timestamp, base::TimeTicks()); | 6387 EXPECT_EQ(1u, timing_events.size()); |
| 6388 EXPECT_EQ(host_impl->active_tree()->source_frame_number(), |
| 6389 timing_events[0].frame_id); |
| 6390 EXPECT_GT(timing_events[0].timestamp, base::TimeTicks()); |
| 6391 } |
| 6392 |
| 6393 // Check main frame events. |
| 6394 { |
| 6395 scoped_ptr<FrameTimingTracker::MainFrameTimingSet> timing_set = |
| 6396 tracker->GroupMainFrameCountsByRectId(); |
| 6397 EXPECT_EQ(2u, timing_set->size()); |
| 6398 auto rect_1_it = timing_set->find(1); |
| 6399 EXPECT_TRUE(rect_1_it != timing_set->end()); |
| 6400 const auto& timing_events = rect_1_it->second; |
| 6401 EXPECT_EQ(1u, timing_events.size()); |
| 6402 EXPECT_EQ(host_impl->active_tree()->source_frame_number(), |
| 6403 timing_events[0].frame_id); |
| 6404 EXPECT_GT(timing_events[0].timestamp, base::TimeTicks()); |
| 6405 EXPECT_GT(timing_events[0].end_time, timing_events[0].timestamp); |
| 6406 } |
6388 | 6407 |
6389 EndTest(); | 6408 EndTest(); |
6390 } | 6409 } |
6391 | 6410 |
6392 void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override { | 6411 void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override { |
6393 check_results_on_commit_ = true; | 6412 check_results_on_commit_ = true; |
6394 PostSetNeedsCommitToMainThread(); | 6413 PostSetNeedsCommitToMainThread(); |
6395 } | 6414 } |
6396 | 6415 |
6397 void AfterTest() override {} | 6416 void AfterTest() override {} |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6557 | 6576 |
6558 void AfterTest() override {} | 6577 void AfterTest() override {} |
6559 | 6578 |
6560 private: | 6579 private: |
6561 scoped_refptr<Layer> child_; | 6580 scoped_refptr<Layer> child_; |
6562 }; | 6581 }; |
6563 | 6582 |
6564 SINGLE_AND_MULTI_THREAD_TEST_F(LayerPreserveRenderSurfaceFromOutputRequests); | 6583 SINGLE_AND_MULTI_THREAD_TEST_F(LayerPreserveRenderSurfaceFromOutputRequests); |
6565 | 6584 |
6566 } // namespace cc | 6585 } // namespace cc |
OLD | NEW |