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

Side by Side Diff: cc/tiles/image_decode_controller.h

Issue 1615713003: Allow std::unordered_*. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: leak_detector fixes and git cl format Created 4 years, 11 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/surfaces/surface_sequence.h ('k') | chrome/browser/devtools/devtools_file_watcher.cc » ('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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #ifndef CC_TILES_IMAGE_DECODE_CONTROLLER_H_ 5 #ifndef CC_TILES_IMAGE_DECODE_CONTROLLER_H_
6 #define CC_TILES_IMAGE_DECODE_CONTROLLER_H_ 6 #define CC_TILES_IMAGE_DECODE_CONTROLLER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/containers/hash_tables.h" 10 #include "base/containers/hash_tables.h"
11 #include "base/hash.h"
11 #include "base/memory/discardable_memory_allocator.h" 12 #include "base/memory/discardable_memory_allocator.h"
12 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
13 #include "base/numerics/safe_math.h" 14 #include "base/numerics/safe_math.h"
14 #include "base/threading/thread_checker.h" 15 #include "base/threading/thread_checker.h"
15 #include "cc/base/cc_export.h" 16 #include "cc/base/cc_export.h"
16 #include "cc/playback/decoded_draw_image.h" 17 #include "cc/playback/decoded_draw_image.h"
17 #include "cc/playback/draw_image.h" 18 #include "cc/playback/draw_image.h"
18 #include "cc/raster/tile_task_runner.h" 19 #include "cc/raster/tile_task_runner.h"
19 #include "skia/ext/refptr.h" 20 #include "skia/ext/refptr.h"
20 21
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 } // namespace cc 73 } // namespace cc
73 74
74 // Hash function for the above ImageDecodeControllerKey. 75 // Hash function for the above ImageDecodeControllerKey.
75 namespace BASE_HASH_NAMESPACE { 76 namespace BASE_HASH_NAMESPACE {
76 template <> 77 template <>
77 struct hash<cc::ImageDecodeControllerKey> { 78 struct hash<cc::ImageDecodeControllerKey> {
78 size_t operator()(const cc::ImageDecodeControllerKey& key) const { 79 size_t operator()(const cc::ImageDecodeControllerKey& key) const {
79 // TODO(vmpstr): This is a mess. Maybe it's faster to just search the vector 80 // TODO(vmpstr): This is a mess. Maybe it's faster to just search the vector
80 // always (forwards or backwards to account for LRU). 81 // always (forwards or backwards to account for LRU).
81 uint64_t src_rect_hash = 82 uint64_t src_rect_hash =
82 base::HashPair(static_cast<uint64_t>(base::HashPair( 83 base::HashInts(static_cast<uint64_t>(base::HashInts(
83 key.src_rect().x(), key.src_rect().y())), 84 key.src_rect().x(), key.src_rect().y())),
84 static_cast<uint64_t>(base::HashPair( 85 static_cast<uint64_t>(base::HashInts(
85 key.src_rect().width(), key.src_rect().height()))); 86 key.src_rect().width(), key.src_rect().height())));
86 87
87 uint64_t target_size_hash = 88 uint64_t target_size_hash =
88 base::HashPair(key.target_size().width(), key.target_size().height()); 89 base::HashInts(key.target_size().width(), key.target_size().height());
89 90
90 return base::HashPair(base::HashPair(src_rect_hash, target_size_hash), 91 return base::HashInts(base::HashInts(src_rect_hash, target_size_hash),
91 base::HashPair(key.image_id(), key.filter_quality())); 92 base::HashInts(key.image_id(), key.filter_quality()));
92 } 93 }
93 }; 94 };
94 } // namespace BASE_HASH_NAMESPACE 95 } // namespace BASE_HASH_NAMESPACE
95 96
96 namespace cc { 97 namespace cc {
97 98
98 // ImageDecodeController is responsible for generating decode tasks, decoding 99 // ImageDecodeController is responsible for generating decode tasks, decoding
99 // images, storing images in cache, and being able to return the decoded images 100 // images, storing images in cache, and being able to return the decoded images
100 // when requested. 101 // when requested.
101 102
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 250
250 // Note that this is used for cases where the only thing we do is preroll the 251 // Note that this is used for cases where the only thing we do is preroll the
251 // image the first time we see it. This mimics the previous behavior and 252 // image the first time we see it. This mimics the previous behavior and
252 // should over time change as the compositor starts to handle more cases. 253 // should over time change as the compositor starts to handle more cases.
253 base::hash_set<uint32_t> prerolled_images_; 254 base::hash_set<uint32_t> prerolled_images_;
254 }; 255 };
255 256
256 } // namespace cc 257 } // namespace cc
257 258
258 #endif // CC_TILES_IMAGE_DECODE_CONTROLLER_H_ 259 #endif // CC_TILES_IMAGE_DECODE_CONTROLLER_H_
OLDNEW
« no previous file with comments | « cc/surfaces/surface_sequence.h ('k') | chrome/browser/devtools/devtools_file_watcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698