| 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 |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 PassOwnPtr<Reader> obtainReader(Client* client) { return adoptPtr(obtainRead
erInternal(client)); } | 113 PassOwnPtr<Reader> obtainReader(Client* client) { return adoptPtr(obtainRead
erInternal(client)); } |
| 114 #endif | 114 #endif |
| 115 | 115 |
| 116 private: | 116 private: |
| 117 // The caller takes ownership of the returned object. | 117 // The caller takes ownership of the returned object. |
| 118 virtual Reader* obtainReaderInternal(Client* client) | 118 virtual Reader* obtainReaderInternal(Client* client) |
| 119 { | 119 { |
| 120 BLINK_ASSERT_NOT_REACHED(); | 120 BLINK_ASSERT_NOT_REACHED(); |
| 121 return nullptr; | 121 return nullptr; |
| 122 } | 122 } |
| 123 | |
| 124 // Below are deprecated functions that will be removed shortly. Use Reader | |
| 125 // instead. | |
| 126 public: | |
| 127 // Note: read / beginRead / endRead / unregisterClient must not be called | |
| 128 // when a client is regsitered. They must be called on the thread on which | |
| 129 // registerClient is called. registerClient must not be called when a client | |
| 130 // is already registered. | |
| 131 | |
| 132 // Reads data into |data| up to |size| bytes. The actual read size will be | |
| 133 // stored in |*readSize|. This function cannot be called when a two-phase | |
| 134 // read is in progress. | |
| 135 // Returns Done when it reaches to the end of the data. | |
| 136 virtual Result read(void* data, size_t /* size */, Flags, size_t* readSize)
{ return UnexpectedError; } | |
| 137 | |
| 138 // Begins a two-phase read. On success, the function stores a buffer that | |
| 139 // contains the read data of length |*available| into |*buffer|. | |
| 140 // Returns Done when it reaches to the end of the data. | |
| 141 // On fail, you don't have to (and should not) call endRead, because the | |
| 142 // read session implicitly ends in that case. | |
| 143 virtual Result beginRead(const void** buffer, Flags, size_t* available) { re
turn UnexpectedError; } | |
| 144 | |
| 145 // Ends a two-phase read. | |
| 146 // |readSize| indicates the actual read size. | |
| 147 virtual Result endRead(size_t readSize) { return UnexpectedError; } | |
| 148 | |
| 149 // Registers |client| to this handle. The client must not be null and must | |
| 150 // be valid until it is unregistered (or the handle is destructed). | |
| 151 // Only one registration can be made for a handle at a time. | |
| 152 virtual void registerClient(Client* /* client */) { } | |
| 153 | |
| 154 // Unregisters |client| from this handle. | |
| 155 virtual void unregisterClient() { } | |
| 156 }; | 123 }; |
| 157 | 124 |
| 158 } // namespace blink | 125 } // namespace blink |
| 159 | 126 |
| 160 #endif // WebDataConsumerHandle_h | 127 #endif // WebDataConsumerHandle_h |
| OLD | NEW |