OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_MESSAGE_PIPE_ENDPOINT_H_ | 5 #ifndef MOJO_EDK_SYSTEM_MESSAGE_PIPE_ENDPOINT_H_ |
6 #define MOJO_EDK_SYSTEM_MESSAGE_PIPE_ENDPOINT_H_ | 6 #define MOJO_EDK_SYSTEM_MESSAGE_PIPE_ENDPOINT_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
| 10 #include <memory> |
10 #include <vector> | 11 #include <vector> |
11 | 12 |
12 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
13 #include "base/memory/scoped_ptr.h" | |
14 #include "mojo/edk/system/dispatcher.h" | 14 #include "mojo/edk/system/dispatcher.h" |
15 #include "mojo/edk/system/memory.h" | 15 #include "mojo/edk/system/memory.h" |
16 #include "mojo/edk/system/message_in_transit.h" | 16 #include "mojo/edk/system/message_in_transit.h" |
17 #include "mojo/edk/system/system_impl_export.h" | 17 #include "mojo/edk/system/system_impl_export.h" |
18 #include "mojo/public/c/system/message_pipe.h" | 18 #include "mojo/public/c/system/message_pipe.h" |
19 #include "mojo/public/c/system/types.h" | 19 #include "mojo/public/c/system/types.h" |
20 #include "mojo/public/cpp/system/macros.h" | 20 #include "mojo/public/cpp/system/macros.h" |
21 | 21 |
22 namespace mojo { | 22 namespace mojo { |
23 namespace system { | 23 namespace system { |
(...skipping 16 matching lines...) Expand all Loading... |
40 enum Type { kTypeLocal, kTypeProxy }; | 40 enum Type { kTypeLocal, kTypeProxy }; |
41 virtual Type GetType() const = 0; | 41 virtual Type GetType() const = 0; |
42 | 42 |
43 // All implementations must implement these. | 43 // All implementations must implement these. |
44 // Returns false if the endpoint should be closed and destroyed, else true. | 44 // Returns false if the endpoint should be closed and destroyed, else true. |
45 virtual bool OnPeerClose() = 0; | 45 virtual bool OnPeerClose() = 0; |
46 // Implements |MessagePipe::EnqueueMessage()|. The major differences are that: | 46 // Implements |MessagePipe::EnqueueMessage()|. The major differences are that: |
47 // a) Dispatchers have been vetted and cloned/attached to the message. | 47 // a) Dispatchers have been vetted and cloned/attached to the message. |
48 // b) At this point, we cannot report failure (if, e.g., a channel is torn | 48 // b) At this point, we cannot report failure (if, e.g., a channel is torn |
49 // down at this point, we should silently swallow the message). | 49 // down at this point, we should silently swallow the message). |
50 virtual void EnqueueMessage(scoped_ptr<MessageInTransit> message) = 0; | 50 virtual void EnqueueMessage(std::unique_ptr<MessageInTransit> message) = 0; |
51 virtual void Close() = 0; | 51 virtual void Close() = 0; |
52 | 52 |
53 // Implementations must override these if they represent a local endpoint, | 53 // Implementations must override these if they represent a local endpoint, |
54 // i.e., one for which there's a |MessagePipeDispatcher| (and thus a handle). | 54 // i.e., one for which there's a |MessagePipeDispatcher| (and thus a handle). |
55 // An implementation for a proxy endpoint (for which there's no dispatcher) | 55 // An implementation for a proxy endpoint (for which there's no dispatcher) |
56 // needs not override these methods, since they should never be called. | 56 // needs not override these methods, since they should never be called. |
57 // | 57 // |
58 // These methods implement the methods of the same name in |MessagePipe|, | 58 // These methods implement the methods of the same name in |MessagePipe|, |
59 // though |MessagePipe|'s implementation may have to do a little more if the | 59 // though |MessagePipe|'s implementation may have to do a little more if the |
60 // operation involves both endpoints. | 60 // operation involves both endpoints. |
(...skipping 20 matching lines...) Expand all Loading... |
81 MessagePipeEndpoint() {} | 81 MessagePipeEndpoint() {} |
82 | 82 |
83 private: | 83 private: |
84 MOJO_DISALLOW_COPY_AND_ASSIGN(MessagePipeEndpoint); | 84 MOJO_DISALLOW_COPY_AND_ASSIGN(MessagePipeEndpoint); |
85 }; | 85 }; |
86 | 86 |
87 } // namespace system | 87 } // namespace system |
88 } // namespace mojo | 88 } // namespace mojo |
89 | 89 |
90 #endif // MOJO_EDK_SYSTEM_MESSAGE_PIPE_ENDPOINT_H_ | 90 #endif // MOJO_EDK_SYSTEM_MESSAGE_PIPE_ENDPOINT_H_ |
OLD | NEW |