Changeset 69688 in webkit
- Timestamp:
- Oct 13, 2010 1:10:37 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 1 deleted
- 40 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r69683 r69688 1 2010-10-13 Gavin Barraclough <barraclough@apple.com> 2 3 Reviewed by Oliver Hunt. 4 5 https://bugs.webkit.org/show_bug.cgi?id=43987 6 Switch XMLHttpRequest, FileReader, and FileReaderSync to use a Stringbuilder 7 to construct their internal result string. Remove ScriptString (this is now 8 redundant). 9 10 * WebCore.xcodeproj/project.pbxproj: 11 * bindings/js/JSDOMBinding.cpp: 12 (WebCore::jsOwnedStringOrNull): 13 * bindings/js/JSDOMBinding.h: 14 * bindings/js/JSXMLHttpRequestCustom.cpp: 15 (WebCore::JSXMLHttpRequest::responseText): 16 * bindings/js/ScriptCallFrame.cpp: 17 (WebCore::ScriptCallFrame::ScriptCallFrame): 18 * bindings/js/ScriptCallFrame.h: 19 (WebCore::ScriptCallFrame::functionName): 20 * bindings/js/ScriptCallStack.h: 21 * bindings/js/ScriptFunctionCall.cpp: 22 * bindings/js/ScriptFunctionCall.h: 23 * bindings/js/ScriptString.h: Removed. 24 * dom/ScriptExecutionContext.h: 25 * fileapi/FileReader.cpp: 26 (WebCore::FileReader::FileReader): 27 (WebCore::FileReader::abort): 28 (WebCore::FileReader::didReceiveData): 29 (WebCore::FileReader::result): 30 (WebCore::FileReader::convertToText): 31 (WebCore::FileReader::convertToDataURL): 32 * fileapi/FileReader.h: 33 * fileapi/FileReaderSync.cpp: 34 (WebCore::FileReaderSyncLoader::FileReaderSyncLoader): 35 (WebCore::FileReaderSyncLoader::didReceiveData): 36 (WebCore::FileReaderSync::readAsBinaryString): 37 (WebCore::FileReaderSync::readAsText): 38 (WebCore::FileReaderSync::readAsDataURL): 39 (WebCore::FileReaderSync::read): 40 (WebCore::FileReaderSync::convertToText): 41 * fileapi/FileReaderSync.h: 42 (WebCore::FileReaderSync::readAsText): 43 (WebCore::FileReaderSync::FileReaderSync): 44 * inspector/InspectorController.cpp: 45 (WebCore::InspectorController::resourceRetrievedByXMLHttpRequest): 46 (WebCore::InspectorController::scriptImported): 47 * inspector/InspectorController.h: 48 * inspector/InspectorResource.cpp: 49 (WebCore::InspectorResource::setOverrideContent): 50 * inspector/InspectorResource.h: 51 * loader/FrameLoader.cpp: 52 * loader/FrameLoader.h: 53 * loader/FrameLoaderClient.h: 54 * loader/ResourceLoadNotifier.h: 55 * workers/WorkerScriptLoader.h: 56 * xml/XMLHttpRequest.cpp: 57 (WebCore::XMLHttpRequest::XMLHttpRequest): 58 (WebCore::XMLHttpRequest::responseText): 59 (WebCore::XMLHttpRequest::responseXML): 60 (WebCore::XMLHttpRequest::abort): 61 (WebCore::XMLHttpRequest::clearResponse): 62 (WebCore::XMLHttpRequest::dropProtection): 63 (WebCore::XMLHttpRequest::didFinishLoading): 64 (WebCore::XMLHttpRequest::didReceiveData): 65 * xml/XMLHttpRequest.h: 66 1 67 2010-10-13 Gavin Barraclough <barraclough@apple.com> 2 68 -
trunk/WebCore/WebCore.xcodeproj/project.pbxproj
r69660 r69688 877 877 416E75CB0EDF90C700360E1D /* ScriptCallFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = 416E75C90EDF90C700360E1D /* ScriptCallFrame.h */; }; 878 878 416E75CC0EDF90C700360E1D /* ScriptCallFrame.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 416E75CA0EDF90C700360E1D /* ScriptCallFrame.cpp */; }; 879 416F45F00ED7B311008215B6 /* ScriptString.h in Headers */ = {isa = PBXBuildFile; fileRef = 416F45EF0ED7B311008215B6 /* ScriptString.h */; settings = {ATTRIBUTES = (Private, ); }; };880 879 41885B9311B6FDA6003383BB /* FormSubmission.h in Headers */ = {isa = PBXBuildFile; fileRef = 41885B9111B6FDA6003383BB /* FormSubmission.h */; settings = {ATTRIBUTES = (Private, ); }; }; 881 880 41885B9411B6FDA6003383BB /* FormSubmission.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41885B9211B6FDA6003383BB /* FormSubmission.cpp */; }; … … 6900 6899 416E75C90EDF90C700360E1D /* ScriptCallFrame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptCallFrame.h; sourceTree = "<group>"; }; 6901 6900 416E75CA0EDF90C700360E1D /* ScriptCallFrame.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptCallFrame.cpp; sourceTree = "<group>"; }; 6902 416F45EF0ED7B311008215B6 /* ScriptString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptString.h; sourceTree = "<group>"; };6903 6901 41885B9111B6FDA6003383BB /* FormSubmission.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FormSubmission.h; sourceTree = "<group>"; }; 6904 6902 41885B9211B6FDA6003383BB /* FormSubmission.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FormSubmission.cpp; sourceTree = "<group>"; }; … … 16749 16747 4127D5360F8AAB1D00E424F5 /* ScriptState.cpp */, 16750 16748 41C760B00EDE03D300C1655F /* ScriptState.h */, 16751 416F45EF0ED7B311008215B6 /* ScriptString.h */,16752 16749 934CC0DF0ED39D6F00A658F2 /* ScriptValue.cpp */, 16753 16750 934CC0E00ED39D6F00A658F2 /* ScriptValue.h */, … … 20524 20521 CE54FD381016D9A6008B44C8 /* ScriptSourceProvider.h in Headers */, 20525 20522 41C760B10EDE03D300C1655F /* ScriptState.h in Headers */, 20526 416F45F00ED7B311008215B6 /* ScriptString.h in Headers */,20527 20523 934CC0E20ED39D6F00A658F2 /* ScriptValue.h in Headers */, 20528 20524 228C284510D82500009D0D0E /* ScriptWrappable.h in Headers */, -
trunk/WebCore/bindings/js/JSDOMBinding.cpp
r68854 r69688 453 453 } 454 454 455 JSValue jsOwnedStringOrNull(ExecState* exec, const String& s) 456 { 457 if (s.isNull()) 458 return jsNull(); 459 return jsOwnedString(exec, stringToUString(s)); 460 } 461 455 462 JSValue jsOwnedStringOrNull(ExecState* exec, const UString& s) 456 463 { -
trunk/WebCore/bindings/js/JSDOMBinding.h
r67825 r69688 255 255 // See JavaScriptCore for explanation: Should be used for any UString that is already owned by another 256 256 // object, to let the engine know that collecting the JSString wrapper is unlikely to save memory. 257 JSC::JSValue jsOwnedStringOrNull(JSC::ExecState*, const String&); 257 258 JSC::JSValue jsOwnedStringOrNull(JSC::ExecState*, const JSC::UString&); 258 259 -
trunk/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp
r69283 r69688 129 129 { 130 130 ExceptionCode ec = 0; 131 const ScriptString&text = impl()->responseText(ec);131 String text = impl()->responseText(ec); 132 132 if (ec) { 133 133 setDOMException(exec, ec); -
trunk/WebCore/bindings/js/ScriptCallFrame.cpp
r69662 r69688 40 40 41 41 ScriptCallFrame::ScriptCallFrame(const UString& functionName, const UString& urlString, int lineNumber, ExecState* exec, unsigned skipArgumentCount) 42 : m_functionName( functionName)42 : m_functionName(ustringToString(functionName)) 43 43 , m_sourceURL(ustringToString(urlString)) 44 44 , m_lineNumber(lineNumber) -
trunk/WebCore/bindings/js/ScriptCallFrame.h
r69662 r69688 33 33 34 34 #include <runtime/ArgList.h> 35 #include "ScriptString.h"36 35 #include "ScriptValue.h" 37 36 #include <wtf/Vector.h> … … 53 52 ~ScriptCallFrame(); 54 53 55 const S criptString& functionName() const { return m_functionName; }54 const String& functionName() const { return m_functionName; } 56 55 const String& sourceURL() const { return m_sourceURL; } 57 56 unsigned lineNumber() const { return m_lineNumber; } … … 62 61 63 62 private: 64 S criptString m_functionName;63 String m_functionName; 65 64 String m_sourceURL; 66 65 unsigned m_lineNumber; -
trunk/WebCore/bindings/js/ScriptCallStack.h
r64735 r69688 34 34 #include "ScriptCallFrame.h" 35 35 #include "ScriptState.h" 36 #include "ScriptString.h"37 36 #include <wtf/Noncopyable.h> 38 37 #include <wtf/RefPtr.h> -
trunk/WebCore/bindings/js/ScriptFunctionCall.cpp
r68146 r69688 34 34 #include "JSDOMBinding.h" 35 35 #include "JSMainThreadExecState.h" 36 #include "ScriptString.h"37 36 #include "ScriptValue.h" 38 37 … … 51 50 } 52 51 m_arguments.append(argument.jsObject()); 53 }54 55 void ScriptCallArgumentHandler::appendArgument(const ScriptString& argument)56 {57 m_arguments.append(jsString(m_exec, argument.ustring()));58 52 } 59 53 -
trunk/WebCore/bindings/js/ScriptFunctionCall.h
r68074 r69688 45 45 namespace WebCore { 46 46 class ScriptValue; 47 class ScriptString;48 47 49 48 class ScriptCallArgumentHandler { … … 52 51 53 52 void appendArgument(const ScriptObject&); 54 void appendArgument(const ScriptString&);55 53 void appendArgument(const ScriptValue&); 56 54 void appendArgument(const String&); -
trunk/WebCore/dom/ScriptExecutionContext.h
r67614 r69688 58 58 class MessagePort; 59 59 class SecurityOrigin; 60 class ScriptString;61 60 #if ENABLE(INSPECTOR) 62 61 class InspectorController; -
trunk/WebCore/fileapi/FileReader.cpp
r67208 r69688 44 44 #include "ResourceError.h" 45 45 #include "ResourceRequest.h" 46 #include "ResourceResponse.h" 46 47 #include "ScriptExecutionContext.h" 47 48 #include "TextResourceDecoder.h" … … 58 59 , m_state(None) 59 60 , m_readType(ReadFileAsBinaryString) 60 , m_result("")61 61 , m_isRawDataConverted(false) 62 62 , m_bytesLoaded(0) … … 145 145 terminate(); 146 146 147 m_ result = "";147 m_builder.clear(); 148 148 m_error = FileError::create(ABORT_ERR); 149 149 … … 213 213 switch (m_readType) { 214 214 case ReadFileAsBinaryString: 215 m_ result += String(data, static_cast<unsigned>(lengthReceived));215 m_builder.append(data, static_cast<unsigned>(lengthReceived)); 216 216 break; 217 217 case ReadFileAsText: … … 297 297 } 298 298 299 const ScriptString&FileReader::result()299 String FileReader::result() 300 300 { 301 301 // If reading as binary string, we can return the result immediately. 302 302 if (m_readType == ReadFileAsBinaryString) 303 return m_ result;303 return m_builder.toString(); 304 304 305 305 // If we already convert the raw data received so far, we can return the result now. 306 306 if (m_isRawDataConverted) 307 return m_ result;307 return m_builder.toString(); 308 308 m_isRawDataConverted = true; 309 309 … … 312 312 // For data URL, we only do the coversion until we receive all the raw data. 313 313 else if (m_readType == ReadFileAsDataURL && m_state == Completed) 314 convertToDataURL(m_rawData, m_fileType, m_ result);315 316 return m_ result;314 convertToDataURL(m_rawData, m_fileType, m_builder); 315 316 return m_builder.toString(); 317 317 } 318 318 … … 320 320 { 321 321 if (!m_rawData.size()) { 322 m_ result = "";322 m_builder.clear(); 323 323 return; 324 324 } … … 331 331 if (!m_decoder) 332 332 m_decoder = TextResourceDecoder::create("text/plain", m_encoding.isValid() ? m_encoding : UTF8Encoding()); 333 m_result = m_decoder->decode(&m_rawData.at(0), m_rawData.size()); 333 m_builder.clear(); 334 m_builder.append(m_decoder->decode(&m_rawData.at(0), m_rawData.size())); 334 335 335 336 if (m_state == Completed && !m_error) 336 m_result += m_decoder->flush(); 337 } 338 339 void FileReader::convertToDataURL(const Vector<char>& rawData, const String& fileType, ScriptString& result) 340 { 341 result = "data:"; 337 m_builder.append(m_decoder->flush()); 338 } 339 340 void FileReader::convertToDataURL(const Vector<char>& rawData, const String& fileType, StringBuilder& builder) 341 { 342 builder.clear(); 343 builder.append("data:"); 342 344 343 345 if (!rawData.size()) 344 346 return; 345 347 346 result += fileType; 347 if (!fileType.isEmpty()) 348 result += ";"; 349 result += "base64,"; 348 if (!fileType.isEmpty()) { 349 builder.append(fileType); 350 builder.append(";base64,"); 351 } else 352 builder.append("base64,"); 350 353 351 354 Vector<char> out; 352 355 base64Encode(rawData, out); 353 356 out.append('\0'); 354 result += out.data();357 builder.append(out.data()); 355 358 } 356 359 -
trunk/WebCore/fileapi/FileReader.h
r67208 r69688 38 38 #include "FileError.h" 39 39 #include "KURL.h" 40 #include "PlatformString.h"41 #include "ScriptString.h"42 40 #include "TextEncoding.h" 43 41 #include "ThreadableLoaderClient.h" … … 46 44 #include <wtf/RefPtr.h> 47 45 #include <wtf/Vector.h> 46 #include <wtf/text/StringBuilder.h> 47 #include <wtf/text/WTFString.h> 48 48 49 49 namespace WebCore { … … 78 78 ReadyState readyState() const; 79 79 PassRefPtr<FileError> error() { return m_error; } 80 const ScriptString&result();80 String result(); 81 81 82 82 // Helper methods, also used by FileReaderSync. 83 83 static ExceptionCode httpStatusCodeToExceptionCode(int httpStatusCode); 84 static void convertToDataURL(const Vector<char>& rawData, const String& fileType, S criptString& result);84 static void convertToDataURL(const Vector<char>& rawData, const String& fileType, StringBuilder&); 85 85 86 86 // ActiveDOMObject … … 148 148 TextEncoding m_encoding; 149 149 150 // Like XMLHttpRequest.m_responseText, we keep this as a ScriptString, not a WTF::String. 151 // That's because these strings can easily get huge (they are filled from the file) and 152 // because JS can easily observe many intermediate states, so it's very useful to be 153 // able to share the buffer with JavaScript versions of the whole or partial string. 154 // In contrast, this string doesn't interact much with the rest of the engine so it's not that 155 // big a cost that it isn't a String. 156 ScriptString m_result; 150 StringBuilder m_builder; 157 151 158 152 // The raw data. We have to keep track of all the raw data for it to be converted to text or data URL data. -
trunk/WebCore/fileapi/FileReaderSync.cpp
r67208 r69688 40 40 #include "FileReader.h" 41 41 #include "ResourceRequest.h" 42 #include "ResourceResponse.h" 42 43 #include "ScriptExecutionContext.h" 43 44 #include "TextEncoding.h" … … 51 52 public: 52 53 // If the output result is provided, use it. Otherwise, save it as the raw data. 53 FileReaderSyncLoader(S criptString* result);54 FileReaderSyncLoader(StringBuilder*); 54 55 55 56 // Returns the http status code. … … 66 67 private: 67 68 // The output result. The caller provides this in order to load the binary data directly. 68 S criptString* m_result;69 StringBuilder* m_builder; 69 70 70 71 // The raw data. The caller does not provide the above output result and we need to save it here. … … 74 75 }; 75 76 76 FileReaderSyncLoader::FileReaderSyncLoader(S criptString* result)77 : m_ result(result)77 FileReaderSyncLoader::FileReaderSyncLoader(StringBuilder* builder) 78 : m_builder(builder) 78 79 , m_httpStatusCode(0) 79 80 { … … 101 102 void FileReaderSyncLoader::didReceiveData(const char* data, int lengthReceived) 102 103 { 103 if (m_ result)104 *m_result += String(data, static_cast<unsigned>(lengthReceived));104 if (m_builder) 105 m_builder->append(data, static_cast<unsigned>(lengthReceived)); 105 106 else 106 107 m_rawData.append(data, static_cast<unsigned>(lengthReceived)); … … 117 118 } 118 119 119 FileReaderSync::FileReaderSync() 120 : m_result("") 120 String FileReaderSync::readAsBinaryString(ScriptExecutionContext* scriptExecutionContext, Blob* blob, ExceptionCode& ec) 121 121 { 122 if (!blob) 123 return m_builder.toString(); 124 125 read(scriptExecutionContext, blob, ReadAsBinaryString, ec); 126 return m_builder.toString(); 122 127 } 123 128 124 const ScriptString& FileReaderSync::readAsBinaryString(ScriptExecutionContext* scriptExecutionContext, Blob* blob, ExceptionCode& ec)129 String FileReaderSync::readAsText(ScriptExecutionContext* scriptExecutionContext, Blob* blob, const String& encoding, ExceptionCode& ec) 125 130 { 126 131 if (!blob) 127 return m_result; 128 129 read(scriptExecutionContext, blob, ReadAsBinaryString, ec); 130 return m_result; 131 } 132 133 const ScriptString& FileReaderSync::readAsText(ScriptExecutionContext* scriptExecutionContext, Blob* blob, const String& encoding, ExceptionCode& ec) 134 { 135 if (!blob) 136 return m_result; 132 return m_builder.toString(); 137 133 138 134 m_encoding = encoding; 139 135 read(scriptExecutionContext, blob, ReadAsText, ec); 140 return m_ result;136 return m_builder.toString(); 141 137 } 142 138 143 const ScriptString&FileReaderSync::readAsDataURL(ScriptExecutionContext* scriptExecutionContext, Blob* blob, ExceptionCode& ec)139 String FileReaderSync::readAsDataURL(ScriptExecutionContext* scriptExecutionContext, Blob* blob, ExceptionCode& ec) 144 140 { 145 141 if (!blob) 146 return m_ result;142 return m_builder.toString(); 147 143 148 144 read(scriptExecutionContext, blob, ReadAsDataURL, ec); 149 return m_ result;145 return m_builder.toString(); 150 146 } 151 147 … … 159 155 request.setHTTPMethod("GET"); 160 156 161 FileReaderSyncLoader loader((readType == ReadAsBinaryString) ? &m_ result: 0);157 FileReaderSyncLoader loader((readType == ReadAsBinaryString) ? &m_builder : 0); 162 158 loader.start(scriptExecutionContext, request, ec); 163 159 ThreadableBlobRegistry::unregisterBlobURL(urlForReading); … … 170 166 return; 171 167 case ReadAsText: 172 convertToText(loader.rawData().data(), loader.rawData().size(), m_ result);168 convertToText(loader.rawData().data(), loader.rawData().size(), m_builder); 173 169 return; 174 170 case ReadAsDataURL: 175 FileReader::convertToDataURL(loader.rawData(), blob->type(), m_ result);171 FileReader::convertToDataURL(loader.rawData(), blob->type(), m_builder); 176 172 return; 177 173 } … … 180 176 } 181 177 182 void FileReaderSync::convertToText(const char* data, int size, S criptString& result)178 void FileReaderSync::convertToText(const char* data, int size, StringBuilder& builder) 183 179 { 184 180 if (!size) … … 191 187 // FIXME: consider supporting incremental decoding to improve the perf. 192 188 RefPtr<TextResourceDecoder> decoder = TextResourceDecoder::create("text/plain", m_encoding.isEmpty() ? UTF8Encoding() : TextEncoding(m_encoding)); 193 result = decoder->decode(data, size); 194 result += decoder->flush(); 189 builder.clear(); 190 builder.append(decoder->decode(data, size)); 191 builder.append(decoder->flush()); 195 192 } 196 193 -
trunk/WebCore/fileapi/FileReaderSync.h
r66461 r69688 35 35 36 36 #include "ExceptionCode.h" 37 #include "ScriptString.h"38 37 #include <wtf/PassRefPtr.h> 39 38 #include <wtf/RefCounted.h> 39 #include <wtf/text/StringBuilder.h> 40 40 41 41 namespace WebCore { … … 53 53 virtual ~FileReaderSync() { } 54 54 55 const ScriptString&readAsBinaryString(ScriptExecutionContext*, Blob*, ExceptionCode&);56 const ScriptString&readAsText(ScriptExecutionContext* scriptExecutionContext, Blob* blob, ExceptionCode& ec)55 String readAsBinaryString(ScriptExecutionContext*, Blob*, ExceptionCode&); 56 String readAsText(ScriptExecutionContext* scriptExecutionContext, Blob* blob, ExceptionCode& ec) 57 57 { 58 58 return readAsText(scriptExecutionContext, blob, "", ec); 59 59 } 60 const ScriptString&readAsText(ScriptExecutionContext*, Blob*, const String& encoding, ExceptionCode&);61 const ScriptString&readAsDataURL(ScriptExecutionContext*, Blob*, ExceptionCode&);60 String readAsText(ScriptExecutionContext*, Blob*, const String& encoding, ExceptionCode&); 61 String readAsDataURL(ScriptExecutionContext*, Blob*, ExceptionCode&); 62 62 63 63 private: … … 68 68 }; 69 69 70 FileReaderSync() ;71 70 FileReaderSync() { } 71 72 72 void read(ScriptExecutionContext*, Blob*, ReadType, ExceptionCode&); 73 void convertToText(const char* data, int size, S criptString& result);73 void convertToText(const char* data, int size, StringBuilder&); 74 74 75 // Like XMLHttpRequest.m_responseText, we keep this as a ScriptString, not a WTF::String. 76 // That's because these strings can easily get huge (they are filled from the file) and 77 // because JS can easily observe many intermediate states, so it's very useful to be 78 // able to share the buffer with JavaScript versions of the whole or partial string. 79 // In contrast, this string doesn't interact much with the rest of the engine so it's not that 80 // big a cost that it isn't a String. 81 ScriptString m_result; 75 StringBuilder m_builder; 82 76 83 77 String m_encoding; -
trunk/WebCore/inspector/InspectorController.cpp
r69567 r69688 87 87 #include "ScriptProfiler.h" 88 88 #include "ScriptSourceCode.h" 89 #include "ScriptString.h"90 89 #include "SecurityOrigin.h" 91 90 #include "Settings.h" … … 1133 1132 } 1134 1133 1135 void InspectorController::resourceRetrievedByXMLHttpRequest(unsigned long identifier, const S criptString& sourceString, const String& url, const String& sendURL, unsigned sendLineNumber)1134 void InspectorController::resourceRetrievedByXMLHttpRequest(unsigned long identifier, const String& sourceString, const String& url, const String& sendURL, unsigned sendLineNumber) 1136 1135 { 1137 1136 if (!enabled()) … … 1163 1162 return; 1164 1163 1165 resource->setOverrideContent( ScriptString(sourceString), InspectorResource::Script);1164 resource->setOverrideContent(sourceString, InspectorResource::Script); 1166 1165 1167 1166 if (m_frontend) -
trunk/WebCore/inspector/InspectorController.h
r69567 r69688 83 83 class ScriptCallStack; 84 84 class ScriptProfile; 85 class ScriptString;86 85 class SharedBuffer; 87 86 class Storage; … … 174 173 void didFinishLoading(unsigned long identifier, double finishTime); 175 174 void didFailLoading(unsigned long identifier, const ResourceError&); 176 void resourceRetrievedByXMLHttpRequest(unsigned long identifier, const S criptString& sourceString, const String& url, const String& sendURL, unsigned sendLineNumber);175 void resourceRetrievedByXMLHttpRequest(unsigned long identifier, const String& sourceString, const String& url, const String& sendURL, unsigned sendLineNumber); 177 176 void scriptImported(unsigned long identifier, const String& sourceString); 178 177 -
trunk/WebCore/inspector/InspectorResource.cpp
r69594 r69688 412 412 } 413 413 414 void InspectorResource::setOverrideContent(const S criptString& data, Type type)414 void InspectorResource::setOverrideContent(const String& data, Type type) 415 415 { 416 416 m_overrideContent = data; -
trunk/WebCore/inspector/InspectorResource.h
r69185 r69688 34 34 #include "HTTPHeaderMap.h" 35 35 #include "KURL.h" 36 #include "ScriptString.h"37 36 #include "WebSocketHandshakeRequest.h" 38 37 #include "WebSocketHandshakeResponse.h" … … 99 98 #endif 100 99 101 void setOverrideContent(const S criptString& data, Type);100 void setOverrideContent(const String& data, Type); 102 101 103 102 String sourceString() const; … … 195 194 bool m_connectionReused; 196 195 RefPtr<ResourceLoadTiming> m_loadTiming; 197 S criptString m_overrideContent;196 String m_overrideContent; 198 197 Type m_overrideContentType; 199 198 Changes m_changes; -
trunk/WebCore/loader/FrameLoader.cpp
r69432 r69688 91 91 #include "ScriptController.h" 92 92 #include "ScriptSourceCode.h" 93 #include "ScriptString.h"94 93 #include "SecurityOrigin.h" 95 94 #include "SegmentedString.h" -
trunk/WebCore/loader/FrameLoader.h
r69039 r69688 74 74 class ResourceResponse; 75 75 class ScriptSourceCode; 76 class ScriptString;77 76 class ScriptValue; 78 77 class SecurityOrigin; -
trunk/WebCore/loader/FrameLoaderClient.h
r68576 r69688 74 74 class ResourceRequest; 75 75 class ResourceResponse; 76 class ScriptString;77 76 class SecurityOrigin; 78 77 class SharedBuffer; -
trunk/WebCore/loader/ResourceLoadNotifier.h
r67553 r69688 41 41 class ResourceLoader; 42 42 class ResourceResponse; 43 class ScriptString;44 43 class ResourceRequest; 45 44 -
trunk/WebCore/workers/WorkerScriptLoader.h
r58647 r69688 34 34 #include "ResourceRequest.h" 35 35 #include "ResourceResponse.h" 36 #include "ScriptString.h"37 36 #include "TextResourceDecoder.h" 38 37 #include "ThreadableLoader.h" -
trunk/WebCore/xml/XMLHttpRequest.cpp
r69406 r69688 174 174 #endif 175 175 , m_state(UNSENT) 176 , m_responseText("")177 176 , m_createdDocument(false) 178 177 , m_error(false) … … 227 226 } 228 227 229 const ScriptString& XMLHttpRequest::responseText(ExceptionCode& ec) const 228 String XMLHttpRequest::responseText(ExceptionCode& ec) 230 229 { 231 230 #if ENABLE(XHR_RESPONSE_BLOB) … … 235 234 UNUSED_PARAM(ec); 236 235 #endif 237 return m_response Text;238 } 239 240 Document* XMLHttpRequest::responseXML(ExceptionCode& ec) const236 return m_responseBuilder.toStringPreserveCapacity(); 237 } 238 239 Document* XMLHttpRequest::responseXML(ExceptionCode& ec) 241 240 { 242 241 #if ENABLE(XHR_RESPONSE_BLOB) … … 260 259 m_responseXML->open(); 261 260 // FIXME: Set Last-Modified. 262 m_responseXML->write( String(m_responseText));261 m_responseXML->write(m_responseBuilder.toStringPreserveCapacity()); 263 262 m_responseXML->finishParsing(); 264 263 m_responseXML->close(); … … 628 627 internalAbort(); 629 628 630 m_response Text = "";629 m_responseBuilder.clear(); 631 630 m_createdDocument = false; 632 631 m_responseXML = 0; … … 677 676 { 678 677 m_response = ResourceResponse(); 679 m_response Text = "";678 m_responseBuilder.clear(); 680 679 m_createdDocument = false; 681 680 m_responseXML = 0; … … 734 733 JSC::JSGlobalData* globalData = scriptExecutionContext()->globalData(); 735 734 if (hasCachedDOMObjectWrapper(globalData, this)) 736 globalData->heap.reportExtraMemoryCost(m_response Text.size() * 2);735 globalData->heap.reportExtraMemoryCost(m_responseBuilder.length() * 2); 737 736 #endif 738 737 … … 943 942 944 943 if (m_decoder) 945 m_responseText += m_decoder->flush(); 944 m_responseBuilder.append(m_decoder->flush()); 945 946 m_responseBuilder.shrinkToFit(); 946 947 947 948 #if ENABLE(XHR_RESPONSE_BLOB) … … 951 952 #if ENABLE(INSPECTOR) 952 953 if (InspectorController* inspector = scriptExecutionContext()->inspectorController()) 953 inspector->resourceRetrievedByXMLHttpRequest(identifier, m_response Text, m_url, m_lastSendURL, m_lastSendLineNumber);954 inspector->resourceRetrievedByXMLHttpRequest(identifier, m_responseBuilder.toStringPreserveCapacity(), m_url, m_lastSendURL, m_lastSendLineNumber); 954 955 #endif 955 956 … … 1020 1021 len = strlen(data); 1021 1022 1022 m_response Text += m_decoder->decode(data, len);1023 m_responseBuilder.append(m_decoder->decode(data, len)); 1023 1024 1024 1025 if (!m_error) { -
trunk/WebCore/xml/XMLHttpRequest.h
r68049 r69688 27 27 #include "FormData.h" 28 28 #include "ResourceResponse.h" 29 #include "ScriptString.h"30 29 #include "ThreadableLoaderClient.h" 31 30 #include "XMLHttpRequestProgressEventThrottle.h" 32 31 #include <wtf/OwnPtr.h> 33 32 #include <wtf/text/AtomicStringHash.h> 33 #include <wtf/text/StringBuilder.h> 34 34 35 35 namespace WebCore { … … 90 90 String getAllResponseHeaders(ExceptionCode&) const; 91 91 String getResponseHeader(const AtomicString& name, ExceptionCode&) const; 92 const ScriptString& responseText(ExceptionCode&) const;93 Document* responseXML(ExceptionCode&) const;92 String responseText(ExceptionCode&); 93 Document* responseXML(ExceptionCode&); 94 94 #if ENABLE(XHR_RESPONSE_BLOB) 95 95 Blob* responseBlob(ExceptionCode&) const; … … 177 177 RefPtr<TextResourceDecoder> m_decoder; 178 178 179 // Unlike most strings in the DOM, we keep this as a ScriptString, not a WTF::String. 180 // That's because these strings can easily get huge (they are filled from the network with 181 // no parsing) and because JS can easily observe many intermediate states, so it's very useful 182 // to be able to share the buffer with JavaScript versions of the whole or partial string. 183 // In contrast, this string doesn't interact much with the rest of the engine so it's not that 184 // big a cost that it isn't a String. 185 ScriptString m_responseText; 179 StringBuilder m_responseBuilder; 186 180 mutable bool m_createdDocument; 187 181 mutable RefPtr<Document> m_responseXML; -
trunk/WebKit/efl/ChangeLog
r69650 r69688 1 2010-10-13 Gavin Barraclough <barraclough@apple.com> 2 3 Reviewed by Oliver Hunt. 4 5 https://bugs.webkit.org/show_bug.cgi?id=43987 6 Switch XMLHttpRequest, FileReader, and FileReaderSync to use a Stringbuilder 7 to construct their internal result string. Remove ScriptString (this is now 8 redundant). 9 10 * WebCoreSupport/FrameLoaderClientEfl.cpp: 11 (WebCore::FrameLoaderClientEfl::dispatchDidLoadResourceByXMLHttpRequest): 12 * WebCoreSupport/FrameLoaderClientEfl.h: 13 1 14 2010-10-13 Gyuyoung Kim <gyuyoung.kim@samsung.com> 2 15 -
trunk/WebKit/efl/WebCoreSupport/FrameLoaderClientEfl.cpp
r69650 r69688 760 760 } 761 761 762 void FrameLoaderClientEfl::dispatchDidLoadResourceByXMLHttpRequest(unsigned long, const S criptString&)762 void FrameLoaderClientEfl::dispatchDidLoadResourceByXMLHttpRequest(unsigned long, const String&) 763 763 { 764 764 notImplemented(); -
trunk/WebKit/efl/WebCoreSupport/FrameLoaderClientEfl.h
r69061 r69688 92 92 virtual void dispatchDidFailLoading(DocumentLoader*, unsigned long identifier, const ResourceError&); 93 93 virtual bool dispatchDidLoadResourceFromMemoryCache(DocumentLoader*, const ResourceRequest&, const ResourceResponse&, int length); 94 virtual void dispatchDidLoadResourceByXMLHttpRequest(unsigned long identifier, const WebCore::S criptString& sourceString);94 virtual void dispatchDidLoadResourceByXMLHttpRequest(unsigned long identifier, const WebCore::String& sourceString); 95 95 96 96 virtual void dispatchDidHandleOnloadEvents(); -
trunk/WebKit/mac/ChangeLog
r69623 r69688 1 2010-10-13 Gavin Barraclough <barraclough@apple.com> 2 3 Reviewed by Oliver Hunt. 4 5 https://bugs.webkit.org/show_bug.cgi?id=43987 6 Switch XMLHttpRequest, FileReader, and FileReaderSync to use a Stringbuilder 7 to construct their internal result string. Remove ScriptString (this is now 8 redundant). 9 10 * WebCoreSupport/WebFrameLoaderClient.mm: 11 1 12 2010-10-12 Andy Estes <aestes@apple.com> 2 13 -
trunk/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm
r68854 r69688 112 112 #import <WebCore/ResourceRequest.h> 113 113 #import <WebCore/ScriptController.h> 114 #import <WebCore/ScriptString.h>115 114 #import <WebCore/SharedBuffer.h> 116 115 #import <WebCore/WebCoreObjCExtras.h> -
trunk/WebKit/qt/ChangeLog
r69648 r69688 1 2010-10-13 Gavin Barraclough <barraclough@apple.com> 2 3 Reviewed by Oliver Hunt. 4 5 https://bugs.webkit.org/show_bug.cgi?id=43987 6 Switch XMLHttpRequest, FileReader, and FileReaderSync to use a Stringbuilder 7 to construct their internal result string. Remove ScriptString (this is now 8 redundant). 9 10 * WebCoreSupport/FrameLoaderClientQt.cpp: 11 1 12 2010-10-13 Dinu Jacob <dinu.jacob@nokia.com> 2 13 -
trunk/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp
r69396 r69688 65 65 #include "ResourceHandle.h" 66 66 #include "ScriptController.h" 67 #include "ScriptString.h"68 67 #include "Settings.h" 69 68 #include "QWebPageClient.h" -
trunk/WebKit/win/ChangeLog
r69656 r69688 1 2010-10-13 Gavin Barraclough <barraclough@apple.com> 2 3 Reviewed by Oliver Hunt. 4 5 https://bugs.webkit.org/show_bug.cgi?id=43987 6 Switch XMLHttpRequest, FileReader, and FileReaderSync to use a Stringbuilder 7 to construct their internal result string. Remove ScriptString (this is now 8 redundant). 9 10 * WebCoreSupport/WebFrameLoaderClient.cpp: 11 1 12 2010-10-12 Adam Roben <aroben@apple.com> 2 13 -
trunk/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp
r68854 r69688 68 68 #include <WebCore/RenderPart.h> 69 69 #include <WebCore/ResourceHandle.h> 70 #include <WebCore/ScriptString.h>71 70 #pragma warning(pop) 72 71 -
trunk/WebKit/wx/ChangeLog
r68576 r69688 1 2010-10-13 Gavin Barraclough <barraclough@apple.com> 2 3 Reviewed by Oliver Hunt. 4 5 https://bugs.webkit.org/show_bug.cgi?id=43987 6 Switch XMLHttpRequest, FileReader, and FileReaderSync to use a Stringbuilder 7 to construct their internal result string. Remove ScriptString (this is now 8 redundant). 9 10 * WebKitSupport/FrameLoaderClientWx.cpp: 11 1 12 2010-09-28 Jenn Braithwaite <jennb@chromium.org> 2 13 -
trunk/WebKit/wx/WebKitSupport/FrameLoaderClientWx.cpp
r68576 r69688 50 50 #include "ResourceResponse.h" 51 51 #include "ScriptController.h" 52 #include "ScriptString.h"53 52 #include <wtf/PassRefPtr.h> 54 53 #include <wtf/RefPtr.h> -
trunk/WebKit2/ChangeLog
r69687 r69688 1 2010-10-13 Gavin Barraclough <barraclough@apple.com> 2 3 Reviewed by Oliver Hunt. 4 5 https://bugs.webkit.org/show_bug.cgi?id=43987 6 Switch XMLHttpRequest, FileReader, and FileReaderSync to use a Stringbuilder 7 to construct their internal result string. Remove ScriptString (this is now 8 redundant). 9 10 * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: 11 (WebKit::WebFrameLoaderClient::dispatchDidLoadResourceByXMLHttpRequest): 12 * WebProcess/WebCoreSupport/WebFrameLoaderClient.h: 13 1 14 2010-10-13 Anders Carlsson <andersca@apple.com> 2 15 -
trunk/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
r69329 r69688 197 197 } 198 198 199 void WebFrameLoaderClient::dispatchDidLoadResourceByXMLHttpRequest(unsigned long identifier, const S criptString&)199 void WebFrameLoaderClient::dispatchDidLoadResourceByXMLHttpRequest(unsigned long identifier, const String&) 200 200 { 201 201 notImplemented(); -
trunk/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h
r68576 r69688 70 70 virtual void dispatchDidFailLoading(WebCore::DocumentLoader*, unsigned long identifier, const WebCore::ResourceError&); 71 71 virtual bool dispatchDidLoadResourceFromMemoryCache(WebCore::DocumentLoader*, const WebCore::ResourceRequest&, const WebCore::ResourceResponse&, int length); 72 virtual void dispatchDidLoadResourceByXMLHttpRequest(unsigned long identifier, const W ebCore::ScriptString&);72 virtual void dispatchDidLoadResourceByXMLHttpRequest(unsigned long identifier, const WTF::String&); 73 73 74 74 virtual void dispatchDidHandleOnloadEvents();
Note: See TracChangeset
for help on using the changeset viewer.