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

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

Issue 1186053004: Cancel loading when body stream reader is detached. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@error-ipc-data-consumer
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/callback.h"
8 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
9 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
10 #include "content/common/content_export.h" 11 #include "content/common/content_export.h"
11 #include "content/public/child/request_peer.h" 12 #include "content/public/child/request_peer.h"
12 #include "third_party/WebKit/public/platform/WebDataConsumerHandle.h" 13 #include "third_party/WebKit/public/platform/WebDataConsumerHandle.h"
13 14
14 namespace content { 15 namespace content {
15 16
16 // This class is a WebDataConsumerHandle that accepts RequestPeer::ReceivedData. 17 // This class is a WebDataConsumerHandle that accepts RequestPeer::ReceivedData.
17 class CONTENT_EXPORT SharedMemoryDataConsumerHandle final 18 class CONTENT_EXPORT SharedMemoryDataConsumerHandle final
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 Flags flags, 53 Flags flags,
53 size_t* available); 54 size_t* available);
54 virtual Result endRead(size_t readSize); 55 virtual Result endRead(size_t readSize);
55 56
56 private: 57 private:
57 scoped_refptr<Context> context_; 58 scoped_refptr<Context> context_;
58 59
59 DISALLOW_COPY_AND_ASSIGN(ReaderImpl); 60 DISALLOW_COPY_AND_ASSIGN(ReaderImpl);
60 }; 61 };
61 62
63 // Creates a handle and a writer associated with the handle. The created
64 // writer should be used on the calling thread.
62 SharedMemoryDataConsumerHandle(BackpressureMode mode, 65 SharedMemoryDataConsumerHandle(BackpressureMode mode,
63 scoped_ptr<Writer>* writer); 66 scoped_ptr<Writer>* writer);
67 // |on_clear| will be called asynchronously on the calling thread when both
68 // the associated handle and the reader are destructed.
hiroshige 2015/06/22 18:23:16 Better name (here and related method/member names)
yhirano 2015/06/23 05:28:38 Done.
69 // The callback will be reset in the internal context when |Close| or |Error|
70 // on the writer is called.
hiroshige 2015/06/22 18:23:16 How about "will be reset in the internal context w
yhirano 2015/06/23 05:28:38 Done.
71 SharedMemoryDataConsumerHandle(BackpressureMode mode,
72 const base::Closure& on_clear,
73 scoped_ptr<Writer>* writer);
64 virtual ~SharedMemoryDataConsumerHandle(); 74 virtual ~SharedMemoryDataConsumerHandle();
65 75
66 scoped_ptr<Reader> ObtainReader(Client* client); 76 scoped_ptr<Reader> ObtainReader(Client* client);
67 77
68 private: 78 private:
69 virtual ReaderImpl* obtainReaderInternal(Client* client); 79 virtual ReaderImpl* obtainReaderInternal(Client* client);
70 const char* debugName() const override; 80 const char* debugName() const override;
71 81
72 scoped_refptr<Context> context_; 82 scoped_refptr<Context> context_;
73 83
74 DISALLOW_COPY_AND_ASSIGN(SharedMemoryDataConsumerHandle); 84 DISALLOW_COPY_AND_ASSIGN(SharedMemoryDataConsumerHandle);
75 }; 85 };
76 86
77 } // namespace content 87 } // namespace content
78 88
79 #endif // CONTENT_CHILD_SHARED_MEMORY_DATA_CONSUMER_HANDLE_H_ 89 #endif // CONTENT_CHILD_SHARED_MEMORY_DATA_CONSUMER_HANDLE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698