Index: mojo/edk/system/data_pipe_producer_dispatcher.h |
diff --git a/mojo/edk/system/data_pipe_producer_dispatcher.h b/mojo/edk/system/data_pipe_producer_dispatcher.h |
index d6920a3ce79ac44e8a776032f92fc7e64d28723e..2725980ab3c5332e5f8e524e55840b3e4b4ba153 100644 |
--- a/mojo/edk/system/data_pipe_producer_dispatcher.h |
+++ b/mojo/edk/system/data_pipe_producer_dispatcher.h |
@@ -9,7 +9,9 @@ |
#include <stdint.h> |
#include "base/memory/ref_counted.h" |
+#include "mojo/edk/embedder/platform_shared_buffer.h" |
#include "mojo/edk/system/awakable_list.h" |
+#include "mojo/edk/system/data_pipe.h" |
#include "mojo/edk/system/dispatcher.h" |
#include "mojo/edk/system/raw_channel.h" |
#include "mojo/edk/system/system_impl_export.h" |
@@ -30,8 +32,8 @@ class MOJO_SYSTEM_IMPL_EXPORT DataPipeProducerDispatcher final |
} |
// Must be called before any other methods. |
- void Init(ScopedPlatformHandle message_pipe, |
- char* serialized_write_buffer, size_t serialized_write_buffer_size); |
+ void Init(ScopedPlatformHandle channel_handle, |
+ scoped_refptr<PlatformSharedBuffer> shared_buffer); |
// |Dispatcher| public methods: |
Type GetType() const override; |
@@ -44,9 +46,11 @@ class MOJO_SYSTEM_IMPL_EXPORT DataPipeProducerDispatcher final |
PlatformHandleVector* platform_handles); |
private: |
- DataPipeProducerDispatcher(const MojoCreateDataPipeOptions& options); |
+ explicit DataPipeProducerDispatcher(const MojoCreateDataPipeOptions& options); |
+ explicit DataPipeProducerDispatcher(scoped_refptr<DataPipe> data_pipe); |
~DataPipeProducerDispatcher() override; |
+ void InitInternal(); |
void InitOnIO(); |
void CloseOnIO(); |
@@ -85,16 +89,10 @@ class MOJO_SYSTEM_IMPL_EXPORT DataPipeProducerDispatcher final |
ScopedPlatformHandleVectorPtr platform_handles) override; |
void OnError(Error error) override; |
- bool InTwoPhaseWrite() const; |
- bool WriteDataIntoMessages(const void* elements, uint32_t num_bytes); |
+ bool ProcessCommand(const DataPipeCommandHeader& command, |
+ ScopedPlatformHandleVectorPtr platform_handles); |
- // See comment in MessagePipeDispatcher for this method. |
- void SerializeInternal(); |
- |
- MojoCreateDataPipeOptions options_; |
- |
- // Protected by |lock()|: |
- RawChannel* channel_; // This will be null if closed. |
+ scoped_refptr<DataPipe> data_pipe_; |
AwakableList awakable_list_; |
@@ -102,12 +100,11 @@ class MOJO_SYSTEM_IMPL_EXPORT DataPipeProducerDispatcher final |
// avoid deadlocks with RawChannel calling us. |
base::Lock started_transport_; |
- bool error_; |
+ bool calling_init_; |
+ bool peer_closed_; |
- bool serialized_; |
- ScopedPlatformHandle serialized_platform_handle_; |
- std::vector<char> serialized_write_buffer_; |
- std::vector<char> two_phase_data_; |
+ bool in_two_phase_write_; |
+ uint32_t two_phase_max_bytes_write_; |
MOJO_DISALLOW_COPY_AND_ASSIGN(DataPipeProducerDispatcher); |
}; |