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

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

Issue 1748503002: [mojo-edk] Add MojoWatch and MojoCancelWatch APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 9 months 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_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 "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/synchronization/lock.h" 10 #include "base/synchronization/lock.h"
11 #include "mojo/edk/embedder/scoped_platform_handle.h" 11 #include "mojo/edk/embedder/scoped_platform_handle.h"
12 #include "mojo/edk/system/dispatcher.h" 12 #include "mojo/edk/system/dispatcher.h"
13 #include "mojo/edk/system/system_impl_export.h" 13 #include "mojo/edk/system/system_impl_export.h"
14 14
15 namespace mojo { 15 namespace mojo {
16 namespace edk { 16 namespace edk {
17 17
18 class MOJO_SYSTEM_IMPL_EXPORT PlatformHandleDispatcher : public Dispatcher { 18 class MOJO_SYSTEM_IMPL_EXPORT PlatformHandleDispatcher : public Dispatcher {
19 public: 19 public:
20 static scoped_refptr<PlatformHandleDispatcher> Create( 20 static scoped_refptr<PlatformHandleDispatcher> Create(
21 ScopedPlatformHandle platform_handle); 21 ScopedPlatformHandle platform_handle);
22 22
23 ScopedPlatformHandle PassPlatformHandle(); 23 ScopedPlatformHandle PassPlatformHandle();
24 24
25 // Dispatcher: 25 // Dispatcher:
26 Type GetType() const override; 26 Type GetType() const override;
27 MojoResult Close() override; 27 MojoResult Close(RequestContext* request_context) override;
28 void StartSerialize(uint32_t* num_bytes, 28 void StartSerialize(uint32_t* num_bytes,
29 uint32_t* num_ports, 29 uint32_t* num_ports,
30 uint32_t* num_handles) override; 30 uint32_t* num_handles) override;
31 bool EndSerialize(void* destination, 31 bool EndSerialize(void* destination,
32 ports::PortName* ports, 32 ports::PortName* ports,
33 PlatformHandle* handles) override; 33 PlatformHandle* handles) override;
34 bool BeginTransit() override; 34 bool BeginTransit(RequestContext* request_context) override;
35 void CompleteTransitAndClose() override; 35 void CompleteTransitAndClose(RequestContext* request_context) override;
36 void CancelTransit() override; 36 void CancelTransit(RequestContext* request_context) override;
37 37
38 static scoped_refptr<PlatformHandleDispatcher> Deserialize( 38 static scoped_refptr<PlatformHandleDispatcher> Deserialize(
39 const void* bytes, 39 const void* bytes,
40 size_t num_bytes, 40 size_t num_bytes,
41 const ports::PortName* ports, 41 const ports::PortName* ports,
42 size_t num_ports, 42 size_t num_ports,
43 PlatformHandle* handles, 43 PlatformHandle* handles,
44 size_t num_handles); 44 size_t num_handles);
45 45
46 private: 46 private:
47 PlatformHandleDispatcher(ScopedPlatformHandle platform_handle); 47 PlatformHandleDispatcher(ScopedPlatformHandle platform_handle);
48 ~PlatformHandleDispatcher() override; 48 ~PlatformHandleDispatcher() override;
49 49
50 base::Lock lock_; 50 base::Lock lock_;
51 bool in_transit_ = false; 51 bool in_transit_ = false;
52 bool is_closed_ = false; 52 bool is_closed_ = false;
53 ScopedPlatformHandle platform_handle_; 53 ScopedPlatformHandle platform_handle_;
54 54
55 DISALLOW_COPY_AND_ASSIGN(PlatformHandleDispatcher); 55 DISALLOW_COPY_AND_ASSIGN(PlatformHandleDispatcher);
56 }; 56 };
57 57
58 } // namespace edk 58 } // namespace edk
59 } // namespace mojo 59 } // namespace mojo
60 60
61 #endif // MOJO_EDK_SYSTEM_PLATFORM_HANDLE_DISPATCHER_H_ 61 #endif // MOJO_EDK_SYSTEM_PLATFORM_HANDLE_DISPATCHER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698