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

Side by Side Diff: media/blink/multibuffer.h

Issue 1610023003: Revert of Allow std::unordered_*. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
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 MEDIA_BLINK_MULTIBUFFER_H_ 5 #ifndef MEDIA_BLINK_MULTIBUFFER_H_
6 #define MEDIA_BLINK_MULTIBUFFER_H_ 6 #define MEDIA_BLINK_MULTIBUFFER_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include <limits> 11 #include <limits>
12 #include <map> 12 #include <map>
13 #include <set> 13 #include <set>
14 #include <vector> 14 #include <vector>
15 15
16 #include "base/callback.h" 16 #include "base/callback.h"
17 #include "base/containers/hash_tables.h" 17 #include "base/containers/hash_tables.h"
18 #include "base/hash.h"
19 #include "base/macros.h" 18 #include "base/macros.h"
20 #include "base/memory/ref_counted.h" 19 #include "base/memory/ref_counted.h"
21 #include "base/memory/scoped_ptr.h" 20 #include "base/memory/scoped_ptr.h"
22 #include "build/build_config.h" 21 #include "build/build_config.h"
23 #include "media/base/data_buffer.h" 22 #include "media/base/data_buffer.h"
24 #include "media/blink/interval_map.h" 23 #include "media/blink/interval_map.h"
25 #include "media/blink/lru.h" 24 #include "media/blink/lru.h"
26 #include "media/blink/media_blink_export.h" 25 #include "media/blink/media_blink_export.h"
27 26
28 namespace media { 27 namespace media {
29 28
30 // Used to identify a block of data in the multibuffer. 29 // Used to identify a block of data in the multibuffer.
31 // Our blocks are 32kb (1 << 15), so our maximum cacheable file size 30 // Our blocks are 32kb (1 << 15), so our maximum cacheable file size
32 // is 1 << (15 + 31) = 64Tb 31 // is 1 << (15 + 31) = 64Tb
33 typedef int32_t MultiBufferBlockId; 32 typedef int32_t MultiBufferBlockId;
34 class MultiBuffer; 33 class MultiBuffer;
35 34
36 // This type is used to identify a block in the LRU, which is shared between 35 // This type is used to identify a block in the LRU, which is shared between
37 // multibuffers. 36 // multibuffers.
38 typedef std::pair<MultiBuffer*, MultiBufferBlockId> MultiBufferGlobalBlockId; 37 typedef std::pair<MultiBuffer*, MultiBufferBlockId> MultiBufferGlobalBlockId;
39 38
40 } // namespace media 39 } // namespace media
41 40
42 namespace BASE_HASH_NAMESPACE { 41 namespace BASE_HASH_NAMESPACE {
43 42
44 template <> 43 template <>
45 struct hash<media::MultiBufferGlobalBlockId> { 44 struct hash<media::MultiBufferGlobalBlockId> {
46 std::size_t operator()(const media::MultiBufferGlobalBlockId& key) const { 45 std::size_t operator()(const media::MultiBufferGlobalBlockId& key) const {
47 return base::HashInts(reinterpret_cast<uintptr_t>(key.first), key.second); 46 // It would be nice if we could use intptr_t instead of int64_t here, but
47 // on some platforms, int64_t is declared as "long" which doesn't match
48 // any of the HashPair() functions. This leads to a compile error since
49 // the compiler can't decide which HashPair() function to call.
50 #if defined(ARCH_CPU_64_BITS)
51 return base::HashPair(reinterpret_cast<int64_t>(key.first), key.second);
52 #else
53 return base::HashPair(reinterpret_cast<int32_t>(key.first), key.second);
54 #endif
48 } 55 }
49 }; 56 };
50 57
51 } // namespace BASE_HASH_NAMESPACE 58 } // namespace BASE_HASH_NAMESPACE
52 59
53 namespace media { 60 namespace media {
54 61
55 // Freeing a lot of blocks can be expensive, to keep thing 62 // Freeing a lot of blocks can be expensive, to keep thing
56 // flowing smoothly we only free a maximum of |kMaxFreesPerAdd| 63 // flowing smoothly we only free a maximum of |kMaxFreesPerAdd|
57 // blocks when a new block is added to the cache. 64 // blocks when a new block is added to the cache.
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 // and 0 for all blocks that are not. Used to quickly figure out 318 // and 0 for all blocks that are not. Used to quickly figure out
312 // ranges of available/unavailable blocks without iterating. 319 // ranges of available/unavailable blocks without iterating.
313 IntervalMap<BlockId, int32_t> present_; 320 IntervalMap<BlockId, int32_t> present_;
314 321
315 DISALLOW_COPY_AND_ASSIGN(MultiBuffer); 322 DISALLOW_COPY_AND_ASSIGN(MultiBuffer);
316 }; 323 };
317 324
318 } // namespace media 325 } // namespace media
319 326
320 #endif // MEDIA_BLINK_MULTIBUFFER_H_ 327 #endif // MEDIA_BLINK_MULTIBUFFER_H_
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/framebuffer_completeness_cache.h ('k') | net/base/network_change_notifier_linux.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698