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 "config.h" | 5 #include "config.h" |
6 #include "modules/fetch/FetchDataLoader.h" | 6 #include "modules/fetch/FetchDataLoader.h" |
7 | 7 |
8 #include "core/html/parser/TextResourceDecoder.h" | 8 #include "core/html/parser/TextResourceDecoder.h" |
9 #include "wtf/ArrayBufferBuilder.h" | 9 #include "wtf/ArrayBufferBuilder.h" |
10 #include "wtf/text/StringBuilder.h" | 10 #include "wtf/text/StringBuilder.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 void start(FetchDataConsumerHandle* handle, FetchDataLoader::Client* client)
override | 32 void start(FetchDataConsumerHandle* handle, FetchDataLoader::Client* client)
override |
33 { | 33 { |
34 ASSERT(!m_client); | 34 ASSERT(!m_client); |
35 ASSERT(!m_reader); | 35 ASSERT(!m_reader); |
36 | 36 |
37 m_client = client; | 37 m_client = client; |
38 // Passing |this| here is safe because |this| owns |m_reader|. | 38 // Passing |this| here is safe because |this| owns |m_reader|. |
39 m_reader = handle->obtainReader(this); | 39 m_reader = handle->obtainReader(this); |
40 RefPtr<BlobDataHandle> blobHandle = m_reader->drainAsBlobDataHandle(); | 40 RefPtr<BlobDataHandle> blobHandle = m_reader->drainAsBlobDataHandle(); |
41 if (blobHandle) { | 41 if (blobHandle) { |
42 ASSERT(blobHandle->size() != kuint64max); | 42 ASSERT(blobHandle->size() != UINT64_MAX); |
43 m_reader.clear(); | 43 m_reader.clear(); |
44 if (blobHandle->type() != m_mimeType) { | 44 if (blobHandle->type() != m_mimeType) { |
45 // A new BlobDataHandle is created to override the Blob's type. | 45 // A new BlobDataHandle is created to override the Blob's type. |
46 m_client->didFetchDataLoadedBlobHandle(BlobDataHandle::create(bl
obHandle->uuid(), m_mimeType, blobHandle->size())); | 46 m_client->didFetchDataLoadedBlobHandle(BlobDataHandle::create(bl
obHandle->uuid(), m_mimeType, blobHandle->size())); |
47 } else { | 47 } else { |
48 m_client->didFetchDataLoadedBlobHandle(blobHandle); | 48 m_client->didFetchDataLoadedBlobHandle(blobHandle); |
49 } | 49 } |
50 m_client.clear(); | 50 m_client.clear(); |
51 return; | 51 return; |
52 } | 52 } |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 { | 393 { |
394 return new FetchDataLoaderAsString(); | 394 return new FetchDataLoaderAsString(); |
395 } | 395 } |
396 | 396 |
397 FetchDataLoader* FetchDataLoader::createLoaderAsStream(Stream* outStream) | 397 FetchDataLoader* FetchDataLoader::createLoaderAsStream(Stream* outStream) |
398 { | 398 { |
399 return new FetchDataLoaderAsStream(outStream); | 399 return new FetchDataLoaderAsStream(outStream); |
400 } | 400 } |
401 | 401 |
402 } // namespace blink | 402 } // namespace blink |
OLD | NEW |