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