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

Unified Diff: content/child/shared_memory_data_consumer_handle.h

Issue 1118233002: Introduce SharedMemoryDataConsumerHandle. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@data-received-with-ack
Patch Set: Created 5 years, 7 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
« no previous file with comments | « no previous file | content/child/shared_memory_data_consumer_handle.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/shared_memory_data_consumer_handle.h
diff --git a/content/child/shared_memory_data_consumer_handle.h b/content/child/shared_memory_data_consumer_handle.h
new file mode 100644
index 0000000000000000000000000000000000000000..d371705b14af43c7e57dd593d88f2f5d883e6bfb
--- /dev/null
+++ b/content/child/shared_memory_data_consumer_handle.h
@@ -0,0 +1,62 @@
+// Copyright 2015 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 CONTENT_CHILD_SHARED_MEMORY_DATA_CONSUMER_HANDLE_H_
+#define CONTENT_CHILD_SHARED_MEMORY_DATA_CONSUMER_HANDLE_H_
+
+#include "base/memory/ref_counted.h"
+#include "base/memory/scoped_ptr.h"
+#include "content/common/content_export.h"
+#include "content/public/child/request_peer.h"
+#include "third_party/WebKit/public/platform/WebDataConsumerHandle.h"
+
+namespace content {
+
+// This class is a WebDataConsumerHandle that accepts RequestPeer::ReceivedData.
+// TODO(yhirano): Currently this only works on a single thread. Make this class
+// work with a multi thread environment.
+class CONTENT_EXPORT SharedMemoryDataConsumerHandle final
+ : public NON_EXPORTED_BASE(blink::WebDataConsumerHandle) {
+ private:
+ class Context;
+
+ public:
+ enum BackpressureMode {
+ kApplyBackpressure,
+ kDoNotApplyBackpressure,
+ };
+
+ class CONTENT_EXPORT Writer final {
+ public:
+ Writer(const scoped_refptr<Context>& context, BackpressureMode mode);
+ ~Writer();
+ void AddData(scoped_ptr<RequestPeer::ReceivedData> data);
+ void Close();
+
+ private:
+ scoped_refptr<Context> context_;
+ BackpressureMode mode_;
+
+ DISALLOW_COPY_AND_ASSIGN(Writer);
+ };
+
+ SharedMemoryDataConsumerHandle(BackpressureMode mode,
+ scoped_ptr<Writer>* writer);
+ virtual ~SharedMemoryDataConsumerHandle();
+
+ virtual Result read(void* data, size_t size, Flags flags, size_t* readSize);
+ virtual Result beginRead(const void** buffer, Flags flags, size_t* available);
+ virtual Result endRead(size_t readSize);
+ virtual void registerClient(Client* client);
+ virtual void unregisterClient();
+
+ private:
+ scoped_refptr<Context> context_;
+
+ DISALLOW_COPY_AND_ASSIGN(SharedMemoryDataConsumerHandle);
+};
+
+} // namespace content
+
+#endif // CONTENT_CHILD_SHARED_MEMORY_DATA_CONSUMER_HANDLE_H_
« no previous file with comments | « no previous file | content/child/shared_memory_data_consumer_handle.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698