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

Side by Side Diff: content/child/shared_memory_data_consumer_handle.h

Issue 1164493008: Implement WebDataConsumerHandle::Reader. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
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
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_CHILD_SHARED_MEMORY_DATA_CONSUMER_HANDLE_H_ 5 #ifndef CONTENT_CHILD_SHARED_MEMORY_DATA_CONSUMER_HANDLE_H_
6 #define CONTENT_CHILD_SHARED_MEMORY_DATA_CONSUMER_HANDLE_H_ 6 #define CONTENT_CHILD_SHARED_MEMORY_DATA_CONSUMER_HANDLE_H_
7 7
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "content/common/content_export.h" 10 #include "content/common/content_export.h"
(...skipping 21 matching lines...) Expand all
32 void AddData(scoped_ptr<RequestPeer::ReceivedData> data); 32 void AddData(scoped_ptr<RequestPeer::ReceivedData> data);
33 void Close(); 33 void Close();
34 34
35 private: 35 private:
36 scoped_refptr<Context> context_; 36 scoped_refptr<Context> context_;
37 BackpressureMode mode_; 37 BackpressureMode mode_;
38 38
39 DISALLOW_COPY_AND_ASSIGN(Writer); 39 DISALLOW_COPY_AND_ASSIGN(Writer);
40 }; 40 };
41 41
42 class ReaderImpl final : public Reader {
43 public:
44 ReaderImpl(scoped_refptr<Context> context, Client* client);
45 virtual ~ReaderImpl();
46 virtual Result read(void* data, size_t size, Flags flags, size_t* readSize);
47 virtual Result beginRead(const void** buffer,
48 Flags flags,
49 size_t* available);
50 virtual Result endRead(size_t readSize);
51
52 private:
53 scoped_refptr<Context> context_;
54
55 DISALLOW_COPY_AND_ASSIGN(ReaderImpl);
56 };
57
42 SharedMemoryDataConsumerHandle(BackpressureMode mode, 58 SharedMemoryDataConsumerHandle(BackpressureMode mode,
43 scoped_ptr<Writer>* writer); 59 scoped_ptr<Writer>* writer);
44 virtual ~SharedMemoryDataConsumerHandle(); 60 virtual ~SharedMemoryDataConsumerHandle();
45 61
62 scoped_ptr<Reader> ObtainReader(Client* client);
63
46 virtual Result read(void* data, size_t size, Flags flags, size_t* readSize); 64 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); 65 virtual Result beginRead(const void** buffer, Flags flags, size_t* available);
48 virtual Result endRead(size_t readSize); 66 virtual Result endRead(size_t readSize);
49 virtual void registerClient(Client* client); 67 virtual void registerClient(Client* client);
50 virtual void unregisterClient(); 68 virtual void unregisterClient();
51 69
52 private: 70 private:
71 virtual ReaderImpl* obtainReaderInternal(Client* client);
72 void LockImplicitly();
73 void UnlockImplicitly();
74
53 scoped_refptr<Context> context_; 75 scoped_refptr<Context> context_;
76 // This is an implicitly acquired reader for deprecated APIs.
77 scoped_ptr<Reader> reader_;
54 78
55 DISALLOW_COPY_AND_ASSIGN(SharedMemoryDataConsumerHandle); 79 DISALLOW_COPY_AND_ASSIGN(SharedMemoryDataConsumerHandle);
56 }; 80 };
57 81
58 } // namespace content 82 } // namespace content
59 83
60 #endif // CONTENT_CHILD_SHARED_MEMORY_DATA_CONSUMER_HANDLE_H_ 84 #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