| 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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 | 216 |
| 217 // FIXME: See the above comment. | 217 // FIXME: See the above comment. |
| 218 inline String toWebCoreStringWithUndefinedOrNullCheck(v8::Handle<v8::Value>
value) | 218 inline String toWebCoreStringWithUndefinedOrNullCheck(v8::Handle<v8::Value>
value) |
| 219 { | 219 { |
| 220 V8StringResource<WithUndefinedOrNullCheck> stringResource(value); | 220 V8StringResource<WithUndefinedOrNullCheck> stringResource(value); |
| 221 if (!stringResource.prepare()) | 221 if (!stringResource.prepare()) |
| 222 return String(); | 222 return String(); |
| 223 return stringResource; | 223 return stringResource; |
| 224 } | 224 } |
| 225 | 225 |
| 226 // FIXME: See the above comment. | |
| 227 inline AtomicString toWebCoreAtomicString(v8::Handle<v8::Value> value) | |
| 228 { | |
| 229 V8StringResource<> stringResource(value); | |
| 230 if (!stringResource.prepare()) | |
| 231 return AtomicString(); | |
| 232 return stringResource; | |
| 233 } | |
| 234 | |
| 235 // Convert a string to a V8 string. | 226 // Convert a string to a V8 string. |
| 236 // Return a V8 external string that shares the underlying buffer with the gi
ven | 227 // Return a V8 external string that shares the underlying buffer with the gi
ven |
| 237 // WebCore string. The reference counting mechanism is used to keep the | 228 // WebCore string. The reference counting mechanism is used to keep the |
| 238 // underlying buffer alive while the string is still live in the V8 engine. | 229 // underlying buffer alive while the string is still live in the V8 engine. |
| 239 inline v8::Handle<v8::String> v8String(const String& string, v8::Isolate* is
olate) | 230 inline v8::Handle<v8::String> v8String(const String& string, v8::Isolate* is
olate) |
| 240 { | 231 { |
| 241 if (string.isNull()) | 232 if (string.isNull()) |
| 242 return v8::String::Empty(isolate); | 233 return v8::String::Empty(isolate); |
| 243 return V8PerIsolateData::from(isolate)->stringCache()->v8ExternalString(
string.impl(), isolate); | 234 return V8PerIsolateData::from(isolate)->stringCache()->v8ExternalString(
string.impl(), isolate); |
| 244 } | 235 } |
| (...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 728 | 719 |
| 729 // Converts a DOM object to a v8 value. | 720 // Converts a DOM object to a v8 value. |
| 730 // This is a no-inline version of toV8(). If you want to call toV8() | 721 // This is a no-inline version of toV8(). If you want to call toV8() |
| 731 // without creating #include cycles, you can use this function instead. | 722 // without creating #include cycles, you can use this function instead. |
| 732 // Each specialized implementation will be generated. | 723 // Each specialized implementation will be generated. |
| 733 template<typename T> | 724 template<typename T> |
| 734 v8::Handle<v8::Value> toV8NoInline(T* impl, v8::Handle<v8::Object> creationC
ontext, v8::Isolate*); | 725 v8::Handle<v8::Value> toV8NoInline(T* impl, v8::Handle<v8::Object> creationC
ontext, v8::Isolate*); |
| 735 } // namespace WebCore | 726 } // namespace WebCore |
| 736 | 727 |
| 737 #endif // V8Binding_h | 728 #endif // V8Binding_h |
| OLD | NEW |