Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(16)

Unified Diff: third_party/mojo/src/mojo/edk/system/local_data_pipe_impl.h

Issue 954643002: Update mojo sdk to rev 3d23dae011859a2aae49f1d1adde705c8e85d819 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: use run_renderer_in_process() Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/mojo/src/mojo/edk/system/local_data_pipe_impl.h
diff --git a/third_party/mojo/src/mojo/edk/system/local_data_pipe_impl.h b/third_party/mojo/src/mojo/edk/system/local_data_pipe_impl.h
new file mode 100644
index 0000000000000000000000000000000000000000..14defcbe5593c6cbf02a7e646b7397057bbc3d9a
--- /dev/null
+++ b/third_party/mojo/src/mojo/edk/system/local_data_pipe_impl.h
@@ -0,0 +1,94 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MOJO_EDK_SYSTEM_LOCAL_DATA_PIPE_IMPL_H_
+#define MOJO_EDK_SYSTEM_LOCAL_DATA_PIPE_IMPL_H_
+
+#include "base/macros.h"
+#include "base/memory/aligned_memory.h"
+#include "base/memory/scoped_ptr.h"
+#include "mojo/edk/system/data_pipe_impl.h"
+#include "mojo/edk/system/system_impl_export.h"
+
+namespace mojo {
+namespace system {
+
+class DataPipe;
+
+// |LocalDataPipeImpl| is a subclass that "implements" |DataPipe| for data pipes
+// whose producer and consumer are both local. See |DataPipeImpl| for more
+// details.
+class MOJO_SYSTEM_IMPL_EXPORT LocalDataPipeImpl : public DataPipeImpl {
+ public:
+ LocalDataPipeImpl();
+ ~LocalDataPipeImpl() override;
+
+ private:
+ // |DataPipeImpl| implementation:
+ void ProducerClose() override;
+ MojoResult ProducerWriteData(UserPointer<const void> elements,
+ UserPointer<uint32_t> num_bytes,
+ uint32_t max_num_bytes_to_write,
+ uint32_t min_num_bytes_to_write) override;
+ MojoResult ProducerBeginWriteData(UserPointer<void*> buffer,
+ UserPointer<uint32_t> buffer_num_bytes,
+ uint32_t min_num_bytes_to_write) override;
+ MojoResult ProducerEndWriteData(uint32_t num_bytes_written) override;
+ HandleSignalsState ProducerGetHandleSignalsState() const override;
+ void ProducerStartSerialize(Channel* channel,
+ size_t* max_size,
+ size_t* max_platform_handles) override;
+ bool ProducerEndSerialize(
+ Channel* channel,
+ void* destination,
+ size_t* actual_size,
+ embedder::PlatformHandleVector* platform_handles) override;
+ void ConsumerClose() override;
+ MojoResult ConsumerReadData(UserPointer<void> elements,
+ UserPointer<uint32_t> num_bytes,
+ uint32_t max_num_bytes_to_read,
+ uint32_t min_num_bytes_to_read,
+ bool peek) override;
+ MojoResult ConsumerDiscardData(UserPointer<uint32_t> num_bytes,
+ uint32_t max_num_bytes_to_discard,
+ uint32_t min_num_bytes_to_discard) override;
+ MojoResult ConsumerQueryData(UserPointer<uint32_t> num_bytes) override;
+ MojoResult ConsumerBeginReadData(UserPointer<const void*> buffer,
+ UserPointer<uint32_t> buffer_num_bytes,
+ uint32_t min_num_bytes_to_read) override;
+ MojoResult ConsumerEndReadData(uint32_t num_bytes_read) override;
+ HandleSignalsState ConsumerGetHandleSignalsState() const override;
+ void ConsumerStartSerialize(Channel* channel,
+ size_t* max_size,
+ size_t* max_platform_handles) override;
+ bool ConsumerEndSerialize(
+ Channel* channel,
+ void* destination,
+ size_t* actual_size,
+ embedder::PlatformHandleVector* platform_handles) override;
+
+ void EnsureBuffer();
+ void DestroyBuffer();
+
+ // Get the maximum (single) write/read size right now (in number of elements);
+ // result fits in a |uint32_t|.
+ size_t GetMaxNumBytesToWrite();
+ size_t GetMaxNumBytesToRead();
+
+ // Marks the given number of bytes as consumed/discarded. |num_bytes| must be
+ // greater than |current_num_bytes_|.
+ void MarkDataAsConsumed(size_t num_bytes);
+
+ scoped_ptr<char, base::AlignedFreeDeleter> buffer_;
+ // Circular buffer.
+ size_t start_index_;
+ size_t current_num_bytes_;
+
+ DISALLOW_COPY_AND_ASSIGN(LocalDataPipeImpl);
+};
+
+} // namespace system
+} // namespace mojo
+
+#endif // MOJO_EDK_SYSTEM_LOCAL_DATA_PIPE_IMPL_H_
« no previous file with comments | « third_party/mojo/src/mojo/edk/system/local_data_pipe.cc ('k') | third_party/mojo/src/mojo/edk/system/local_data_pipe_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698