OLD | NEW |
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 #include "mojo/edk/system/platform_handle_dispatcher.h" | 5 #include "mojo/edk/system/platform_handle_dispatcher.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 | 11 |
12 using mojo::platform::ScopedPlatformHandle; | 12 using mojo::platform::ScopedPlatformHandle; |
13 using mojo::util::MutexLocker; | 13 using mojo::util::MutexLocker; |
14 using mojo::util::RefPtr; | 14 using mojo::util::RefPtr; |
15 | 15 |
16 namespace mojo { | 16 namespace mojo { |
17 namespace system { | 17 namespace system { |
18 | 18 |
19 namespace { | 19 namespace { |
20 | 20 |
21 const size_t kInvalidPlatformHandleIndex = static_cast<size_t>(-1); | 21 const size_t kInvalidPlatformHandleIndex = static_cast<size_t>(-1); |
22 | 22 |
23 struct SerializedPlatformHandleDispatcher { | 23 struct SerializedPlatformHandleDispatcher { |
24 size_t platform_handle_index; // (Or |kInvalidPlatformHandleIndex|.) | 24 size_t platform_handle_index; // (Or |kInvalidPlatformHandleIndex|.) |
25 }; | 25 }; |
26 | 26 |
27 } // namespace | 27 } // namespace |
28 | 28 |
| 29 // static |
| 30 constexpr MojoHandleRights PlatformHandleDispatcher::kDefaultHandleRights; |
| 31 |
29 ScopedPlatformHandle PlatformHandleDispatcher::PassPlatformHandle() { | 32 ScopedPlatformHandle PlatformHandleDispatcher::PassPlatformHandle() { |
30 MutexLocker locker(&mutex()); | 33 MutexLocker locker(&mutex()); |
31 return platform_handle_.Pass(); | 34 return platform_handle_.Pass(); |
32 } | 35 } |
33 | 36 |
34 Dispatcher::Type PlatformHandleDispatcher::GetType() const { | 37 Dispatcher::Type PlatformHandleDispatcher::GetType() const { |
35 return Type::PLATFORM_HANDLE; | 38 return Type::PLATFORM_HANDLE; |
36 } | 39 } |
37 | 40 |
38 bool PlatformHandleDispatcher::SupportsEntrypointClass( | 41 bool PlatformHandleDispatcher::SupportsEntrypointClass( |
(...skipping 79 matching lines...) Loading... |
118 } else { | 121 } else { |
119 serialization->platform_handle_index = kInvalidPlatformHandleIndex; | 122 serialization->platform_handle_index = kInvalidPlatformHandleIndex; |
120 } | 123 } |
121 | 124 |
122 *actual_size = sizeof(SerializedPlatformHandleDispatcher); | 125 *actual_size = sizeof(SerializedPlatformHandleDispatcher); |
123 return true; | 126 return true; |
124 } | 127 } |
125 | 128 |
126 } // namespace system | 129 } // namespace system |
127 } // namespace mojo | 130 } // namespace mojo |
OLD | NEW |