OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 CONTENT_COMMON_MESSAGE_PORT_H_ | 5 #ifndef CONTENT_COMMON_MESSAGE_PORT_H_ |
6 #define CONTENT_COMMON_MESSAGE_PORT_H_ | 6 #define CONTENT_COMMON_MESSAGE_PORT_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 | 54 |
55 const mojo::ScopedMessagePipeHandle& GetHandle() const; | 55 const mojo::ScopedMessagePipeHandle& GetHandle() const; |
56 mojo::ScopedMessagePipeHandle ReleaseHandle() const; | 56 mojo::ScopedMessagePipeHandle ReleaseHandle() const; |
57 | 57 |
58 static std::vector<mojo::ScopedMessagePipeHandle> ReleaseHandles( | 58 static std::vector<mojo::ScopedMessagePipeHandle> ReleaseHandles( |
59 const std::vector<MessagePort>& ports); | 59 const std::vector<MessagePort>& ports); |
60 | 60 |
61 // Sends an encoded message (along with ports to transfer) to this port's | 61 // Sends an encoded message (along with ports to transfer) to this port's |
62 // peer. | 62 // peer. |
63 void PostMessage(const base::string16& encoded_message, | 63 void PostMessage(const base::string16& encoded_message, |
64 std::vector<MessagePort> ports); | 64 std::vector<MessagePort> ports, |
| 65 std::vector<mojo::ScopedHandle> extra_handles); |
65 | 66 |
66 // Get the next available encoded message if any. Returns true if a message | 67 // Get the next available encoded message if any. Returns true if a message |
67 // was read. | 68 // was read. |
68 bool GetMessage(base::string16* encoded_message, | 69 bool GetMessage(base::string16* encoded_message, |
69 std::vector<MessagePort>* ports); | 70 std::vector<MessagePort>* ports, |
| 71 std::vector<mojo::ScopedHandle>* extra_handles); |
70 | 72 |
71 // This callback will be invoked on a background thread when messages are | 73 // This callback will be invoked on a background thread when messages are |
72 // available to be read via GetMessage. | 74 // available to be read via GetMessage. |
73 void SetCallback(const base::Closure& callback); | 75 void SetCallback(const base::Closure& callback); |
74 | 76 |
75 // Clears any callback specified by a prior call to SetCallback. | 77 // Clears any callback specified by a prior call to SetCallback. |
76 void ClearCallback(); | 78 void ClearCallback(); |
77 | 79 |
78 private: | 80 private: |
79 class State : public base::RefCountedThreadSafe<State> { | 81 class State : public base::RefCountedThreadSafe<State> { |
(...skipping 20 matching lines...) Expand all Loading... |
100 MojoResult result, | 102 MojoResult result, |
101 MojoHandleSignalsState signals_state, | 103 MojoHandleSignalsState signals_state, |
102 MojoWatcherNotificationFlags flags); | 104 MojoWatcherNotificationFlags flags); |
103 }; | 105 }; |
104 mutable scoped_refptr<State> state_; | 106 mutable scoped_refptr<State> state_; |
105 }; | 107 }; |
106 | 108 |
107 } // namespace content | 109 } // namespace content |
108 | 110 |
109 #endif // CONTENT_COMMON_MESSAGE_PORT_H_ | 111 #endif // CONTENT_COMMON_MESSAGE_PORT_H_ |
OLD | NEW |