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

Side by Side 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, 6 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 unified diff | Download patch
« no previous file with comments | « no previous file | content/child/shared_memory_data_consumer_handle.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_CHILD_SHARED_MEMORY_DATA_CONSUMER_HANDLE_H_
6 #define CONTENT_CHILD_SHARED_MEMORY_DATA_CONSUMER_HANDLE_H_
7
8 #include "base/memory/ref_counted.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "content/common/content_export.h"
11 #include "content/public/child/request_peer.h"
12 #include "third_party/WebKit/public/platform/WebDataConsumerHandle.h"
13
14 namespace content {
15
16 // This class is a WebDataConsumerHandle that accepts RequestPeer::ReceivedData.
17 // TODO(yhirano): Currently this only works on a single thread. Make this class
18 // work with a multi thread environment.
19 class CONTENT_EXPORT SharedMemoryDataConsumerHandle final
20 : public NON_EXPORTED_BASE(blink::WebDataConsumerHandle) {
21 private:
22 class Context;
23
24 public:
25 enum BackpressureMode {
26 kApplyBackpressure,
27 kDoNotApplyBackpressure,
28 };
29
30 class CONTENT_EXPORT Writer final {
31 public:
32 Writer(const scoped_refptr<Context>& context, BackpressureMode mode);
33 ~Writer();
34 void AddData(scoped_ptr<RequestPeer::ReceivedData> data);
35 void Close();
36
37 private:
38 scoped_refptr<Context> context_;
39 BackpressureMode mode_;
40
41 DISALLOW_COPY_AND_ASSIGN(Writer);
42 };
43
44 SharedMemoryDataConsumerHandle(BackpressureMode mode,
45 scoped_ptr<Writer>* writer);
46 virtual ~SharedMemoryDataConsumerHandle();
47
48 virtual Result read(void* data, size_t size, Flags flags, size_t* readSize);
49 virtual Result beginRead(const void** buffer, Flags flags, size_t* available);
50 virtual Result endRead(size_t readSize);
51 virtual void registerClient(Client* client);
52 virtual void unregisterClient();
53
54 private:
55 scoped_refptr<Context> context_;
56
57 DISALLOW_COPY_AND_ASSIGN(SharedMemoryDataConsumerHandle);
58 };
59
60 } // namespace content
61
62 #endif // CONTENT_CHILD_SHARED_MEMORY_DATA_CONSUMER_HANDLE_H_
OLDNEW
« 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