Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(284)

Side by Side Diff: cc/resources/prioritized_tile_set_unittest.cc

Issue 140513006: cc: Simplify picture layer tiling update tile priorities. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 <algorithm> 5 #include <algorithm>
6 #include <vector> 6 #include <vector>
7 7
8 #include "cc/resources/managed_tile_state.h" 8 #include "cc/resources/managed_tile_state.h"
9 #include "cc/resources/prioritized_tile_set.h" 9 #include "cc/resources/prioritized_tile_set.h"
10 #include "cc/resources/tile.h" 10 #include "cc/resources/tile.h"
11 #include "cc/test/fake_output_surface.h" 11 #include "cc/test/fake_output_surface.h"
12 #include "cc/test/fake_output_surface_client.h" 12 #include "cc/test/fake_output_surface_client.h"
13 #include "cc/test/fake_picture_pile_impl.h" 13 #include "cc/test/fake_picture_pile_impl.h"
14 #include "cc/test/fake_tile_manager.h" 14 #include "cc/test/fake_tile_manager.h"
15 #include "cc/test/fake_tile_manager_client.h" 15 #include "cc/test/fake_tile_manager_client.h"
16 #include "cc/test/test_tile_priorities.h" 16 #include "cc/test/test_tile_priorities.h"
17 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
18 18
19 namespace cc { 19 namespace cc {
20 20
21 class BinComparator { 21 class BinComparator {
22 public: 22 public:
23 bool operator()(const scoped_refptr<Tile>& a, 23 bool operator()(const scoped_refptr<Tile>& a,
24 const scoped_refptr<Tile>& b) const { 24 const scoped_refptr<Tile>& b) const {
25 const ManagedTileState& ams = a->managed_state(); 25 const ManagedTileState& ams = a->managed_state();
26 const ManagedTileState& bms = b->managed_state(); 26 const ManagedTileState& bms = b->managed_state();
27 27
28 if (ams.priority_bin != bms.priority_bin)
29 return ams.priority_bin < bms.priority_bin;
30
28 if (ams.required_for_activation != bms.required_for_activation) 31 if (ams.required_for_activation != bms.required_for_activation)
29 return ams.required_for_activation; 32 return ams.required_for_activation;
30 33
31 if (ams.resolution != bms.resolution) 34 if (ams.resolution != bms.resolution)
32 return ams.resolution < bms.resolution; 35 return ams.resolution < bms.resolution;
33 36
34 if (ams.time_to_needed_in_seconds != bms.time_to_needed_in_seconds) 37 if (ams.distance_to_visible != bms.distance_to_visible)
35 return ams.time_to_needed_in_seconds < bms.time_to_needed_in_seconds; 38 return ams.distance_to_visible < bms.distance_to_visible;
36
37 if (ams.distance_to_visible_in_pixels !=
38 bms.distance_to_visible_in_pixels) {
39 return ams.distance_to_visible_in_pixels <
40 bms.distance_to_visible_in_pixels;
41 }
42 39
43 gfx::Rect a_rect = a->content_rect(); 40 gfx::Rect a_rect = a->content_rect();
44 gfx::Rect b_rect = b->content_rect(); 41 gfx::Rect b_rect = b->content_rect();
45 if (a_rect.y() != b_rect.y()) 42 if (a_rect.y() != b_rect.y())
46 return a_rect.y() < b_rect.y(); 43 return a_rect.y() < b_rect.y();
47 return a_rect.x() < b_rect.x(); 44 return a_rect.x() < b_rect.x();
48 } 45 }
49 }; 46 };
50 47
51 namespace { 48 namespace {
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after
721 718
722 set.Clear(); 719 set.Clear();
723 720
724 PrioritizedTileSet::Iterator empty_it(&set, true); 721 PrioritizedTileSet::Iterator empty_it(&set, true);
725 EXPECT_FALSE(empty_it); 722 EXPECT_FALSE(empty_it);
726 } 723 }
727 724
728 } // namespace 725 } // namespace
729 } // namespace cc 726 } // namespace cc
730 727
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698