OLD | NEW |
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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 info.GetReturnValue().SetEmptyString(); | 163 info.GetReturnValue().SetEmptyString(); |
164 } | 164 } |
165 | 165 |
166 template<typename CallbackInfo> | 166 template<typename CallbackInfo> |
167 inline void v8SetReturnValueString(const CallbackInfo& info, const String& strin
g, v8::Isolate* isolate) | 167 inline void v8SetReturnValueString(const CallbackInfo& info, const String& strin
g, v8::Isolate* isolate) |
168 { | 168 { |
169 if (string.isNull()) { | 169 if (string.isNull()) { |
170 v8SetReturnValueEmptyString(info); | 170 v8SetReturnValueEmptyString(info); |
171 return; | 171 return; |
172 } | 172 } |
173 V8PerIsolateData::from(isolate)->stringCache()->setReturnValueFromString(inf
o.GetReturnValue(), string.impl()); | 173 V8PerIsolateData::from(isolate)->getStringCache()->setReturnValueFromString(
info.GetReturnValue(), string.impl()); |
174 } | 174 } |
175 | 175 |
176 template<typename CallbackInfo> | 176 template<typename CallbackInfo> |
177 inline void v8SetReturnValueStringOrNull(const CallbackInfo& info, const String&
string, v8::Isolate* isolate) | 177 inline void v8SetReturnValueStringOrNull(const CallbackInfo& info, const String&
string, v8::Isolate* isolate) |
178 { | 178 { |
179 if (string.isNull()) { | 179 if (string.isNull()) { |
180 v8SetReturnValueNull(info); | 180 v8SetReturnValueNull(info); |
181 return; | 181 return; |
182 } | 182 } |
183 V8PerIsolateData::from(isolate)->stringCache()->setReturnValueFromString(inf
o.GetReturnValue(), string.impl()); | 183 V8PerIsolateData::from(isolate)->getStringCache()->setReturnValueFromString(
info.GetReturnValue(), string.impl()); |
184 } | 184 } |
185 | 185 |
186 template<typename CallbackInfo> | 186 template<typename CallbackInfo> |
187 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, ScriptWrappable*
impl, v8::Local<v8::Object> creationContext) | 187 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, ScriptWrappable*
impl, v8::Local<v8::Object> creationContext) |
188 { | 188 { |
189 if (UNLIKELY(!impl)) { | 189 if (UNLIKELY(!impl)) { |
190 v8SetReturnValueNull(callbackInfo); | 190 v8SetReturnValueNull(callbackInfo); |
191 return; | 191 return; |
192 } | 192 } |
193 if (DOMDataStore::setReturnValue(callbackInfo.GetReturnValue(), impl)) | 193 if (DOMDataStore::setReturnValue(callbackInfo.GetReturnValue(), impl)) |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 } | 413 } |
414 | 414 |
415 // Convert a string to a V8 string. | 415 // Convert a string to a V8 string. |
416 // Return a V8 external string that shares the underlying buffer with the given | 416 // Return a V8 external string that shares the underlying buffer with the given |
417 // WebCore string. The reference counting mechanism is used to keep the | 417 // WebCore string. The reference counting mechanism is used to keep the |
418 // underlying buffer alive while the string is still live in the V8 engine. | 418 // underlying buffer alive while the string is still live in the V8 engine. |
419 inline v8::Local<v8::String> v8String(v8::Isolate* isolate, const String& string
) | 419 inline v8::Local<v8::String> v8String(v8::Isolate* isolate, const String& string
) |
420 { | 420 { |
421 if (string.isNull()) | 421 if (string.isNull()) |
422 return v8::String::Empty(isolate); | 422 return v8::String::Empty(isolate); |
423 return V8PerIsolateData::from(isolate)->stringCache()->v8ExternalString(isol
ate, string.impl()); | 423 return V8PerIsolateData::from(isolate)->getStringCache()->v8ExternalString(i
solate, string.impl()); |
424 } | 424 } |
425 | 425 |
426 inline v8::Local<v8::String> v8String(v8::Isolate* isolate, const CompressibleSt
ring& string) | 426 inline v8::Local<v8::String> v8String(v8::Isolate* isolate, const CompressibleSt
ring& string) |
427 { | 427 { |
428 if (string.isNull()) | 428 if (string.isNull()) |
429 return v8::String::Empty(isolate); | 429 return v8::String::Empty(isolate); |
430 return V8PerIsolateData::from(isolate)->stringCache()->v8ExternalString(isol
ate, string); | 430 return V8PerIsolateData::from(isolate)->getStringCache()->v8ExternalString(i
solate, string); |
431 } | 431 } |
432 | 432 |
433 inline v8::Local<v8::String> v8AtomicString(v8::Isolate* isolate, const char* st
r, int length = -1) | 433 inline v8::Local<v8::String> v8AtomicString(v8::Isolate* isolate, const char* st
r, int length = -1) |
434 { | 434 { |
435 ASSERT(isolate); | 435 ASSERT(isolate); |
436 v8::Local<v8::String> value; | 436 v8::Local<v8::String> value; |
437 if (LIKELY(v8::String::NewFromUtf8(isolate, str, v8::NewStringType::kInterna
lized, length).ToLocal(&value))) | 437 if (LIKELY(v8::String::NewFromUtf8(isolate, str, v8::NewStringType::kInterna
lized, length).ToLocal(&value))) |
438 return value; | 438 return value; |
439 // Immediately crashes when NewFromUtf8() fails because it only fails the | 439 // Immediately crashes when NewFromUtf8() fails because it only fails the |
440 // given str is too long. | 440 // given str is too long. |
(...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1071 PassOwnPtr<TracedValue> devToolsTraceEventData(v8::Isolate*, ExecutionContext*,
v8::Local<v8::Function>); | 1071 PassOwnPtr<TracedValue> devToolsTraceEventData(v8::Isolate*, ExecutionContext*,
v8::Local<v8::Function>); |
1072 | 1072 |
1073 // Callback functions used by generated code. | 1073 // Callback functions used by generated code. |
1074 CORE_EXPORT void v8ConstructorAttributeGetter(v8::Local<v8::Name> propertyName,
const v8::PropertyCallbackInfo<v8::Value>&); | 1074 CORE_EXPORT void v8ConstructorAttributeGetter(v8::Local<v8::Name> propertyName,
const v8::PropertyCallbackInfo<v8::Value>&); |
1075 | 1075 |
1076 typedef void (*InstallTemplateFunction)(v8::Local<v8::FunctionTemplate>, v8::Iso
late*); | 1076 typedef void (*InstallTemplateFunction)(v8::Local<v8::FunctionTemplate>, v8::Iso
late*); |
1077 | 1077 |
1078 } // namespace blink | 1078 } // namespace blink |
1079 | 1079 |
1080 #endif // V8Binding_h | 1080 #endif // V8Binding_h |
OLD | NEW |