OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 WebDataConsumerHandle_h | 5 #ifndef WebDataConsumerHandle_h |
6 #define WebDataConsumerHandle_h | 6 #define WebDataConsumerHandle_h |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #if INSIDE_BLINK | 10 #if INSIDE_BLINK |
11 #include <memory> | 11 #include "wtf/PassOwnPtr.h" |
12 #endif | 12 #endif |
13 | 13 |
14 #include "public/platform/WebCommon.h" | 14 #include "public/platform/WebCommon.h" |
15 | 15 |
16 namespace blink { | 16 namespace blink { |
17 | 17 |
18 // WebDataConsumerHandle represents the "consumer" side of a data pipe. A user | 18 // WebDataConsumerHandle represents the "consumer" side of a data pipe. A user |
19 // can read data from it. | 19 // can read data from it. |
20 // | 20 // |
21 // A WebDataConsumerHandle is a thread-safe object. A user can call | 21 // A WebDataConsumerHandle is a thread-safe object. A user can call |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 virtual ~WebDataConsumerHandle(); | 97 virtual ~WebDataConsumerHandle(); |
98 | 98 |
99 // Returns a non-null reader. This function can be called only when this | 99 // Returns a non-null reader. This function can be called only when this |
100 // handle is not locked. |client| can be null. Otherwise, |*client| must be | 100 // handle is not locked. |client| can be null. Otherwise, |*client| must be |
101 // valid as long as the reader is valid. The returned reader is bound to | 101 // valid as long as the reader is valid. The returned reader is bound to |
102 // the calling thread and client notification will be called on the thread | 102 // the calling thread and client notification will be called on the thread |
103 // if |client| is not null. | 103 // if |client| is not null. |
104 // If |client| is not null and the handle is not waiting, client | 104 // If |client| is not null and the handle is not waiting, client |
105 // notification is called asynchronously. | 105 // notification is called asynchronously. |
106 #if INSIDE_BLINK | 106 #if INSIDE_BLINK |
107 std::unique_ptr<Reader> obtainReader(Client*); | 107 PassOwnPtr<Reader> obtainReader(Client*); |
108 #endif | 108 #endif |
109 | 109 |
110 // Returns a string literal (e.g. class name) for debugging only. | 110 // Returns a string literal (e.g. class name) for debugging only. |
111 virtual const char* debugName() const = 0; | 111 virtual const char* debugName() const = 0; |
112 | 112 |
113 private: | 113 private: |
114 // The caller takes ownership of the returned object. | 114 // The caller takes ownership of the returned object. |
115 virtual Reader* obtainReaderInternal(Client*) = 0; | 115 virtual Reader* obtainReaderInternal(Client*) = 0; |
116 }; | 116 }; |
117 | 117 |
118 } // namespace blink | 118 } // namespace blink |
119 | 119 |
120 #endif // WebDataConsumerHandle_h | 120 #endif // WebDataConsumerHandle_h |
OLD | NEW |