Remove DnsConfigServiceTest.GetSystemConfig test
[chromium-blink-merge.git] / content / child / shared_memory_data_consumer_handle.h
blob03f3df08f42ab14a17429f5db33e567b65201b7f
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.
5 #ifndef CONTENT_CHILD_SHARED_MEMORY_DATA_CONSUMER_HANDLE_H_
6 #define CONTENT_CHILD_SHARED_MEMORY_DATA_CONSUMER_HANDLE_H_
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"
14 namespace content {
16 // This class is a WebDataConsumerHandle that accepts RequestPeer::ReceivedData.
17 class CONTENT_EXPORT SharedMemoryDataConsumerHandle final
18 : public NON_EXPORTED_BASE(blink::WebDataConsumerHandle) {
19 private:
20 class Context;
22 public:
23 enum BackpressureMode {
24 kApplyBackpressure,
25 kDoNotApplyBackpressure,
28 class CONTENT_EXPORT Writer final {
29 public:
30 Writer(const scoped_refptr<Context>& context, BackpressureMode mode);
31 ~Writer();
32 void AddData(scoped_ptr<RequestPeer::ReceivedData> data);
33 void Close();
35 private:
36 scoped_refptr<Context> context_;
37 BackpressureMode mode_;
39 DISALLOW_COPY_AND_ASSIGN(Writer);
42 SharedMemoryDataConsumerHandle(BackpressureMode mode,
43 scoped_ptr<Writer>* writer);
44 virtual ~SharedMemoryDataConsumerHandle();
46 virtual Result read(void* data, size_t size, Flags flags, size_t* readSize);
47 virtual Result beginRead(const void** buffer, Flags flags, size_t* available);
48 virtual Result endRead(size_t readSize);
49 virtual void registerClient(Client* client);
50 virtual void unregisterClient();
52 private:
53 scoped_refptr<Context> context_;
55 DISALLOW_COPY_AND_ASSIGN(SharedMemoryDataConsumerHandle);
58 } // namespace content
60 #endif // CONTENT_CHILD_SHARED_MEMORY_DATA_CONSUMER_HANDLE_H_