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

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

Issue 1144033002: Make SharedMemoryDataConsumerHandle thread-safe. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ipc-data-consumer
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 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"
11 #include "content/public/child/request_peer.h" 11 #include "content/public/child/request_peer.h"
12 #include "third_party/WebKit/public/platform/WebDataConsumerHandle.h" 12 #include "third_party/WebKit/public/platform/WebDataConsumerHandle.h"
13 13
14 namespace content { 14 namespace content {
15 15
16 // This class is a WebDataConsumerHandle that accepts RequestPeer::ReceivedData. 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 17 class CONTENT_EXPORT SharedMemoryDataConsumerHandle final
20 : public NON_EXPORTED_BASE(blink::WebDataConsumerHandle) { 18 : public NON_EXPORTED_BASE(blink::WebDataConsumerHandle) {
21 private: 19 private:
22 class Context; 20 class Context;
23 21
24 public: 22 public:
25 enum BackpressureMode { 23 enum BackpressureMode {
26 kApplyBackpressure, 24 kApplyBackpressure,
27 kDoNotApplyBackpressure, 25 kDoNotApplyBackpressure,
28 }; 26 };
(...skipping 13 matching lines...) Expand all
42 }; 40 };
43 41
44 SharedMemoryDataConsumerHandle(BackpressureMode mode, 42 SharedMemoryDataConsumerHandle(BackpressureMode mode,
45 scoped_ptr<Writer>* writer); 43 scoped_ptr<Writer>* writer);
46 virtual ~SharedMemoryDataConsumerHandle(); 44 virtual ~SharedMemoryDataConsumerHandle();
47 45
48 virtual Result read(void* data, size_t size, Flags flags, size_t* readSize); 46 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); 47 virtual Result beginRead(const void** buffer, Flags flags, size_t* available);
50 virtual Result endRead(size_t readSize); 48 virtual Result endRead(size_t readSize);
51 virtual void registerClient(Client* client); 49 virtual void registerClient(Client* client);
52 virtual void unregisterClient(); 50 virtual void unregisterClient();
tyoshino (SeeGerritForStatus) 2015/05/28 11:03:58 registerClient/unregisterClient should happen in t
yhirano 2015/05/28 11:24:41 Yes, as written in WebDataConsumerHandle. Is there
53 51
54 private: 52 private:
55 scoped_refptr<Context> context_; 53 scoped_refptr<Context> context_;
56 54
57 DISALLOW_COPY_AND_ASSIGN(SharedMemoryDataConsumerHandle); 55 DISALLOW_COPY_AND_ASSIGN(SharedMemoryDataConsumerHandle);
58 }; 56 };
59 57
60 } // namespace content 58 } // namespace content
61 59
62 #endif // CONTENT_CHILD_SHARED_MEMORY_DATA_CONSUMER_HANDLE_H_ 60 #endif // CONTENT_CHILD_SHARED_MEMORY_DATA_CONSUMER_HANDLE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698