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

Side by Side Diff: Source/core/xml/XMLHttpRequest.h

Issue 521363002: Make XHR use the background HTML parser (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: register before finish Created 6 years, 3 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 | Annotate | Revision Log
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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 143
144 void setLastSendLineNumber(unsigned lineNumber) { m_lastSendLineNumber = lin eNumber; } 144 void setLastSendLineNumber(unsigned lineNumber) { m_lastSendLineNumber = lin eNumber; }
145 void setLastSendURL(const String& url) { m_lastSendURL = url; } 145 void setLastSendURL(const String& url) { m_lastSendURL = url; }
146 146
147 XMLHttpRequestUpload* upload(); 147 XMLHttpRequestUpload* upload();
148 148
149 DEFINE_ATTRIBUTE_EVENT_LISTENER(readystatechange); 149 DEFINE_ATTRIBUTE_EVENT_LISTENER(readystatechange);
150 150
151 virtual void trace(Visitor*) OVERRIDE; 151 virtual void trace(Visitor*) OVERRIDE;
152 152
153 static XMLHttpRequest* findInstancePendingDocumentParse(Document*);
154
155 // This is only to be called from |Document::finishedParsing()|.
156 // When we use the off-thread HTML parser, we don't have a complete document
157 // just after |HTMLDocumentParser::finish()|. This method is used to notify
158 // that the response document is completely built.
159 void didFinishParsingDocument();
160
153 private: 161 private:
154 XMLHttpRequest(ExecutionContext*, PassRefPtr<SecurityOrigin>); 162 XMLHttpRequest(ExecutionContext*, PassRefPtr<SecurityOrigin>);
155 163
156 Document* document() const; 164 Document* document() const;
157 SecurityOrigin* securityOrigin() const; 165 SecurityOrigin* securityOrigin() const;
158 166
159 virtual void didSendData(unsigned long long bytesSent, unsigned long long to talBytesToBeSent) OVERRIDE; 167 virtual void didSendData(unsigned long long bytesSent, unsigned long long to talBytesToBeSent) OVERRIDE;
160 virtual void didReceiveResponse(unsigned long identifier, const ResourceResp onse&) OVERRIDE; 168 virtual void didReceiveResponse(unsigned long identifier, const ResourceResp onse&) OVERRIDE;
161 virtual void didReceiveData(const char* data, int dataLength) OVERRIDE; 169 virtual void didReceiveData(const char* data, int dataLength) OVERRIDE;
162 // When responseType is set to "blob", didDownloadData() is called instead 170 // When responseType is set to "blob", didDownloadData() is called instead
163 // of didReceiveData(). 171 // of didReceiveData().
164 virtual void didDownloadData(int dataLength) OVERRIDE; 172 virtual void didDownloadData(int dataLength) OVERRIDE;
165 virtual void didFinishLoading(unsigned long identifier, double finishTime) O VERRIDE; 173 virtual void didFinishLoading(unsigned long identifier, double finishTime) O VERRIDE;
166 virtual void didFail(const ResourceError&) OVERRIDE; 174 virtual void didFail(const ResourceError&) OVERRIDE;
167 virtual void didFailRedirectCheck() OVERRIDE; 175 virtual void didFailRedirectCheck() OVERRIDE;
168 176
177 void endLoading();
178
169 // Returns the MIME type part of m_mimeTypeOverride if present and 179 // Returns the MIME type part of m_mimeTypeOverride if present and
170 // successfully parsed, or returns one of the "Content-Type" header value 180 // successfully parsed, or returns one of the "Content-Type" header value
171 // of the received response. 181 // of the received response.
172 // 182 //
173 // This method is named after the term "final MIME type" defined in the 183 // This method is named after the term "final MIME type" defined in the
174 // spec but doesn't convert the result to ASCII lowercase as specified in 184 // spec but doesn't convert the result to ASCII lowercase as specified in
175 // the spec. Must be lowered later or compared using case insensitive 185 // the spec. Must be lowered later or compared using case insensitive
176 // comparison functions if required. 186 // comparison functions if required.
177 AtomicString finalResponseMIMEType() const; 187 AtomicString finalResponseMIMEType() const;
178 // The same as finalResponseMIMEType() but fallbacks to "text/xml" if 188 // The same as finalResponseMIMEType() but fallbacks to "text/xml" if
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 // Not converted to ASCII lowercase. Must be lowered later or compared 247 // Not converted to ASCII lowercase. Must be lowered later or compared
238 // using case insensitive comparison functions if needed. 248 // using case insensitive comparison functions if needed.
239 AtomicString m_mimeTypeOverride; 249 AtomicString m_mimeTypeOverride;
240 unsigned long m_timeoutMilliseconds; 250 unsigned long m_timeoutMilliseconds;
241 RefPtrWillBeMember<Blob> m_responseBlob; 251 RefPtrWillBeMember<Blob> m_responseBlob;
242 RefPtrWillBeMember<Stream> m_responseLegacyStream; 252 RefPtrWillBeMember<Stream> m_responseLegacyStream;
243 PersistentWillBeMember<ReadableStreamImpl<ReadableStreamChunkTypeTraits<Arra yBuffer> > > m_responseStream; 253 PersistentWillBeMember<ReadableStreamImpl<ReadableStreamChunkTypeTraits<Arra yBuffer> > > m_responseStream;
244 PersistentWillBeMember<UnderlyingSource> m_streamSource; 254 PersistentWillBeMember<UnderlyingSource> m_streamSource;
245 255
246 RefPtr<ThreadableLoader> m_loader; 256 RefPtr<ThreadableLoader> m_loader;
257 unsigned long m_loaderIdentifier;
247 State m_state; 258 State m_state;
248 259
249 ResourceResponse m_response; 260 ResourceResponse m_response;
250 String m_finalResponseCharset; 261 String m_finalResponseCharset;
251 262
252 OwnPtr<TextResourceDecoder> m_decoder; 263 OwnPtr<TextResourceDecoder> m_decoder;
253 264
254 ScriptString m_responseText; 265 ScriptString m_responseText;
255 RefPtrWillBeMember<Document> m_responseDocument; 266 RefPtrWillBeMember<Document> m_responseDocument;
256 RefPtrWillBeMember<DocumentParser> m_responseDocumentParser; 267 RefPtrWillBeMember<DocumentParser> m_responseDocumentParser;
(...skipping 26 matching lines...) Expand all
283 bool m_parsedResponse; 294 bool m_parsedResponse;
284 bool m_error; 295 bool m_error;
285 bool m_uploadEventsAllowed; 296 bool m_uploadEventsAllowed;
286 bool m_uploadComplete; 297 bool m_uploadComplete;
287 bool m_sameOriginRequest; 298 bool m_sameOriginRequest;
288 }; 299 };
289 300
290 } // namespace blink 301 } // namespace blink
291 302
292 #endif // XMLHttpRequest_h 303 #endif // XMLHttpRequest_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698