Index: mojo/edk/system/message_in_transit.h |
diff --git a/third_party/mojo/src/mojo/edk/system/message_in_transit.h b/mojo/edk/system/message_in_transit.h |
similarity index 68% |
copy from third_party/mojo/src/mojo/edk/system/message_in_transit.h |
copy to mojo/edk/system/message_in_transit.h |
index 7383d2120442c5c00068754d4c3cdb68c5fa062d..f0cd7a7edfcece77918bcc4126515dbb3f111431 100644 |
--- a/third_party/mojo/src/mojo/edk/system/message_in_transit.h |
+++ b/mojo/edk/system/message_in_transit.h |
@@ -2,8 +2,8 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#ifndef THIRD_PARTY_MOJO_SRC_MOJO_EDK_SYSTEM_MESSAGE_IN_TRANSIT_H_ |
-#define THIRD_PARTY_MOJO_SRC_MOJO_EDK_SYSTEM_MESSAGE_IN_TRANSIT_H_ |
+#ifndef MOJO_EDK_SYSTEM_MESSAGE_IN_TRANSIT_H_ |
+#define MOJO_EDK_SYSTEM_MESSAGE_IN_TRANSIT_H_ |
#include <stddef.h> |
#include <stdint.h> |
@@ -13,16 +13,14 @@ |
#include "base/memory/aligned_memory.h" |
#include "base/memory/scoped_ptr.h" |
+#include "mojo/edk/system/dispatcher.h" |
+#include "mojo/edk/system/system_impl_export.h" |
#include "mojo/public/cpp/system/macros.h" |
-#include "third_party/mojo/src/mojo/edk/system/channel_endpoint_id.h" |
-#include "third_party/mojo/src/mojo/edk/system/dispatcher.h" |
-#include "third_party/mojo/src/mojo/edk/system/memory.h" |
-#include "third_party/mojo/src/mojo/edk/system/system_impl_export.h" |
namespace mojo { |
-namespace system { |
+namespace edk { |
-class Channel; |
+class RawChannel; |
class TransportData; |
// This class is used to represent data in transit. It is thread-unsafe. |
@@ -45,51 +43,9 @@ class TransportData; |
class MOJO_SYSTEM_IMPL_EXPORT MessageInTransit { |
public: |
enum class Type : uint16_t { |
- // Messages that are forwarded to endpoint clients. |
- ENDPOINT_CLIENT = 0, |
- // Messages that are consumed by the |ChannelEndpoint|. |
- ENDPOINT = 1, |
- // Messages that are consumed by the |Channel|. |
- CHANNEL = 2, |
- // Messages that are consumed by the |RawChannel| (implementation). |
- RAW_CHANNEL = 3, |
- // |ConnectionManager| implementations also use |RawChannel|s. |
- // Messages sent to a |MasterConnectionManager|. |
- CONNECTION_MANAGER = 4, |
- // Messages sent by a |MasterConnectionManager| (all responses). |
- CONNECTION_MANAGER_ACK = 5, |
- }; |
- |
- enum class Subtype : uint16_t { |
- // Subtypes for type |Type::ENDPOINT_CLIENT|: |
- // Message pipe or data pipe data (etc.). |
- ENDPOINT_CLIENT_DATA = 0, |
- // Data pipe: consumer -> producer message that data was consumed. Payload |
- // is |RemoteDataPipeAck|. |
- ENDPOINT_CLIENT_DATA_PIPE_ACK = 1, |
- // Subtypes for type |Type::ENDPOINT|: |
- // TODO(vtl): Nothing yet. |
- // Subtypes for type |Type::CHANNEL|: |
- CHANNEL_ATTACH_AND_RUN_ENDPOINT = 0, |
- CHANNEL_REMOVE_ENDPOINT = 1, |
- CHANNEL_REMOVE_ENDPOINT_ACK = 2, |
- // Subtypes for type |Type::RAW_CHANNEL|: |
- RAW_CHANNEL_POSIX_EXTRA_PLATFORM_HANDLES = 0, |
- // Subtypes for type |Type::CONNECTION_MANAGER| (the message data is always |
- // a buffer containing the connection ID): |
- CONNECTION_MANAGER_ALLOW_CONNECT = 0, |
- CONNECTION_MANAGER_CANCEL_CONNECT = 1, |
- CONNECTION_MANAGER_CONNECT = 2, |
- // Subtypes for type |Type::CONNECTION_MANAGER_ACK|, corresponding to |
- // |ConnectionManager::Result| values (failure and non-"connect" acks never |
- // have any message contents; success acks for "connect" always have a |
- // |ConnectionManagerAckSuccessConnectData| as data and also a platform |
- // handle attached for "new connection"): |
- CONNECTION_MANAGER_ACK_FAILURE = 0, |
- CONNECTION_MANAGER_ACK_SUCCESS = 1, |
- CONNECTION_MANAGER_ACK_SUCCESS_CONNECT_SAME_PROCESS = 2, |
- CONNECTION_MANAGER_ACK_SUCCESS_CONNECT_NEW_CONNECTION = 3, |
- CONNECTION_MANAGER_ACK_SUCCESS_CONNECT_REUSE_CONNECTION = 4, |
+ MESSAGE = 0, |
+ RAW_CHANNEL_POSIX_EXTRA_PLATFORM_HANDLES = 1, |
+ RAW_CHANNEL_QUIT = 2, |
}; |
// Messages (the header and data) must always be aligned to a multiple of this |
@@ -141,11 +97,6 @@ class MOJO_SYSTEM_IMPL_EXPORT MessageInTransit { |
return static_cast<const char*>(buffer_) + sizeof(Header); |
} |
Type type() const { return header()->type; } |
- Subtype subtype() const { return header()->subtype; } |
- ChannelEndpointId source_id() const { return header()->source_id; } |
- ChannelEndpointId destination_id() const { |
- return header()->destination_id; |
- } |
private: |
const Header* header() const { return static_cast<const Header*>(buffer_); } |
@@ -160,14 +111,8 @@ class MOJO_SYSTEM_IMPL_EXPORT MessageInTransit { |
// |bytes| is optional; if null, the message data will be zero-initialized. |
MessageInTransit(Type type, |
- Subtype subtype, |
uint32_t num_bytes, |
const void* bytes); |
- // |bytes| should be valid (and non-null), unless |num_bytes| is zero. |
- MessageInTransit(Type type, |
- Subtype subtype, |
- uint32_t num_bytes, |
- UserPointer<const void> bytes); |
// Constructs a |MessageInTransit| from a |View|. |
explicit MessageInTransit(const View& message_view); |
@@ -198,7 +143,7 @@ class MOJO_SYSTEM_IMPL_EXPORT MessageInTransit { |
// already have a secondary buffer (so this must only be called once). The |
// caller must ensure (e.g., by holding on to a reference) that |channel| |
// stays alive through the call. |
- void SerializeAndCloseDispatchers(Channel* channel); |
+ void SerializeAndCloseDispatchers(); |
// Gets the main buffer and its size (in number of bytes), respectively. |
const void* main_buffer() const { return main_buffer_.get(); } |
@@ -219,16 +164,6 @@ class MOJO_SYSTEM_IMPL_EXPORT MessageInTransit { |
void* bytes() { return main_buffer_.get() + sizeof(Header); } |
Type type() const { return header()->type; } |
- Subtype subtype() const { return header()->subtype; } |
- ChannelEndpointId source_id() const { return header()->source_id; } |
- ChannelEndpointId destination_id() const { return header()->destination_id; } |
- |
- void set_source_id(ChannelEndpointId source_id) { |
- header()->source_id = source_id; |
- } |
- void set_destination_id(ChannelEndpointId destination_id) { |
- header()->destination_id = destination_id; |
- } |
// Gets the dispatchers attached to this message; this may return null if |
// there are none. Note that the caller may mutate the set of dispatchers |
@@ -259,10 +194,7 @@ class MOJO_SYSTEM_IMPL_EXPORT MessageInTransit { |
// |SerializeAndCloseDispatchers()| has not been called. |
uint32_t total_size; |
Type type; // 2 bytes. |
- Subtype subtype; // 2 bytes. |
- ChannelEndpointId source_id; // 4 bytes. |
- ChannelEndpointId destination_id; // 4 bytes. |
- // Size of actual message data. |
+ Type unusedforalignment; // 2 bytes. |
uint32_t num_bytes; |
uint32_t unused; |
}; |
@@ -272,7 +204,7 @@ class MOJO_SYSTEM_IMPL_EXPORT MessageInTransit { |
} |
Header* header() { return reinterpret_cast<Header*>(main_buffer_.get()); } |
- void ConstructorHelper(Type type, Subtype subtype, uint32_t num_bytes); |
+ void ConstructorHelper(Type type, uint32_t num_bytes); |
void UpdateTotalSize(); |
const size_t main_buffer_size_; |
@@ -296,14 +228,7 @@ MOJO_SYSTEM_IMPL_EXPORT inline std::ostream& operator<<( |
return out << static_cast<uint16_t>(type); |
} |
-// So logging macros and |DCHECK_EQ()|, etc. work. |
-MOJO_SYSTEM_IMPL_EXPORT inline std::ostream& operator<<( |
- std::ostream& out, |
- MessageInTransit::Subtype subtype) { |
- return out << static_cast<uint16_t>(subtype); |
-} |
- |
-} // namespace system |
+} // namespace edk |
} // namespace mojo |
-#endif // THIRD_PARTY_MOJO_SRC_MOJO_EDK_SYSTEM_MESSAGE_IN_TRANSIT_H_ |
+#endif // MOJO_EDK_SYSTEM_MESSAGE_IN_TRANSIT_H_ |