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

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

Issue 683583002: Update mojo sdk to rev e083961bf11fd0c94d40be8853761da529b6d444 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
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"
16 #include "mojo/edk/system/system_impl_export.h" 17 #include "mojo/edk/system/system_impl_export.h"
17 18
18 namespace mojo { 19 namespace mojo {
19 namespace system { 20 namespace system {
20 21
21 // ChannelEndpointId ----------------------------------------------------------- 22 // ChannelEndpointId -----------------------------------------------------------
22 23
23 class LocalChannelEndpointIdGenerator; 24 class LocalChannelEndpointIdGenerator;
24 FORWARD_DECLARE_TEST(LocalChannelEndpointIdGeneratorTest, WrapAround); 25 FORWARD_DECLARE_TEST(LocalChannelEndpointIdGeneratorTest, WrapAround);
25 FORWARD_DECLARE_TEST(RemoteChannelEndpointIdGeneratorTest, WrapAround); 26 FORWARD_DECLARE_TEST(RemoteChannelEndpointIdGeneratorTest, WrapAround);
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 126
126 DISALLOW_COPY_AND_ASSIGN(RemoteChannelEndpointIdGenerator); 127 DISALLOW_COPY_AND_ASSIGN(RemoteChannelEndpointIdGenerator);
127 }; 128 };
128 129
129 } // namespace system 130 } // namespace system
130 } // namespace mojo 131 } // namespace mojo
131 132
132 // Define "hash" functions for |ChannelEndpointId|s, so they can be used in hash 133 // Define "hash" functions for |ChannelEndpointId|s, so they can be used in hash
133 // tables. 134 // tables.
134 // TODO(vtl): Once we can use |std::unordered_{map,set}|, update this (and 135 // TODO(vtl): Once we can use |std::unordered_{map,set}|, update this (and
135 // remove the base/containers/hash_tables.h include). 136 // remove the base/containers/hash_tables.h and build/build_config.h includes).
136 namespace BASE_HASH_NAMESPACE { 137 namespace BASE_HASH_NAMESPACE {
137 138
139 #if defined(COMPILER_GCC)
jamesr 2014/10/27 20:28:20 actually we don't need this any more, the hashing
Aaron Boodman 2014/10/28 22:38:47 Done.
140
138 template <> 141 template <>
139 struct hash<mojo::system::ChannelEndpointId> { 142 struct hash<mojo::system::ChannelEndpointId> {
140 size_t operator()(mojo::system::ChannelEndpointId channel_endpoint_id) const { 143 size_t operator()(mojo::system::ChannelEndpointId channel_endpoint_id) const {
141 return static_cast<size_t>(channel_endpoint_id.value()); 144 return static_cast<size_t>(channel_endpoint_id.value());
142 } 145 }
143 }; 146 };
144 147
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
145 } // namespace BASE_HASH_NAMESPACE 155 } // namespace BASE_HASH_NAMESPACE
146 156
147 #endif // MOJO_EDK_SYSTEM_CHANNEL_ENDPOINT_ID_H_ 157 #endif // MOJO_EDK_SYSTEM_CHANNEL_ENDPOINT_ID_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698