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

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
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
42 SharedMemoryDataConsumerHandle(BackpressureMode mode, 56 SharedMemoryDataConsumerHandle(BackpressureMode mode,
43 scoped_ptr<Writer>* writer); 57 scoped_ptr<Writer>* writer);
44 virtual ~SharedMemoryDataConsumerHandle(); 58 virtual ~SharedMemoryDataConsumerHandle();
45 59
60 scoped_ptr<ReaderImpl> obtainReaderImpl(Client* client);
61
46 virtual Result read(void* data, size_t size, Flags flags, size_t* readSize); 62 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); 63 virtual Result beginRead(const void** buffer, Flags flags, size_t* available);
48 virtual Result endRead(size_t readSize); 64 virtual Result endRead(size_t readSize);
49 virtual void registerClient(Client* client); 65 virtual void registerClient(Client* client);
50 virtual void unregisterClient(); 66 virtual void unregisterClient();
51 67
52 private: 68 private:
69 virtual ReaderImpl* obtainReaderInternal(Client* client);
70 void LockImplicitly();
71 void UnlockImplicitly();
72
53 scoped_refptr<Context> context_; 73 scoped_refptr<Context> context_;
74 // This is an implicitely acquired reader for deprecated APIs.
75 scoped_ptr<Reader> reader_;
54 76
55 DISALLOW_COPY_AND_ASSIGN(SharedMemoryDataConsumerHandle); 77 DISALLOW_COPY_AND_ASSIGN(SharedMemoryDataConsumerHandle);
56 }; 78 };
57 79
58 } // namespace content 80 } // namespace content
59 81
60 #endif // CONTENT_CHILD_SHARED_MEMORY_DATA_CONSUMER_HANDLE_H_ 82 #endif // CONTENT_CHILD_SHARED_MEMORY_DATA_CONSUMER_HANDLE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698