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

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

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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2003, 2006, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2003, 2006, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2005, 2006 Alexey Proskuryakov <ap@nypop.com> 3 * Copyright (C) 2005, 2006 Alexey Proskuryakov <ap@nypop.com>
4 * Copyright (C) 2011 Google Inc. All rights reserved. 4 * Copyright (C) 2011 Google Inc. All rights reserved.
5 * Copyright (C) 2012 Intel Corporation 5 * Copyright (C) 2012 Intel Corporation
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public 8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 class XMLHttpRequestUpload; 66 class XMLHttpRequestUpload;
67 67
68 class XMLHttpRequest final : public XMLHttpRequestEventTarget, 68 class XMLHttpRequest final : public XMLHttpRequestEventTarget,
69 private ThreadableLoaderClient, 69 private ThreadableLoaderClient,
70 public DocumentParserClient, 70 public DocumentParserClient,
71 public ActiveScriptWrappable<XMLHttpRequest>, 71 public ActiveScriptWrappable<XMLHttpRequest>,
72 public SuspendableObject { 72 public SuspendableObject {
73 DEFINE_WRAPPERTYPEINFO(); 73 DEFINE_WRAPPERTYPEINFO();
74 USING_GARBAGE_COLLECTED_MIXIN(XMLHttpRequest); 74 USING_GARBAGE_COLLECTED_MIXIN(XMLHttpRequest);
75 75
76 // In some cases hasPendingActivity doesn't work correctly, i.e.,
Yuki 2017/01/20 07:02:53 IMHO, hasPendingActivity is not designed to keep t
yhirano 2017/01/20 07:10:10 We have contextDestroyed and it makes hasPendingAc
77 // doesn't keep |this| alive. We need to cancel the loader in such cases,
78 // which is why we need this pre-finalizer.
79 // TODO(yhirano): Remove this pre-finalizer when the bug is fixed.
80 USING_PRE_FINALIZER(XMLHttpRequest, dispose);
sof 2017/01/20 09:17:23 This object is already eagerly finalized, so also
yhirano 2017/01/20 09:49:56 No. As written in the ThreadableLoader comments, a
yhirano 2017/01/20 09:54:08 What happens if we specify both? 1) Something ve
sof 2017/01/20 09:57:45 3, it is confused and wasteful to do both. The des
81
76 public: 82 public:
77 static XMLHttpRequest* create(ScriptState*); 83 static XMLHttpRequest* create(ScriptState*);
78 static XMLHttpRequest* create(ExecutionContext*); 84 static XMLHttpRequest* create(ExecutionContext*);
79 ~XMLHttpRequest() override; 85 ~XMLHttpRequest() override;
80 86
81 // These exact numeric values are important because JS expects them. 87 // These exact numeric values are important because JS expects them.
82 enum State { 88 enum State {
83 kUnsent = 0, 89 kUnsent = 0,
84 kOpened = 1, 90 kOpened = 1,
85 kHeadersReceived = 2, 91 kHeadersReceived = 2,
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 const String& password, 129 const String& password,
124 ExceptionState&); 130 ExceptionState&);
125 void open(const AtomicString& method, 131 void open(const AtomicString& method,
126 const KURL&, 132 const KURL&,
127 bool async, 133 bool async,
128 ExceptionState&); 134 ExceptionState&);
129 void send( 135 void send(
130 const ArrayBufferOrArrayBufferViewOrBlobOrDocumentOrStringOrFormData&, 136 const ArrayBufferOrArrayBufferViewOrBlobOrDocumentOrStringOrFormData&,
131 ExceptionState&); 137 ExceptionState&);
132 void abort(); 138 void abort();
139 void dispose();
133 void setRequestHeader(const AtomicString& name, 140 void setRequestHeader(const AtomicString& name,
134 const AtomicString& value, 141 const AtomicString& value,
135 ExceptionState&); 142 ExceptionState&);
136 void overrideMimeType(const AtomicString& override, ExceptionState&); 143 void overrideMimeType(const AtomicString& override, ExceptionState&);
137 String getAllResponseHeaders() const; 144 String getAllResponseHeaders() const;
138 const AtomicString& getResponseHeader(const AtomicString&) const; 145 const AtomicString& getResponseHeader(const AtomicString&) const;
139 ScriptString responseText(ExceptionState&); 146 ScriptString responseText(ExceptionState&);
140 ScriptString responseJSONSource(); 147 ScriptString responseJSONSource();
141 Document* responseXML(ExceptionState&); 148 Document* responseXML(ExceptionState&);
142 Blob* responseBlob(); 149 Blob* responseBlob();
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 bool m_downloadingToFile; 342 bool m_downloadingToFile;
336 bool m_responseTextOverflow; 343 bool m_responseTextOverflow;
337 bool m_sendFlag; 344 bool m_sendFlag;
338 }; 345 };
339 346
340 std::ostream& operator<<(std::ostream&, const XMLHttpRequest*); 347 std::ostream& operator<<(std::ostream&, const XMLHttpRequest*);
341 348
342 } // namespace blink 349 } // namespace blink
343 350
344 #endif // XMLHttpRequest_h 351 #endif // XMLHttpRequest_h
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698