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 #ifndef MOJO_EDK_SYSTEM_PLATFORM_HANDLE_DISPATCHER_H_ | 5 #ifndef MOJO_EDK_SYSTEM_PLATFORM_HANDLE_DISPATCHER_H_ |
6 #define MOJO_EDK_SYSTEM_PLATFORM_HANDLE_DISPATCHER_H_ | 6 #define MOJO_EDK_SYSTEM_PLATFORM_HANDLE_DISPATCHER_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "mojo/edk/platform/scoped_platform_handle.h" | 10 #include "mojo/edk/platform/scoped_platform_handle.h" |
11 #include "mojo/edk/system/simple_dispatcher.h" | 11 #include "mojo/edk/system/simple_dispatcher.h" |
12 #include "mojo/edk/util/ref_ptr.h" | 12 #include "mojo/edk/util/ref_ptr.h" |
13 #include "mojo/edk/util/thread_annotations.h" | 13 #include "mojo/edk/util/thread_annotations.h" |
14 #include "mojo/public/cpp/system/macros.h" | 14 #include "mojo/public/cpp/system/macros.h" |
15 | 15 |
16 namespace mojo { | 16 namespace mojo { |
17 namespace system { | 17 namespace system { |
18 | 18 |
19 // A dispatcher that simply wraps/transports a |PlatformHandle| (only for use by | 19 // A dispatcher that simply wraps/transports a |PlatformHandle| (only for use by |
20 // the embedder). | 20 // the embedder). |
21 class PlatformHandleDispatcher final : public SimpleDispatcher { | 21 class PlatformHandleDispatcher final : public SimpleDispatcher { |
22 public: | 22 public: |
| 23 // The default/standard rights for a platform handle (wrapper) handle. |
| 24 static constexpr MojoHandleRights kDefaultHandleRights = |
| 25 MOJO_HANDLE_RIGHT_TRANSFER | MOJO_HANDLE_RIGHT_READ | |
| 26 MOJO_HANDLE_RIGHT_WRITE; |
| 27 |
23 static util::RefPtr<PlatformHandleDispatcher> Create( | 28 static util::RefPtr<PlatformHandleDispatcher> Create( |
24 platform::ScopedPlatformHandle platform_handle) { | 29 platform::ScopedPlatformHandle platform_handle) { |
25 return AdoptRef(new PlatformHandleDispatcher(platform_handle.Pass())); | 30 return AdoptRef(new PlatformHandleDispatcher(platform_handle.Pass())); |
26 } | 31 } |
27 | 32 |
28 platform::ScopedPlatformHandle PassPlatformHandle(); | 33 platform::ScopedPlatformHandle PassPlatformHandle(); |
29 | 34 |
30 // |Dispatcher| public methods: | 35 // |Dispatcher| public methods: |
31 Type GetType() const override; | 36 Type GetType() const override; |
32 bool SupportsEntrypointClass(EntrypointClass entrypoint_class) const override; | 37 bool SupportsEntrypointClass(EntrypointClass entrypoint_class) const override; |
(...skipping 29 matching lines...) Expand all Loading... |
62 | 67 |
63 platform::ScopedPlatformHandle platform_handle_ MOJO_GUARDED_BY(mutex()); | 68 platform::ScopedPlatformHandle platform_handle_ MOJO_GUARDED_BY(mutex()); |
64 | 69 |
65 MOJO_DISALLOW_COPY_AND_ASSIGN(PlatformHandleDispatcher); | 70 MOJO_DISALLOW_COPY_AND_ASSIGN(PlatformHandleDispatcher); |
66 }; | 71 }; |
67 | 72 |
68 } // namespace system | 73 } // namespace system |
69 } // namespace mojo | 74 } // namespace mojo |
70 | 75 |
71 #endif // MOJO_EDK_SYSTEM_PLATFORM_HANDLE_DISPATCHER_H_ | 76 #endif // MOJO_EDK_SYSTEM_PLATFORM_HANDLE_DISPATCHER_H_ |
OLD | NEW |