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

Unified Diff: Source/WebCore/bindings/v8/V8NPUtils.cpp

Issue 9766013: Revert 105389 - [v8] Low efficiency of writing long string from web application to plugin. (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1025/
Patch Set: Created 8 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebCore/bindings/v8/V8NPUtils.cpp
===================================================================
--- Source/WebCore/bindings/v8/V8NPUtils.cpp (revision 111474)
+++ Source/WebCore/bindings/v8/V8NPUtils.cpp (working copy)
@@ -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);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698