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/bindings/v8/V8NPUtils.cpp

Issue 23578025: Remove useless calls to v8::Value::ToString() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 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
« no previous file with comments | « Source/bindings/v8/ScriptDebugServer.cpp ('k') | Source/bindings/v8/custom/V8WindowCustom.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008, 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2008, 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 54
55 if (object->IsNumber()) 55 if (object->IsNumber())
56 DOUBLE_TO_NPVARIANT(object->NumberValue(), *result); 56 DOUBLE_TO_NPVARIANT(object->NumberValue(), *result);
57 else if (object->IsBoolean()) 57 else if (object->IsBoolean())
58 BOOLEAN_TO_NPVARIANT(object->BooleanValue(), *result); 58 BOOLEAN_TO_NPVARIANT(object->BooleanValue(), *result);
59 else if (object->IsNull()) 59 else if (object->IsNull())
60 NULL_TO_NPVARIANT(*result); 60 NULL_TO_NPVARIANT(*result);
61 else if (object->IsUndefined()) 61 else if (object->IsUndefined())
62 VOID_TO_NPVARIANT(*result); 62 VOID_TO_NPVARIANT(*result);
63 else if (object->IsString()) { 63 else if (object->IsString()) {
64 v8::Handle<v8::String> str = object->ToString(); 64 v8::Handle<v8::String> str = object.As<v8::String>();
65 int length = str->Utf8Length() + 1; 65 int length = str->Utf8Length() + 1;
66 char* utf8Chars = reinterpret_cast<char*>(malloc(length)); 66 char* utf8Chars = reinterpret_cast<char*>(malloc(length));
67 str->WriteUtf8(utf8Chars, length, 0, v8::String::HINT_MANY_WRITES_EXPECT ED); 67 str->WriteUtf8(utf8Chars, length, 0, v8::String::HINT_MANY_WRITES_EXPECT ED);
68 STRINGN_TO_NPVARIANT(utf8Chars, length-1, *result); 68 STRINGN_TO_NPVARIANT(utf8Chars, length-1, *result);
69 } else if (object->IsObject()) { 69 } else if (object->IsObject()) {
70 DOMWindow* window = toDOMWindow(v8::Context::GetCurrent()); 70 DOMWindow* window = toDOMWindow(v8::Context::GetCurrent());
71 NPObject* npobject = npCreateV8ScriptObject(0, v8::Handle<v8::Object>::C ast(object), window); 71 NPObject* npobject = npCreateV8ScriptObject(0, v8::Handle<v8::Object>::C ast(object), window);
72 if (npobject) 72 if (npobject)
73 _NPN_RegisterObject(npobject, owner); 73 _NPN_RegisterObject(npobject, owner);
74 OBJECT_TO_NPVARIANT(npobject, *result); 74 OBJECT_TO_NPVARIANT(npobject, *result);
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 ExceptionCatcher::~ExceptionCatcher() 160 ExceptionCatcher::~ExceptionCatcher()
161 { 161 {
162 if (!m_tryCatch.HasCaught()) 162 if (!m_tryCatch.HasCaught())
163 return; 163 return;
164 164
165 if (topHandler) 165 if (topHandler)
166 topHandler->handler(topHandler->data, *v8::String::Utf8Value(m_tryCatch. Exception())); 166 topHandler->handler(topHandler->data, *v8::String::Utf8Value(m_tryCatch. Exception()));
167 } 167 }
168 168
169 } // namespace WebCore 169 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/v8/ScriptDebugServer.cpp ('k') | Source/bindings/v8/custom/V8WindowCustom.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698