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

Side by Side Diff: Source/bindings/core/v8/V8Binding.h

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) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * Copyright (C) 2012 Ericsson AB. All rights reserved. 3 * Copyright (C) 2012 Ericsson AB. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 // Return a V8 external string that shares the underlying buffer with the given 340 // Return a V8 external string that shares the underlying buffer with the given
341 // WebCore string. The reference counting mechanism is used to keep the 341 // WebCore string. The reference counting mechanism is used to keep the
342 // underlying buffer alive while the string is still live in the V8 engine. 342 // underlying buffer alive while the string is still live in the V8 engine.
343 inline v8::Handle<v8::String> v8String(v8::Isolate* isolate, const String& strin g) 343 inline v8::Handle<v8::String> v8String(v8::Isolate* isolate, const String& strin g)
344 { 344 {
345 if (string.isNull()) 345 if (string.isNull())
346 return v8::String::Empty(isolate); 346 return v8::String::Empty(isolate);
347 return V8PerIsolateData::from(isolate)->stringCache()->v8ExternalString(stri ng.impl(), isolate); 347 return V8PerIsolateData::from(isolate)->stringCache()->v8ExternalString(stri ng.impl(), isolate);
348 } 348 }
349 349
350 inline v8::Handle<v8::String> v8AtomicString(v8::Isolate* isolate, const char* s tr) 350 inline v8::Handle<v8::String> v8AtomicString(v8::Isolate* isolate, const char* s tr, int length = -1)
351 { 351 {
352 ASSERT(isolate); 352 ASSERT(isolate);
353 return v8::String::NewFromUtf8(isolate, str, v8::String::kInternalizedString , strlen(str)); 353 v8::Local<v8::String> value;
354 } 354 if (LIKELY(v8::String::NewFromUtf8(isolate, str, v8::NewStringType::kInterna lized, length).ToLocal(&value)))
355 355 return value;
356 inline v8::Handle<v8::String> v8AtomicString(v8::Isolate* isolate, const char* s tr, size_t length) 356 return v8::String::Empty(isolate);
pfeldman 2015/03/25 05:43:37 At this point we know that there is a bug in the c
bashi 2015/03/25 05:50:09 OK, How about having RELEASE_ASSERT() here then?
yurys 2015/03/25 07:07:22 Having RELEASE_ASSERT_NOT_REACHED() here would be
357 {
358 ASSERT(isolate);
359 return v8::String::NewFromUtf8(isolate, str, v8::String::kInternalizedString , length);
360 } 357 }
361 358
362 inline v8::Handle<v8::Value> v8Undefined() 359 inline v8::Handle<v8::Value> v8Undefined()
363 { 360 {
364 return v8::Handle<v8::Value>(); 361 return v8::Handle<v8::Value>();
365 } 362 }
366 363
367 // Conversion flags, used in toIntXX/toUIntXX. 364 // Conversion flags, used in toIntXX/toUIntXX.
368 enum IntegerConversionConfiguration { 365 enum IntegerConversionConfiguration {
369 NormalConversion, 366 NormalConversion,
(...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after
967 PassRefPtr<TraceEvent::ConvertableToTraceFormat> devToolsTraceEventData(v8::Isol ate*, ExecutionContext*, v8::Handle<v8::Function>); 964 PassRefPtr<TraceEvent::ConvertableToTraceFormat> devToolsTraceEventData(v8::Isol ate*, ExecutionContext*, v8::Handle<v8::Function>);
968 965
969 // Callback functions used by generated code. 966 // Callback functions used by generated code.
970 CORE_EXPORT void v8ConstructorAttributeGetter(v8::Local<v8::Name> propertyName, const v8::PropertyCallbackInfo<v8::Value>&); 967 CORE_EXPORT void v8ConstructorAttributeGetter(v8::Local<v8::Name> propertyName, const v8::PropertyCallbackInfo<v8::Value>&);
971 968
972 typedef void (*InstallTemplateFunction)(v8::Local<v8::FunctionTemplate>, v8::Iso late*); 969 typedef void (*InstallTemplateFunction)(v8::Local<v8::FunctionTemplate>, v8::Iso late*);
973 970
974 } // namespace blink 971 } // namespace blink
975 972
976 #endif // V8Binding_h 973 #endif // V8Binding_h
OLDNEW
« no previous file with comments | « Source/bindings/core/v8/ScriptValueSerializer.cpp ('k') | Source/bindings/core/v8/V8DOMConfiguration.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698