| 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_TRANSPORT_DATA_H_ | 5 #ifndef MOJO_EDK_SYSTEM_TRANSPORT_DATA_H_ |
| 6 #define MOJO_EDK_SYSTEM_TRANSPORT_DATA_H_ | 6 #define MOJO_EDK_SYSTEM_TRANSPORT_DATA_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/memory/aligned_memory.h" | 13 #include "base/memory/aligned_memory.h" |
| 14 #include "mojo/edk/embedder/platform_handle.h" | 14 #include "mojo/edk/embedder/platform_handle.h" |
| 15 #include "mojo/edk/embedder/platform_handle_vector.h" | 15 #include "mojo/edk/embedder/platform_handle_vector.h" |
| 16 #include "mojo/edk/system/dispatcher.h" | 16 #include "mojo/edk/system/dispatcher.h" |
| 17 #include "mojo/edk/system/system_impl_export.h" | |
| 18 #include "mojo/public/cpp/system/macros.h" | 17 #include "mojo/public/cpp/system/macros.h" |
| 19 | 18 |
| 20 namespace mojo { | 19 namespace mojo { |
| 21 namespace system { | 20 namespace system { |
| 22 | 21 |
| 23 class Channel; | 22 class Channel; |
| 24 | 23 |
| 25 // This class is used by |MessageInTransit| to represent handles (|Dispatcher|s) | 24 // This class is used by |MessageInTransit| to represent handles (|Dispatcher|s) |
| 26 // in various stages of serialization. | 25 // in various stages of serialization. |
| 27 // | 26 // |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 // |PlatformHandle|s (and detaching them). Attach these dispatchers to the | 64 // |PlatformHandle|s (and detaching them). Attach these dispatchers to the |
| 66 // |MessageInTransit|. | 65 // |MessageInTransit|. |
| 67 // - At this point, the |MessageInTransit| consists of its main buffer | 66 // - At this point, the |MessageInTransit| consists of its main buffer |
| 68 // (primarily the data payload) and the attached dispatchers; the | 67 // (primarily the data payload) and the attached dispatchers; the |
| 69 // |TransportData| can be discarded. | 68 // |TransportData| can be discarded. |
| 70 // - When |MojoReadMessage()| is to give data to the application, attach the | 69 // - When |MojoReadMessage()| is to give data to the application, attach the |
| 71 // dispatchers to the (global, "core") handle table, getting handles; give | 70 // dispatchers to the (global, "core") handle table, getting handles; give |
| 72 // the application the data payload and these handles. | 71 // the application the data payload and these handles. |
| 73 // | 72 // |
| 74 // TODO(vtl): Everything above involving |PlatformHandle|s. | 73 // TODO(vtl): Everything above involving |PlatformHandle|s. |
| 75 class MOJO_SYSTEM_IMPL_EXPORT TransportData { | 74 class TransportData { |
| 76 public: | 75 public: |
| 77 // The maximum size of a single serialized dispatcher. This must be a multiple | 76 // The maximum size of a single serialized dispatcher. This must be a multiple |
| 78 // of |kMessageAlignment|. | 77 // of |kMessageAlignment|. |
| 79 static const size_t kMaxSerializedDispatcherSize = 10000; | 78 static const size_t kMaxSerializedDispatcherSize = 10000; |
| 80 | 79 |
| 81 // The maximum number of platform handles to attach for a single serialized | 80 // The maximum number of platform handles to attach for a single serialized |
| 82 // dispatcher. | 81 // dispatcher. |
| 83 static const size_t kMaxSerializedDispatcherPlatformHandles = 2; | 82 static const size_t kMaxSerializedDispatcherPlatformHandles = 2; |
| 84 | 83 |
| 85 // The maximum possible size of a valid transport data buffer. | 84 // The maximum possible size of a valid transport data buffer. |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 // TODO(vtl): With C++11, change it to a vector of |ScopedPlatformHandle|s. | 181 // TODO(vtl): With C++11, change it to a vector of |ScopedPlatformHandle|s. |
| 183 embedder::ScopedPlatformHandleVectorPtr platform_handles_; | 182 embedder::ScopedPlatformHandleVectorPtr platform_handles_; |
| 184 | 183 |
| 185 MOJO_DISALLOW_COPY_AND_ASSIGN(TransportData); | 184 MOJO_DISALLOW_COPY_AND_ASSIGN(TransportData); |
| 186 }; | 185 }; |
| 187 | 186 |
| 188 } // namespace system | 187 } // namespace system |
| 189 } // namespace mojo | 188 } // namespace mojo |
| 190 | 189 |
| 191 #endif // MOJO_EDK_SYSTEM_TRANSPORT_DATA_H_ | 190 #endif // MOJO_EDK_SYSTEM_TRANSPORT_DATA_H_ |
| OLD | NEW |