Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 Loading... | |
| 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 Loading... | |
| 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 |
| OLD | NEW |