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

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

Issue 670183003: Update from chromium 62675d9fb31fb8cedc40f68e78e8445a74f362e7 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 2 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
« no previous file with comments | « cc/resources/priority_calculator.cc ('k') | cc/resources/resource.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/resources/raster_tile_priority_queue.h" 5 #include "cc/resources/raster_tile_priority_queue.h"
6 6
7 namespace cc { 7 namespace cc {
8 8
9 namespace { 9 namespace {
10 10
11 class RasterOrderComparator { 11 class RasterOrderComparator {
12 public: 12 public:
13 explicit RasterOrderComparator(TreePriority tree_priority) 13 explicit RasterOrderComparator(TreePriority tree_priority)
14 : tree_priority_(tree_priority) {} 14 : tree_priority_(tree_priority) {}
15 15
16 bool operator()( 16 bool operator()(
17 const RasterTilePriorityQueue::PairedPictureLayerQueue* a, 17 const RasterTilePriorityQueue::PairedPictureLayerQueue* a,
18 const RasterTilePriorityQueue::PairedPictureLayerQueue* b) const { 18 const RasterTilePriorityQueue::PairedPictureLayerQueue* b) const {
19 // Note that in this function, we have to return true if and only if 19 // Note that in this function, we have to return true if and only if
20 // b is strictly lower priority than a. Note that for the sake of 20 // a is strictly lower priority than b. Note that for the sake of
21 // completeness, empty queue is considered to have lowest priority. 21 // completeness, empty queue is considered to have lowest priority.
22 if (a->IsEmpty() || b->IsEmpty()) 22 if (a->IsEmpty() || b->IsEmpty())
23 return b->IsEmpty() < a->IsEmpty(); 23 return b->IsEmpty() < a->IsEmpty();
24 24
25 WhichTree a_tree = a->NextTileIteratorTree(tree_priority_); 25 WhichTree a_tree = a->NextTileIteratorTree(tree_priority_);
26 const PictureLayerImpl::LayerRasterTileIterator* a_iterator = 26 const PictureLayerImpl::LayerRasterTileIterator* a_iterator =
27 a_tree == ACTIVE_TREE ? &a->active_iterator : &a->pending_iterator; 27 a_tree == ACTIVE_TREE ? &a->active_iterator : &a->pending_iterator;
28 28
29 WhichTree b_tree = b->NextTileIteratorTree(tree_priority_); 29 WhichTree b_tree = b->NextTileIteratorTree(tree_priority_);
30 const PictureLayerImpl::LayerRasterTileIterator* b_iterator = 30 const PictureLayerImpl::LayerRasterTileIterator* b_iterator =
31 b_tree == ACTIVE_TREE ? &b->active_iterator : &b->pending_iterator; 31 b_tree == ACTIVE_TREE ? &b->active_iterator : &b->pending_iterator;
32 32
33 const Tile* a_tile = **a_iterator; 33 const Tile* a_tile = **a_iterator;
34 const Tile* b_tile = **b_iterator; 34 const Tile* b_tile = **b_iterator;
35 35
36 const TilePriority& a_priority = 36 const TilePriority& a_priority =
37 a_tile->priority_for_tree_priority(tree_priority_); 37 a_tile->priority_for_tree_priority(tree_priority_);
38 const TilePriority& b_priority = 38 const TilePriority& b_priority =
39 b_tile->priority_for_tree_priority(tree_priority_); 39 b_tile->priority_for_tree_priority(tree_priority_);
40 bool prioritize_low_res = tree_priority_ == SMOOTHNESS_TAKES_PRIORITY; 40 bool prioritize_low_res = tree_priority_ == SMOOTHNESS_TAKES_PRIORITY;
41 41
42 // In smoothness mode, we should return pending NOW tiles before active
43 // EVENTUALLY tiles. So if both priorities here are eventually, we need to
44 // check the pending priority.
45 if (prioritize_low_res &&
46 a_priority.priority_bin == TilePriority::EVENTUALLY &&
47 b_priority.priority_bin == TilePriority::EVENTUALLY) {
48 bool a_is_pending_now =
49 a_tile->priority(PENDING_TREE).priority_bin == TilePriority::NOW;
50 bool b_is_pending_now =
51 b_tile->priority(PENDING_TREE).priority_bin == TilePriority::NOW;
52 if (a_is_pending_now || b_is_pending_now)
53 return a_is_pending_now < b_is_pending_now;
54
55 // In case neither one is pending now, fall through.
56 }
57
42 // If the bin is the same but the resolution is not, then the order will be 58 // If the bin is the same but the resolution is not, then the order will be
43 // determined by whether we prioritize low res or not. 59 // determined by whether we prioritize low res or not.
44 // TODO(vmpstr): Remove this when TilePriority is no longer a member of Tile 60 // TODO(vmpstr): Remove this when TilePriority is no longer a member of Tile
45 // class but instead produced by the iterators. 61 // class but instead produced by the iterators.
46 if (b_priority.priority_bin == a_priority.priority_bin && 62 if (b_priority.priority_bin == a_priority.priority_bin &&
47 b_priority.resolution != a_priority.resolution) { 63 b_priority.resolution != a_priority.resolution) {
48 // Non ideal resolution should be sorted lower than other resolutions. 64 // Non ideal resolution should be sorted lower than other resolutions.
49 if (a_priority.resolution == NON_IDEAL_RESOLUTION) 65 if (a_priority.resolution == NON_IDEAL_RESOLUTION)
50 return true; 66 return true;
51 67
52 if (b_priority.resolution == NON_IDEAL_RESOLUTION) 68 if (b_priority.resolution == NON_IDEAL_RESOLUTION)
53 return false; 69 return false;
54 70
55 if (prioritize_low_res) 71 if (prioritize_low_res)
56 return b_priority.resolution == LOW_RESOLUTION; 72 return b_priority.resolution == LOW_RESOLUTION;
57 return b_priority.resolution == HIGH_RESOLUTION; 73 return b_priority.resolution == HIGH_RESOLUTION;
58 } 74 }
75
59 return b_priority.IsHigherPriorityThan(a_priority); 76 return b_priority.IsHigherPriorityThan(a_priority);
60 } 77 }
61 78
62 private: 79 private:
63 TreePriority tree_priority_; 80 TreePriority tree_priority_;
64 }; 81 };
65 82
66 WhichTree HigherPriorityTree( 83 WhichTree HigherPriorityTree(
67 TreePriority tree_priority, 84 TreePriority tree_priority,
68 const PictureLayerImpl::LayerRasterTileIterator* active_iterator, 85 const PictureLayerImpl::LayerRasterTileIterator* active_iterator,
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 ? (*pending_iterator)->priority(PENDING_TREE).priority_bin 301 ? (*pending_iterator)->priority(PENDING_TREE).priority_bin
285 : TilePriority::EVENTUALLY; 302 : TilePriority::EVENTUALLY;
286 state->SetBoolean("has_tile", !!pending_iterator); 303 state->SetBoolean("has_tile", !!pending_iterator);
287 state->SetInteger("active_priority_bin", active_priority_bin); 304 state->SetInteger("active_priority_bin", active_priority_bin);
288 state->SetInteger("pending_priority_bin", pending_priority_bin); 305 state->SetInteger("pending_priority_bin", pending_priority_bin);
289 state->EndDictionary(); 306 state->EndDictionary();
290 return state; 307 return state;
291 } 308 }
292 309
293 } // namespace cc 310 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/priority_calculator.cc ('k') | cc/resources/resource.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698