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 27 matching lines...) Expand all Loading... |
38 #include "bindings/core/v8/ExceptionState.h" | 38 #include "bindings/core/v8/ExceptionState.h" |
39 #include "bindings/core/v8/NativeValueTraits.h" | 39 #include "bindings/core/v8/NativeValueTraits.h" |
40 #include "bindings/core/v8/ScriptValue.h" | 40 #include "bindings/core/v8/ScriptValue.h" |
41 #include "bindings/core/v8/ScriptWrappable.h" | 41 #include "bindings/core/v8/ScriptWrappable.h" |
42 #include "bindings/core/v8/V8BindingMacros.h" | 42 #include "bindings/core/v8/V8BindingMacros.h" |
43 #include "bindings/core/v8/V8PerIsolateData.h" | 43 #include "bindings/core/v8/V8PerIsolateData.h" |
44 #include "bindings/core/v8/V8StringResource.h" | 44 #include "bindings/core/v8/V8StringResource.h" |
45 #include "bindings/core/v8/V8ThrowException.h" | 45 #include "bindings/core/v8/V8ThrowException.h" |
46 #include "bindings/core/v8/V8ValueCache.h" | 46 #include "bindings/core/v8/V8ValueCache.h" |
47 #include "core/CoreExport.h" | 47 #include "core/CoreExport.h" |
| 48 #include "platform/JSONValues.h" |
48 #include "platform/heap/Handle.h" | 49 #include "platform/heap/Handle.h" |
49 #include "wtf/text/AtomicString.h" | 50 #include "wtf/text/AtomicString.h" |
50 #include <v8.h> | 51 #include <v8.h> |
51 | 52 |
52 namespace blink { | 53 namespace blink { |
53 | 54 |
54 class DOMWindow; | 55 class DOMWindow; |
55 class EventListener; | 56 class EventListener; |
56 class EventTarget; | 57 class EventTarget; |
57 class ExecutionContext; | 58 class ExecutionContext; |
(...skipping 773 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
831 }; | 832 }; |
832 | 833 |
833 template <typename T> | 834 template <typename T> |
834 struct NativeValueTraits<Vector<T>> { | 835 struct NativeValueTraits<Vector<T>> { |
835 static inline Vector<T> nativeValue(v8::Isolate* isolate, v8::Local<v8::Valu
e> value, ExceptionState& exceptionState) | 836 static inline Vector<T> nativeValue(v8::Isolate* isolate, v8::Local<v8::Valu
e> value, ExceptionState& exceptionState) |
836 { | 837 { |
837 return toImplArray<T>(value, 0, isolate, exceptionState); | 838 return toImplArray<T>(value, 0, isolate, exceptionState); |
838 } | 839 } |
839 }; | 840 }; |
840 | 841 |
| 842 using JSONValuePtr = PassRefPtr<JSONValue>; |
| 843 template <> |
| 844 struct NativeValueTraits<JSONValuePtr> { |
| 845 static JSONValuePtr nativeValue(v8::Isolate*, v8::Local<v8::Value>, Exceptio
nState&, int maxDepth = JSONValue::maxDepth); |
| 846 }; |
| 847 |
841 CORE_EXPORT v8::Isolate* toIsolate(ExecutionContext*); | 848 CORE_EXPORT v8::Isolate* toIsolate(ExecutionContext*); |
842 v8::Isolate* toIsolate(LocalFrame*); | 849 v8::Isolate* toIsolate(LocalFrame*); |
843 | 850 |
844 DOMWindow* toDOMWindow(v8::Isolate*, v8::Handle<v8::Value>); | 851 DOMWindow* toDOMWindow(v8::Isolate*, v8::Handle<v8::Value>); |
845 DOMWindow* toDOMWindow(v8::Handle<v8::Context>); | 852 DOMWindow* toDOMWindow(v8::Handle<v8::Context>); |
846 LocalDOMWindow* enteredDOMWindow(v8::Isolate*); | 853 LocalDOMWindow* enteredDOMWindow(v8::Isolate*); |
847 LocalDOMWindow* currentDOMWindow(v8::Isolate*); | 854 LocalDOMWindow* currentDOMWindow(v8::Isolate*); |
848 LocalDOMWindow* callingDOMWindow(v8::Isolate*); | 855 LocalDOMWindow* callingDOMWindow(v8::Isolate*); |
849 ExecutionContext* toExecutionContext(v8::Handle<v8::Context>); | 856 ExecutionContext* toExecutionContext(v8::Handle<v8::Context>); |
850 CORE_EXPORT ExecutionContext* currentExecutionContext(v8::Isolate*); | 857 CORE_EXPORT ExecutionContext* currentExecutionContext(v8::Isolate*); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
892 properties->Set(integer, integer); | 899 properties->Set(integer, integer); |
893 } | 900 } |
894 v8SetReturnValue(info, properties); | 901 v8SetReturnValue(info, properties); |
895 } | 902 } |
896 | 903 |
897 // These methods store hidden values into an array that is stored in the interna
l field of a DOM wrapper. | 904 // These methods store hidden values into an array that is stored in the interna
l field of a DOM wrapper. |
898 void addHiddenValueToArray(v8::Isolate*, v8::Handle<v8::Object>, v8::Local<v8::V
alue>, int cacheIndex); | 905 void addHiddenValueToArray(v8::Isolate*, v8::Handle<v8::Object>, v8::Local<v8::V
alue>, int cacheIndex); |
899 void removeHiddenValueFromArray(v8::Isolate*, v8::Handle<v8::Object>, v8::Local<
v8::Value>, int cacheIndex); | 906 void removeHiddenValueFromArray(v8::Isolate*, v8::Handle<v8::Object>, v8::Local<
v8::Value>, int cacheIndex); |
900 CORE_EXPORT void moveEventListenerToNewWrapper(v8::Isolate*, v8::Handle<v8::Obje
ct>, EventListener* oldValue, v8::Local<v8::Value> newValue, int cacheIndex); | 907 CORE_EXPORT void moveEventListenerToNewWrapper(v8::Isolate*, v8::Handle<v8::Obje
ct>, EventListener* oldValue, v8::Local<v8::Value> newValue, int cacheIndex); |
901 | 908 |
902 PassRefPtr<JSONValue> v8ToJSONValue(v8::Isolate*, v8::Handle<v8::Value>, int); | |
903 | |
904 // Result values for platform object 'deleter' methods, | 909 // Result values for platform object 'deleter' methods, |
905 // http://www.w3.org/TR/WebIDL/#delete | 910 // http://www.w3.org/TR/WebIDL/#delete |
906 enum DeleteResult { | 911 enum DeleteResult { |
907 DeleteSuccess, | 912 DeleteSuccess, |
908 DeleteReject, | 913 DeleteReject, |
909 DeleteUnknownProperty | 914 DeleteUnknownProperty |
910 }; | 915 }; |
911 | 916 |
912 class V8IsolateInterruptor : public ThreadState::Interruptor { | 917 class V8IsolateInterruptor : public ThreadState::Interruptor { |
913 public: | 918 public: |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
964 PassRefPtr<TraceEvent::ConvertableToTraceFormat> devToolsTraceEventData(v8::Isol
ate*, ExecutionContext*, v8::Handle<v8::Function>); | 969 PassRefPtr<TraceEvent::ConvertableToTraceFormat> devToolsTraceEventData(v8::Isol
ate*, ExecutionContext*, v8::Handle<v8::Function>); |
965 | 970 |
966 // Callback functions used by generated code. | 971 // Callback functions used by generated code. |
967 CORE_EXPORT void v8ConstructorAttributeGetter(v8::Local<v8::Name> propertyName,
const v8::PropertyCallbackInfo<v8::Value>&); | 972 CORE_EXPORT void v8ConstructorAttributeGetter(v8::Local<v8::Name> propertyName,
const v8::PropertyCallbackInfo<v8::Value>&); |
968 | 973 |
969 typedef void (*InstallTemplateFunction)(v8::Local<v8::FunctionTemplate>, v8::Iso
late*); | 974 typedef void (*InstallTemplateFunction)(v8::Local<v8::FunctionTemplate>, v8::Iso
late*); |
970 | 975 |
971 } // namespace blink | 976 } // namespace blink |
972 | 977 |
973 #endif // V8Binding_h | 978 #endif // V8Binding_h |
OLD | NEW |