OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 Collections_h | 5 #ifndef Collections_h |
6 #define Collections_h | 6 #define Collections_h |
7 | 7 |
8 #if V8_INSPECTOR_USE_STL | 8 #include <cstddef> |
9 #include "platform/inspector_protocol/CollectionsSTL.h" | 9 |
| 10 #if V8_INSPECTOR_USE_OLD_STL |
| 11 #include <map> |
| 12 #include <set> |
| 13 |
| 14 namespace blink { |
| 15 namespace protocol { |
| 16 |
| 17 template <class Key, class T> using HashMap = std::map<Key, T>; |
| 18 template <class Key> using HashSet = std::set<Key>; |
| 19 |
| 20 } // namespace protocol |
| 21 } // namespace blink |
| 22 |
10 #else | 23 #else |
11 #include "platform/inspector_protocol/CollectionsWTF.h" | 24 #include <unordered_map> |
| 25 #include <unordered_set> |
| 26 |
| 27 namespace blink { |
| 28 namespace protocol { |
| 29 |
| 30 template <class Key, class T> using HashMap = std::unordered_map<Key, T>; |
| 31 template <class Key> using HashSet = std::unordered_set<Key>; |
| 32 |
| 33 } // namespace protocol |
| 34 } // namespace blink |
| 35 |
12 #endif // V8_INSPECTOR_USE_STL | 36 #endif // V8_INSPECTOR_USE_STL |
13 | 37 |
14 | |
15 // Macro that returns a compile time constant with the length of an array, but g
ives an error if passed a non-array. | 38 // Macro that returns a compile time constant with the length of an array, but g
ives an error if passed a non-array. |
16 template<typename T, size_t Size> char (&ArrayLengthHelperFunction(T (&)[Size]))
[Size]; | 39 template<typename T, std::size_t Size> char (&ArrayLengthHelperFunction(T (&)[Si
ze]))[Size]; |
17 // GCC needs some help to deduce a 0 length array. | 40 // GCC needs some help to deduce a 0 length array. |
18 #if defined(__GNUC__) | 41 #if defined(__GNUC__) |
19 template<typename T> char (&ArrayLengthHelperFunction(T (&)[0]))[0]; | 42 template<typename T> char (&ArrayLengthHelperFunction(T (&)[0]))[0]; |
20 #endif | 43 #endif |
21 #define PROTOCOL_ARRAY_LENGTH(array) sizeof(::ArrayLengthHelperFunction(array)) | 44 #define PROTOCOL_ARRAY_LENGTH(array) sizeof(::ArrayLengthHelperFunction(array)) |
22 | 45 |
23 #endif // !defined(Collections_h) | 46 #endif // !defined(Collections_h) |
OLD | NEW |