Title: [111475] branches/chromium/1025/Source/WebCore/bindings/v8/V8NPUtils.cpp
- Revision
- 111475
- Author
- [email protected]
- Date
- 2012-03-20 17:32:11 -0700 (Tue, 20 Mar 2012)
Log Message
Revert 105389 - [v8] Low efficiency of writing long string from web application to plugin.
https://bugs.webkit.org/show_bug.cgi?id=76592
The efficiency will be improved by 300 times in the best case, when the
size of string reaches 1MB.
Patch by Li Yin <[email protected]> on 2012-01-18
Reviewed by Adam Barth.
* bindings/v8/V8NPUtils.cpp:
(WebCore::convertV8ObjectToNPVariant):
[email protected]
Review URL: https://chromiumcodereview.appspot.com/9766013
Modified Paths
Diff
Modified: branches/chromium/1025/Source/WebCore/bindings/v8/V8NPUtils.cpp (111474 => 111475)
--- branches/chromium/1025/Source/WebCore/bindings/v8/V8NPUtils.cpp 2012-03-21 00:30:35 UTC (rev 111474)
+++ branches/chromium/1025/Source/WebCore/bindings/v8/V8NPUtils.cpp 2012-03-21 00:32:11 UTC (rev 111475)
@@ -62,11 +62,11 @@
else if (object->IsUndefined())
VOID_TO_NPVARIANT(*result);
else if (object->IsString()) {
- v8::Handle<v8::String> str = object->ToString();
- int length = str->Utf8Length() + 1;
+ v8::String::Utf8Value utf8(object);
+ int length = utf8.length() + 1;
char* utf8Chars = reinterpret_cast<char*>(malloc(length));
- str->WriteUtf8(utf8Chars, length, 0, v8::String::HINT_MANY_WRITES_EXPECTED);
- STRINGN_TO_NPVARIANT(utf8Chars, length-1, *result);
+ memcpy(utf8Chars, *utf8, length);
+ STRINGN_TO_NPVARIANT(utf8Chars, utf8.length(), *result);
} else if (object->IsObject()) {
DOMWindow* window = V8Proxy::retrieveWindow(V8Proxy::currentContext());
NPObject* npobject = npCreateV8ScriptObject(0, v8::Handle<v8::Object>::Cast(object), window);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes