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 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 // Return a V8 external string that shares the underlying buffer with the given | 400 // Return a V8 external string that shares the underlying buffer with the given |
401 // WebCore string. The reference counting mechanism is used to keep the | 401 // WebCore string. The reference counting mechanism is used to keep the |
402 // underlying buffer alive while the string is still live in the V8 engine. | 402 // underlying buffer alive while the string is still live in the V8 engine. |
403 inline v8::Local<v8::String> v8String(v8::Isolate* isolate, const String& string
) | 403 inline v8::Local<v8::String> v8String(v8::Isolate* isolate, const String& string
) |
404 { | 404 { |
405 if (string.isNull()) | 405 if (string.isNull()) |
406 return v8::String::Empty(isolate); | 406 return v8::String::Empty(isolate); |
407 return V8PerIsolateData::from(isolate)->getStringCache()->v8ExternalString(i
solate, string.impl()); | 407 return V8PerIsolateData::from(isolate)->getStringCache()->v8ExternalString(i
solate, string.impl()); |
408 } | 408 } |
409 | 409 |
| 410 inline v8::Local<v8::Value> v8StringOrNull(v8::Isolate* isolate, const AtomicStr
ing& string) |
| 411 { |
| 412 if (string.isNull()) |
| 413 return v8::Null(isolate); |
| 414 return V8PerIsolateData::from(isolate)->getStringCache()->v8ExternalString(i
solate, string.impl()); |
| 415 } |
| 416 |
410 inline v8::Local<v8::String> v8String(v8::Isolate* isolate, const CompressibleSt
ring& string) | 417 inline v8::Local<v8::String> v8String(v8::Isolate* isolate, const CompressibleSt
ring& string) |
411 { | 418 { |
412 if (string.isNull()) | 419 if (string.isNull()) |
413 return v8::String::Empty(isolate); | 420 return v8::String::Empty(isolate); |
414 return V8PerIsolateData::from(isolate)->getStringCache()->v8ExternalString(i
solate, string); | 421 return V8PerIsolateData::from(isolate)->getStringCache()->v8ExternalString(i
solate, string); |
415 } | 422 } |
416 | 423 |
417 inline v8::Local<v8::String> v8AtomicString(v8::Isolate* isolate, const char* st
r, int length = -1) | 424 inline v8::Local<v8::String> v8AtomicString(v8::Isolate* isolate, const char* st
r, int length = -1) |
418 { | 425 { |
419 ASSERT(isolate); | 426 ASSERT(isolate); |
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
963 typedef void (*InstallTemplateFunction)(v8::Isolate*, const DOMWrapperWorld&, v8
::Local<v8::FunctionTemplate> interfaceTemplate); | 970 typedef void (*InstallTemplateFunction)(v8::Isolate*, const DOMWrapperWorld&, v8
::Local<v8::FunctionTemplate> interfaceTemplate); |
964 | 971 |
965 // Freeze a V8 object. The type of the first parameter and the return value is | 972 // Freeze a V8 object. The type of the first parameter and the return value is |
966 // intentionally v8::Value so that this function can wrap toV8(). | 973 // intentionally v8::Value so that this function can wrap toV8(). |
967 // If the argument isn't an object, this will crash. | 974 // If the argument isn't an object, this will crash. |
968 CORE_EXPORT v8::Local<v8::Value> freezeV8Object(v8::Local<v8::Value>, v8::Isolat
e*); | 975 CORE_EXPORT v8::Local<v8::Value> freezeV8Object(v8::Local<v8::Value>, v8::Isolat
e*); |
969 | 976 |
970 } // namespace blink | 977 } // namespace blink |
971 | 978 |
972 #endif // V8Binding_h | 979 #endif // V8Binding_h |
OLD | NEW |