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

Side by Side Diff: third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.cpp

Issue 2649513002: Add a pre-finalizer for XHR to cancel the loader (Closed)
Patch Set: Created 3 years, 11 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2005-2007 Alexey Proskuryakov <ap@webkit.org> 3 * Copyright (C) 2005-2007 Alexey Proskuryakov <ap@webkit.org>
4 * Copyright (C) 2007, 2008 Julien Chaffraix <jchaffraix@webkit.org> 4 * Copyright (C) 2007, 2008 Julien Chaffraix <jchaffraix@webkit.org>
5 * Copyright (C) 2008, 2011 Google Inc. All rights reserved. 5 * Copyright (C) 2008, 2011 Google Inc. All rights reserved.
6 * Copyright (C) 2012 Intel Corporation 6 * Copyright (C) 2012 Intel Corporation
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public 9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 1086 matching lines...) Expand 10 before | Expand all | Expand 10 after
1097 m_state == kLoading) { 1097 m_state == kLoading) {
1098 DCHECK(!m_loader); 1098 DCHECK(!m_loader);
1099 handleRequestError(0, EventTypeNames::abort, receivedLength, 1099 handleRequestError(0, EventTypeNames::abort, receivedLength,
1100 expectedLength); 1100 expectedLength);
1101 } 1101 }
1102 } 1102 }
1103 if (m_state == kDone) 1103 if (m_state == kDone)
1104 m_state = kUnsent; 1104 m_state = kUnsent;
1105 } 1105 }
1106 1106
1107 void XMLHttpRequest::dispose() {
1108 if (m_loader) {
1109 m_error = true;
1110 m_loader->cancel();
1111 }
1112 }
1113
1107 void XMLHttpRequest::clearVariablesForLoading() { 1114 void XMLHttpRequest::clearVariablesForLoading() {
1108 if (m_blobLoader) { 1115 if (m_blobLoader) {
1109 m_blobLoader->cancel(); 1116 m_blobLoader->cancel();
1110 m_blobLoader = nullptr; 1117 m_blobLoader = nullptr;
1111 } 1118 }
1112 1119
1113 m_decoder.reset(); 1120 m_decoder.reset();
1114 1121
1115 if (m_responseDocumentParser) { 1122 if (m_responseDocumentParser) {
1116 m_responseDocumentParser->removeClient(this); 1123 m_responseDocumentParser->removeClient(this);
(...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after
1860 visitor->traceWrappers(m_responseDocument); 1867 visitor->traceWrappers(m_responseDocument);
1861 visitor->traceWrappers(m_responseArrayBuffer); 1868 visitor->traceWrappers(m_responseArrayBuffer);
1862 XMLHttpRequestEventTarget::traceWrappers(visitor); 1869 XMLHttpRequestEventTarget::traceWrappers(visitor);
1863 } 1870 }
1864 1871
1865 std::ostream& operator<<(std::ostream& ostream, const XMLHttpRequest* xhr) { 1872 std::ostream& operator<<(std::ostream& ostream, const XMLHttpRequest* xhr) {
1866 return ostream << "XMLHttpRequest " << static_cast<const void*>(xhr); 1873 return ostream << "XMLHttpRequest " << static_cast<const void*>(xhr);
1867 } 1874 }
1868 1875
1869 } // namespace blink 1876 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698