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 "FetchManager.h" | 6 #include "FetchManager.h" |
7 | 7 |
8 #include "bindings/core/v8/ExceptionState.h" | 8 #include "bindings/core/v8/ExceptionState.h" |
9 #include "bindings/core/v8/ScriptPromiseResolver.h" | 9 #include "bindings/core/v8/ScriptPromiseResolver.h" |
10 #include "bindings/core/v8/ScriptState.h" | 10 #include "bindings/core/v8/ScriptState.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "platform/weborigin/SecurityOrigin.h" | 21 #include "platform/weborigin/SecurityOrigin.h" |
22 #include "public/platform/WebURLRequest.h" | 22 #include "public/platform/WebURLRequest.h" |
23 #include "wtf/HashSet.h" | 23 #include "wtf/HashSet.h" |
24 | 24 |
25 namespace blink { | 25 namespace blink { |
26 | 26 |
27 class FetchManager::Loader : public ThreadableLoaderClient { | 27 class FetchManager::Loader : public ThreadableLoaderClient { |
28 public: | 28 public: |
29 Loader(ExecutionContext*, FetchManager*, PassRefPtr<ScriptPromiseResolver>,
const FetchRequestData*); | 29 Loader(ExecutionContext*, FetchManager*, PassRefPtr<ScriptPromiseResolver>,
const FetchRequestData*); |
30 ~Loader(); | 30 ~Loader(); |
31 virtual void didReceiveResponse(unsigned long, const ResourceResponse&); | 31 virtual void didReceiveResponse(unsigned long, const ResourceResponse&, Pass
OwnPtr<WebDataConsumerHandle>); |
32 virtual void didFinishLoading(unsigned long, double); | 32 virtual void didFinishLoading(unsigned long, double); |
33 virtual void didFail(const ResourceError&); | 33 virtual void didFail(const ResourceError&); |
34 virtual void didFailAccessControlCheck(const ResourceError&); | 34 virtual void didFailAccessControlCheck(const ResourceError&); |
35 virtual void didFailRedirectCheck(); | 35 virtual void didFailRedirectCheck(); |
36 virtual void didDownloadData(int); | 36 virtual void didDownloadData(int); |
37 | 37 |
38 void start(); | 38 void start(); |
39 void cleanup(); | 39 void cleanup(); |
40 | 40 |
41 private: | 41 private: |
(...skipping 26 matching lines...) Expand all Loading... |
68 , m_failed(false) | 68 , m_failed(false) |
69 { | 69 { |
70 } | 70 } |
71 | 71 |
72 FetchManager::Loader::~Loader() | 72 FetchManager::Loader::~Loader() |
73 { | 73 { |
74 if (m_loader) | 74 if (m_loader) |
75 m_loader->cancel(); | 75 m_loader->cancel(); |
76 } | 76 } |
77 | 77 |
78 void FetchManager::Loader::didReceiveResponse(unsigned long, const ResourceRespo
nse& response) | 78 void FetchManager::Loader::didReceiveResponse(unsigned long, const ResourceRespo
nse& response, PassOwnPtr<WebDataConsumerHandle> handle) |
79 { | 79 { |
| 80 // FIXME: Use |handle|. |
| 81 ASSERT_UNUSED(handle, !handle); |
80 m_response = response; | 82 m_response = response; |
81 } | 83 } |
82 | 84 |
83 void FetchManager::Loader::didFinishLoading(unsigned long, double) | 85 void FetchManager::Loader::didFinishLoading(unsigned long, double) |
84 { | 86 { |
85 if (!m_resolver->executionContext() || m_resolver->executionContext()->activ
eDOMObjectsAreStopped()) | 87 if (!m_resolver->executionContext() || m_resolver->executionContext()->activ
eDOMObjectsAreStopped()) |
86 return; | 88 return; |
87 | 89 |
88 OwnPtr<BlobData> blobData = BlobData::create(); | 90 OwnPtr<BlobData> blobData = BlobData::create(); |
89 String filePath = m_response.downloadedFilePath(); | 91 String filePath = m_response.downloadedFilePath(); |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 loader->start(); | 363 loader->start(); |
362 return promise; | 364 return promise; |
363 } | 365 } |
364 | 366 |
365 void FetchManager::onLoaderFinished(Loader* loader) | 367 void FetchManager::onLoaderFinished(Loader* loader) |
366 { | 368 { |
367 m_loaders.remove(loader); | 369 m_loaders.remove(loader); |
368 } | 370 } |
369 | 371 |
370 } // namespace blink | 372 } // namespace blink |
OLD | NEW |