OLD | NEW |
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 #include "modules/fetch/ReadableStreamDataConsumerHandle.h" | 5 #include "modules/fetch/ReadableStreamDataConsumerHandle.h" |
6 | 6 |
7 #include "bindings/core/v8/ExceptionState.h" | 7 #include "bindings/core/v8/ExceptionState.h" |
8 #include "bindings/core/v8/ScopedPersistent.h" | 8 #include "bindings/core/v8/ScopedPersistent.h" |
9 #include "bindings/core/v8/ScriptFunction.h" | 9 #include "bindings/core/v8/ScriptFunction.h" |
10 #include "bindings/core/v8/ScriptState.h" | 10 #include "bindings/core/v8/ScriptState.h" |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 data.GetParameter()->onCollected(); | 251 data.GetParameter()->onCollected(); |
252 } | 252 } |
253 | 253 |
254 // |m_reader| is a weak persistent. It should be kept alive by someone | 254 // |m_reader| is a weak persistent. It should be kept alive by someone |
255 // outside of ReadableStreamDataConsumerHandle. | 255 // outside of ReadableStreamDataConsumerHandle. |
256 // Holding a ScopedPersistent here is safe in terms of cross-world wrapper | 256 // Holding a ScopedPersistent here is safe in terms of cross-world wrapper |
257 // leakage because we read only Uint8Array chunks from the reader. | 257 // leakage because we read only Uint8Array chunks from the reader. |
258 ScopedPersistent<v8::Value> m_reader; | 258 ScopedPersistent<v8::Value> m_reader; |
259 RefPtr<ScriptState> m_scriptState; | 259 RefPtr<ScriptState> m_scriptState; |
260 WebDataConsumerHandle::Client* m_client; | 260 WebDataConsumerHandle::Client* m_client; |
261 RefPtr<DOMUint8Array> m_pendingBuffer; | 261 Persistent<DOMUint8Array> m_pendingBuffer; |
262 size_t m_pendingOffset; | 262 size_t m_pendingOffset; |
263 bool m_isReading; | 263 bool m_isReading; |
264 bool m_isDone; | 264 bool m_isDone; |
265 bool m_hasError; | 265 bool m_hasError; |
266 }; | 266 }; |
267 | 267 |
268 ReadableStreamDataConsumerHandle::ReadableStreamDataConsumerHandle(ScriptState*
scriptState, ScriptValue streamReader) | 268 ReadableStreamDataConsumerHandle::ReadableStreamDataConsumerHandle(ScriptState*
scriptState, ScriptValue streamReader) |
269 : m_readingContext(ReadingContext::create(scriptState, streamReader)) | 269 : m_readingContext(ReadingContext::create(scriptState, streamReader)) |
270 { | 270 { |
271 } | 271 } |
272 ReadableStreamDataConsumerHandle::~ReadableStreamDataConsumerHandle() = default; | 272 ReadableStreamDataConsumerHandle::~ReadableStreamDataConsumerHandle() = default; |
273 | 273 |
274 FetchDataConsumerHandle::Reader* ReadableStreamDataConsumerHandle::obtainReaderI
nternal(Client* client) | 274 FetchDataConsumerHandle::Reader* ReadableStreamDataConsumerHandle::obtainReaderI
nternal(Client* client) |
275 { | 275 { |
276 return new ReadingContext::ReaderImpl(m_readingContext, client); | 276 return new ReadingContext::ReaderImpl(m_readingContext, client); |
277 } | 277 } |
278 | 278 |
279 } // namespace blink | 279 } // namespace blink |
280 | 280 |
OLD | NEW |