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 #include "config.h" | 5 #include "config.h" |
6 #include "modules/fetch/BodyStreamBuffer.h" | 6 #include "modules/fetch/BodyStreamBuffer.h" |
7 | 7 |
8 #include "core/dom/DOMArrayBuffer.h" | 8 #include "core/dom/DOMArrayBuffer.h" |
9 #include "core/dom/DOMTypedArray.h" | 9 #include "core/dom/DOMTypedArray.h" |
10 #include "core/dom/ExceptionCode.h" | 10 #include "core/dom/ExceptionCode.h" |
11 #include "modules/fetch/DataConsumerHandleUtil.h" | 11 #include "modules/fetch/DataConsumerHandleUtil.h" |
12 #include "platform/blob/BlobData.h" | 12 #include "platform/blob/BlobData.h" |
13 #include "platform/network/FormData.h" | 13 #include "platform/network/EncodedFormData.h" |
14 | 14 |
15 namespace blink { | 15 namespace blink { |
16 | 16 |
17 class BodyStreamBuffer::LoaderHolder final : public GarbageCollectedFinalized<Lo
aderHolder>, public ActiveDOMObject, public FetchDataLoader::Client { | 17 class BodyStreamBuffer::LoaderHolder final : public GarbageCollectedFinalized<Lo
aderHolder>, public ActiveDOMObject, public FetchDataLoader::Client { |
18 WTF_MAKE_NONCOPYABLE(LoaderHolder); | 18 WTF_MAKE_NONCOPYABLE(LoaderHolder); |
19 USING_GARBAGE_COLLECTED_MIXIN(LoaderHolder); | 19 USING_GARBAGE_COLLECTED_MIXIN(LoaderHolder); |
20 public: | 20 public: |
21 LoaderHolder(ExecutionContext* executionContext, BodyStreamBuffer* buffer, F
etchDataLoader* loader, FetchDataLoader::Client* client) | 21 LoaderHolder(ExecutionContext* executionContext, BodyStreamBuffer* buffer, F
etchDataLoader* loader, FetchDataLoader::Client* client) |
22 : ActiveDOMObject(executionContext) | 22 : ActiveDOMObject(executionContext) |
23 , m_buffer(buffer) | 23 , m_buffer(buffer) |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 return nullptr; | 111 return nullptr; |
112 | 112 |
113 RefPtr<BlobDataHandle> blobDataHandle = m_reader->drainAsBlobDataHandle(poli
cy); | 113 RefPtr<BlobDataHandle> blobDataHandle = m_reader->drainAsBlobDataHandle(poli
cy); |
114 if (blobDataHandle) { | 114 if (blobDataHandle) { |
115 close(); | 115 close(); |
116 return blobDataHandle.release(); | 116 return blobDataHandle.release(); |
117 } | 117 } |
118 return nullptr; | 118 return nullptr; |
119 } | 119 } |
120 | 120 |
121 PassRefPtr<FormData> BodyStreamBuffer::drainAsFormData() | 121 PassRefPtr<EncodedFormData> BodyStreamBuffer::drainAsFormData() |
122 { | 122 { |
123 ASSERT(!isLocked()); | 123 ASSERT(!isLocked()); |
124 if (ReadableStream::Closed == m_stream->stateInternal() || ReadableStream::E
rrored == m_stream->stateInternal()) | 124 if (ReadableStream::Closed == m_stream->stateInternal() || ReadableStream::E
rrored == m_stream->stateInternal()) |
125 return nullptr; | 125 return nullptr; |
126 | 126 |
127 RefPtr<FormData> formData = m_reader->drainAsFormData(); | 127 RefPtr<EncodedFormData> formData = m_reader->drainAsFormData(); |
128 if (formData) { | 128 if (formData) { |
129 close(); | 129 close(); |
130 return formData.release(); | 130 return formData.release(); |
131 } | 131 } |
132 return nullptr; | 132 return nullptr; |
133 } | 133 } |
134 | 134 |
135 PassOwnPtr<FetchDataConsumerHandle> BodyStreamBuffer::lock(ExecutionContext* exe
cutionContext) | 135 PassOwnPtr<FetchDataConsumerHandle> BodyStreamBuffer::lock(ExecutionContext* exe
cutionContext) |
136 { | 136 { |
137 ASSERT(!isLocked()); | 137 ASSERT(!isLocked()); |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 unlock(); | 254 unlock(); |
255 if (mode == EndLoadingDone) { | 255 if (mode == EndLoadingDone) { |
256 close(); | 256 close(); |
257 } else { | 257 } else { |
258 ASSERT(mode == EndLoadingErrored); | 258 ASSERT(mode == EndLoadingErrored); |
259 error(); | 259 error(); |
260 } | 260 } |
261 } | 261 } |
262 | 262 |
263 } // namespace blink | 263 } // namespace blink |
OLD | NEW |