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

Side by Side Diff: mojo/edk/system/channel_endpoint_id.h

Issue 623383002: Align base::hash_map with C++11, part 2. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@hash-1
Patch Set: clean up stale includes Created 6 years, 1 month 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 | « content/renderer/pepper/v8_var_converter.cc ('k') | net/dns/dns_hosts.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 #ifndef MOJO_EDK_SYSTEM_CHANNEL_ENDPOINT_ID_H_ 5 #ifndef MOJO_EDK_SYSTEM_CHANNEL_ENDPOINT_ID_H_
6 #define MOJO_EDK_SYSTEM_CHANNEL_ENDPOINT_ID_H_ 6 #define MOJO_EDK_SYSTEM_CHANNEL_ENDPOINT_ID_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include <ostream> 11 #include <ostream>
12 12
13 #include "base/containers/hash_tables.h" 13 #include "base/containers/hash_tables.h"
14 #include "base/gtest_prod_util.h" 14 #include "base/gtest_prod_util.h"
15 #include "base/macros.h" 15 #include "base/macros.h"
16 #include "build/build_config.h"
17 #include "mojo/edk/system/system_impl_export.h" 16 #include "mojo/edk/system/system_impl_export.h"
18 17
19 namespace mojo { 18 namespace mojo {
20 namespace system { 19 namespace system {
21 20
22 // ChannelEndpointId ----------------------------------------------------------- 21 // ChannelEndpointId -----------------------------------------------------------
23 22
24 class LocalChannelEndpointIdGenerator; 23 class LocalChannelEndpointIdGenerator;
25 FORWARD_DECLARE_TEST(LocalChannelEndpointIdGeneratorTest, WrapAround); 24 FORWARD_DECLARE_TEST(LocalChannelEndpointIdGeneratorTest, WrapAround);
26 FORWARD_DECLARE_TEST(RemoteChannelEndpointIdGeneratorTest, WrapAround); 25 FORWARD_DECLARE_TEST(RemoteChannelEndpointIdGeneratorTest, WrapAround);
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 125
127 DISALLOW_COPY_AND_ASSIGN(RemoteChannelEndpointIdGenerator); 126 DISALLOW_COPY_AND_ASSIGN(RemoteChannelEndpointIdGenerator);
128 }; 127 };
129 128
130 } // namespace system 129 } // namespace system
131 } // namespace mojo 130 } // namespace mojo
132 131
133 // Define "hash" functions for |ChannelEndpointId|s, so they can be used in hash 132 // Define "hash" functions for |ChannelEndpointId|s, so they can be used in hash
134 // tables. 133 // tables.
135 // TODO(vtl): Once we can use |std::unordered_{map,set}|, update this (and 134 // TODO(vtl): Once we can use |std::unordered_{map,set}|, update this (and
136 // remove the base/containers/hash_tables.h and build/build_config.h includes). 135 // remove the base/containers/hash_tables.h include).
137 namespace BASE_HASH_NAMESPACE { 136 namespace BASE_HASH_NAMESPACE {
138 137
139 #if defined(COMPILER_GCC)
140
141 template <> 138 template <>
142 struct hash<mojo::system::ChannelEndpointId> { 139 struct hash<mojo::system::ChannelEndpointId> {
143 size_t operator()(mojo::system::ChannelEndpointId channel_endpoint_id) const { 140 size_t operator()(mojo::system::ChannelEndpointId channel_endpoint_id) const {
144 return static_cast<size_t>(channel_endpoint_id.value()); 141 return static_cast<size_t>(channel_endpoint_id.value());
145 } 142 }
146 }; 143 };
147 144
148 #elif defined(COMPILER_MSVC)
149
150 inline size_t hash_value(mojo::system::ChannelEndpointId channel_endpoint_id) {
151 return static_cast<size_t>(channel_endpoint_id.value());
152 }
153 #endif
154
155 } // namespace BASE_HASH_NAMESPACE 145 } // namespace BASE_HASH_NAMESPACE
156 146
157 #endif // MOJO_EDK_SYSTEM_CHANNEL_ENDPOINT_ID_H_ 147 #endif // MOJO_EDK_SYSTEM_CHANNEL_ENDPOINT_ID_H_
OLDNEW
« no previous file with comments | « content/renderer/pepper/v8_var_converter.cc ('k') | net/dns/dns_hosts.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698