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

Side by Side Diff: Source/bindings/core/v8/V8NPUtils.cpp

Issue 1027593003: bindings: Use Maybe version of v8::String::NewFromUtf8() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 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 unified diff | Download patch | Annotate | Revision Log
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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 case NPVariantType_Double: 87 case NPVariantType_Double:
88 return v8::Number::New(isolate, NPVARIANT_TO_DOUBLE(*variant)); 88 return v8::Number::New(isolate, NPVARIANT_TO_DOUBLE(*variant));
89 case NPVariantType_Bool: 89 case NPVariantType_Bool:
90 return v8Boolean(NPVARIANT_TO_BOOLEAN(*variant), isolate); 90 return v8Boolean(NPVARIANT_TO_BOOLEAN(*variant), isolate);
91 case NPVariantType_Null: 91 case NPVariantType_Null:
92 return v8::Null(isolate); 92 return v8::Null(isolate);
93 case NPVariantType_Void: 93 case NPVariantType_Void:
94 return v8::Undefined(isolate); 94 return v8::Undefined(isolate);
95 case NPVariantType_String: { 95 case NPVariantType_String: {
96 NPString src = NPVARIANT_TO_STRING(*variant); 96 NPString src = NPVARIANT_TO_STRING(*variant);
97 return v8::String::NewFromUtf8(isolate, src.UTF8Characters, v8::String:: kNormalString, src.UTF8Length); 97 return v8AtomicString(isolate, src.UTF8Characters, src.UTF8Length);
98 } 98 }
99 case NPVariantType_Object: { 99 case NPVariantType_Object: {
100 NPObject* object = NPVARIANT_TO_OBJECT(*variant); 100 NPObject* object = NPVARIANT_TO_OBJECT(*variant);
101 if (V8NPObject* v8Object = npObjectToV8NPObject(object)) 101 if (V8NPObject* v8Object = npObjectToV8NPObject(object))
102 return v8::Local<v8::Object>::New(isolate, v8Object->v8Object); 102 return v8::Local<v8::Object>::New(isolate, v8Object->v8Object);
103 return createV8ObjectForNPObject(isolate, object, owner); 103 return createV8ObjectForNPObject(isolate, object, owner);
104 } 104 }
105 default: 105 default:
106 return v8::Undefined(isolate); 106 return v8::Undefined(isolate);
107 } 107 }
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 ExceptionCatcher::~ExceptionCatcher() 162 ExceptionCatcher::~ExceptionCatcher()
163 { 163 {
164 if (!m_tryCatch.HasCaught()) 164 if (!m_tryCatch.HasCaught())
165 return; 165 return;
166 166
167 if (topHandler) 167 if (topHandler)
168 topHandler->handler(topHandler->data, *v8::String::Utf8Value(m_tryCatch. Exception())); 168 topHandler->handler(topHandler->data, *v8::String::Utf8Value(m_tryCatch. Exception()));
169 } 169 }
170 170
171 } // namespace blink 171 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698