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 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 } | 316 } |
317 | 317 |
318 // Convert v8::String to a WTF::String. If the V8 string is not already | 318 // Convert v8::String to a WTF::String. If the V8 string is not already |
319 // an external string then it is transformed into an external string at this | 319 // an external string then it is transformed into an external string at this |
320 // point to avoid repeated conversions. | 320 // point to avoid repeated conversions. |
321 inline String toCoreString(v8::Handle<v8::String> value) | 321 inline String toCoreString(v8::Handle<v8::String> value) |
322 { | 322 { |
323 return v8StringToWebCoreString<String>(value, Externalize); | 323 return v8StringToWebCoreString<String>(value, Externalize); |
324 } | 324 } |
325 | 325 |
| 326 // Convert a V8 value to a WTF::String. |
| 327 String toCoreString(v8::Isolate*, v8::Local<v8::Value>); |
| 328 |
326 inline String toCoreStringWithNullCheck(v8::Handle<v8::String> value) | 329 inline String toCoreStringWithNullCheck(v8::Handle<v8::String> value) |
327 { | 330 { |
328 if (value.IsEmpty() || value->IsNull()) | 331 if (value.IsEmpty() || value->IsNull()) |
329 return String(); | 332 return String(); |
330 return toCoreString(value); | 333 return toCoreString(value); |
331 } | 334 } |
332 | 335 |
333 inline String toCoreStringWithUndefinedOrNullCheck(v8::Handle<v8::String> value) | 336 inline String toCoreStringWithUndefinedOrNullCheck(v8::Handle<v8::String> value) |
334 { | 337 { |
335 if (value.IsEmpty() || value->IsNull() || value->IsUndefined()) | 338 if (value.IsEmpty() || value->IsNull() || value->IsUndefined()) |
(...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
912 int length = collection->length(); | 915 int length = collection->length(); |
913 v8::Handle<v8::Array> properties = v8::Array::New(info.GetIsolate(), length)
; | 916 v8::Handle<v8::Array> properties = v8::Array::New(info.GetIsolate(), length)
; |
914 for (int i = 0; i < length; ++i) { | 917 for (int i = 0; i < length; ++i) { |
915 // FIXME: Do we need to check that the item function returns a non-null
value for this index? | 918 // FIXME: Do we need to check that the item function returns a non-null
value for this index? |
916 v8::Handle<v8::Integer> integer = v8::Integer::New(info.GetIsolate(), i)
; | 919 v8::Handle<v8::Integer> integer = v8::Integer::New(info.GetIsolate(), i)
; |
917 properties->Set(integer, integer); | 920 properties->Set(integer, integer); |
918 } | 921 } |
919 v8SetReturnValue(info, properties); | 922 v8SetReturnValue(info, properties); |
920 } | 923 } |
921 | 924 |
| 925 bool isValidEnum(const String value, const char** validValues, size_t length); |
| 926 bool isValidEnum(const Vector<String>& values, const char** validValues, size_t
length); |
| 927 |
922 // These methods store hidden values into an array that is stored in the interna
l field of a DOM wrapper. | 928 // These methods store hidden values into an array that is stored in the interna
l field of a DOM wrapper. |
923 void addHiddenValueToArray(v8::Isolate*, v8::Handle<v8::Object>, v8::Local<v8::V
alue>, int cacheIndex); | 929 void addHiddenValueToArray(v8::Isolate*, v8::Handle<v8::Object>, v8::Local<v8::V
alue>, int cacheIndex); |
924 void removeHiddenValueFromArray(v8::Isolate*, v8::Handle<v8::Object>, v8::Local<
v8::Value>, int cacheIndex); | 930 void removeHiddenValueFromArray(v8::Isolate*, v8::Handle<v8::Object>, v8::Local<
v8::Value>, int cacheIndex); |
925 CORE_EXPORT void moveEventListenerToNewWrapper(v8::Isolate*, v8::Handle<v8::Obje
ct>, EventListener* oldValue, v8::Local<v8::Value> newValue, int cacheIndex); | 931 CORE_EXPORT void moveEventListenerToNewWrapper(v8::Isolate*, v8::Handle<v8::Obje
ct>, EventListener* oldValue, v8::Local<v8::Value> newValue, int cacheIndex); |
926 | 932 |
927 // Result values for platform object 'deleter' methods, | 933 // Result values for platform object 'deleter' methods, |
928 // http://www.w3.org/TR/WebIDL/#delete | 934 // http://www.w3.org/TR/WebIDL/#delete |
929 enum DeleteResult { | 935 enum DeleteResult { |
930 DeleteSuccess, | 936 DeleteSuccess, |
931 DeleteReject, | 937 DeleteReject, |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
987 PassRefPtr<TraceEvent::ConvertableToTraceFormat> devToolsTraceEventData(v8::Isol
ate*, ExecutionContext*, v8::Handle<v8::Function>); | 993 PassRefPtr<TraceEvent::ConvertableToTraceFormat> devToolsTraceEventData(v8::Isol
ate*, ExecutionContext*, v8::Handle<v8::Function>); |
988 | 994 |
989 // Callback functions used by generated code. | 995 // Callback functions used by generated code. |
990 CORE_EXPORT void v8ConstructorAttributeGetter(v8::Local<v8::Name> propertyName,
const v8::PropertyCallbackInfo<v8::Value>&); | 996 CORE_EXPORT void v8ConstructorAttributeGetter(v8::Local<v8::Name> propertyName,
const v8::PropertyCallbackInfo<v8::Value>&); |
991 | 997 |
992 typedef void (*InstallTemplateFunction)(v8::Local<v8::FunctionTemplate>, v8::Iso
late*); | 998 typedef void (*InstallTemplateFunction)(v8::Local<v8::FunctionTemplate>, v8::Iso
late*); |
993 | 999 |
994 } // namespace blink | 1000 } // namespace blink |
995 | 1001 |
996 #endif // V8Binding_h | 1002 #endif // V8Binding_h |
OLD | NEW |