Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(211)

Side by Side Diff: Source/modules/fetch/FetchManager.cpp

Issue 1230543002: [Fetch] Cleanup unused methods (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/modules/fetch/Body.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/FetchManager.h" 6 #include "modules/fetch/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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 ~Loader() override; 43 ~Loader() override;
44 DECLARE_VIRTUAL_TRACE(); 44 DECLARE_VIRTUAL_TRACE();
45 45
46 void didReceiveResponse(unsigned long, const ResourceResponse&, PassOwnPtr<W ebDataConsumerHandle>) override; 46 void didReceiveResponse(unsigned long, const ResourceResponse&, PassOwnPtr<W ebDataConsumerHandle>) override;
47 void didFinishLoading(unsigned long, double) override; 47 void didFinishLoading(unsigned long, double) override;
48 void didFail(const ResourceError&) override; 48 void didFail(const ResourceError&) override;
49 void didFailAccessControlCheck(const ResourceError&) override; 49 void didFailAccessControlCheck(const ResourceError&) override;
50 void didFailRedirectCheck() override; 50 void didFailRedirectCheck() override;
51 51
52 void start(); 52 void start();
53 void cancel();
54 void dispose(); 53 void dispose();
55 54
56 private: 55 private:
57 Loader(ExecutionContext*, FetchManager*, PassRefPtrWillBeRawPtr<ScriptPromis eResolver>, FetchRequestData*); 56 Loader(ExecutionContext*, FetchManager*, PassRefPtrWillBeRawPtr<ScriptPromis eResolver>, FetchRequestData*);
58 57
59 void performBasicFetch(); 58 void performBasicFetch();
60 void performNetworkError(const String& message); 59 void performNetworkError(const String& message);
61 void performHTTPFetch(bool corsFlag, bool corsPreflightFlag); 60 void performHTTPFetch(bool corsFlag, bool corsPreflightFlag);
62 void failed(const String& message); 61 void failed(const String& message);
63 void notifyFinished(); 62 void notifyFinished();
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 } 249 }
251 250
252 // "- Otherwise 251 // "- Otherwise
253 // Set |request|'s response tainting to |CORS|." 252 // Set |request|'s response tainting to |CORS|."
254 m_request->setResponseTainting(FetchRequestData::CORSTainting); 253 m_request->setResponseTainting(FetchRequestData::CORSTainting);
255 // "The result of performing an HTTP fetch using |request| with the 254 // "The result of performing an HTTP fetch using |request| with the
256 // |CORS flag| set." 255 // |CORS flag| set."
257 performHTTPFetch(true, false); 256 performHTTPFetch(true, false);
258 } 257 }
259 258
260 void FetchManager::Loader::cancel()
261 {
262 m_finished = true;
263 if (m_loader) {
264 m_loader->cancel();
265 m_loader.clear();
266 }
267 if (m_resolver) {
268 // Note: In the current implementation this branch is never taken
269 // because this function can be called only through the body stream.
270 ScriptState* scriptState = m_resolver->scriptState();
271 ScriptState::Scope scope(scriptState);
272 m_resolver->reject(V8ThrowException::createTypeError(scriptState->isolat e(), "fetch is cancelled"));
273 m_resolver.clear();
274 }
275
276 notifyFinished();
277 }
278
279 void FetchManager::Loader::dispose() 259 void FetchManager::Loader::dispose()
280 { 260 {
281 // Prevent notification 261 // Prevent notification
282 m_fetchManager = nullptr; 262 m_fetchManager = nullptr;
283 if (m_loader) { 263 if (m_loader) {
284 m_loader->cancel(); 264 m_loader->cancel();
285 m_loader.clear(); 265 m_loader.clear();
286 } 266 }
287 } 267 }
288 268
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 430
451 DEFINE_TRACE(FetchManager) 431 DEFINE_TRACE(FetchManager)
452 { 432 {
453 #if ENABLE(OILPAN) 433 #if ENABLE(OILPAN)
454 visitor->trace(m_executionContext); 434 visitor->trace(m_executionContext);
455 visitor->trace(m_loaders); 435 visitor->trace(m_loaders);
456 #endif 436 #endif
457 } 437 }
458 438
459 } // namespace blink 439 } // namespace blink
OLDNEW
« no previous file with comments | « Source/modules/fetch/Body.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698