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 926 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
937 v8::Handle<v8::Array> properties = v8::Array::New(info.GetIsolate(), length)
; | 937 v8::Handle<v8::Array> properties = v8::Array::New(info.GetIsolate(), length)
; |
938 for (int i = 0; i < length; ++i) { | 938 for (int i = 0; i < length; ++i) { |
939 // FIXME: Do we need to check that the item function returns a non-null
value for this index? | 939 // FIXME: Do we need to check that the item function returns a non-null
value for this index? |
940 v8::Handle<v8::Integer> integer = v8::Integer::New(info.GetIsolate(), i)
; | 940 v8::Handle<v8::Integer> integer = v8::Integer::New(info.GetIsolate(), i)
; |
941 properties->Set(integer, integer); | 941 properties->Set(integer, integer); |
942 } | 942 } |
943 v8SetReturnValue(info, properties); | 943 v8SetReturnValue(info, properties); |
944 } | 944 } |
945 | 945 |
946 // These methods store hidden values into an array that is stored in the interna
l field of a DOM wrapper. | 946 // These methods store hidden values into an array that is stored in the interna
l field of a DOM wrapper. |
947 void addHiddenValueToArray(v8::Handle<v8::Object>, v8::Local<v8::Value>, int cac
heIndex, v8::Isolate*); | 947 void addHiddenValueToArray(v8::Isolate*, v8::Handle<v8::Object>, v8::Local<v8::V
alue>, int cacheIndex); |
948 void removeHiddenValueFromArray(v8::Handle<v8::Object>, v8::Local<v8::Value>, in
t cacheIndex, v8::Isolate*); | 948 void removeHiddenValueFromArray(v8::Isolate*, v8::Handle<v8::Object>, v8::Local<
v8::Value>, int cacheIndex); |
949 void moveEventListenerToNewWrapper(v8::Handle<v8::Object>, EventListener* oldVal
ue, v8::Local<v8::Value> newValue, int cacheIndex, v8::Isolate*); | 949 void moveEventListenerToNewWrapper(v8::Isolate*, v8::Handle<v8::Object>, EventLi
stener* oldValue, v8::Local<v8::Value> newValue, int cacheIndex); |
950 | 950 |
951 PassRefPtr<JSONValue> v8ToJSONValue(v8::Isolate*, v8::Handle<v8::Value>, int); | 951 PassRefPtr<JSONValue> v8ToJSONValue(v8::Isolate*, v8::Handle<v8::Value>, int); |
952 | 952 |
953 // Result values for platform object 'deleter' methods, | 953 // Result values for platform object 'deleter' methods, |
954 // http://www.w3.org/TR/WebIDL/#delete | 954 // http://www.w3.org/TR/WebIDL/#delete |
955 enum DeleteResult { | 955 enum DeleteResult { |
956 DeleteSuccess, | 956 DeleteSuccess, |
957 DeleteReject, | 957 DeleteReject, |
958 DeleteUnknownProperty | 958 DeleteUnknownProperty |
959 }; | 959 }; |
(...skipping 28 matching lines...) Expand all Loading... |
988 v8::Isolate* isolate() const; | 988 v8::Isolate* isolate() const; |
989 ~V8TestingScope(); | 989 ~V8TestingScope(); |
990 | 990 |
991 private: | 991 private: |
992 v8::HandleScope m_handleScope; | 992 v8::HandleScope m_handleScope; |
993 v8::Context::Scope m_contextScope; | 993 v8::Context::Scope m_contextScope; |
994 RefPtr<ScriptState> m_scriptState; | 994 RefPtr<ScriptState> m_scriptState; |
995 }; | 995 }; |
996 | 996 |
997 void GetDevToolsFunctionInfo(v8::Handle<v8::Function>, v8::Isolate*, int& script
Id, String& resourceName, int& lineNumber); | 997 void GetDevToolsFunctionInfo(v8::Handle<v8::Function>, v8::Isolate*, int& script
Id, String& resourceName, int& lineNumber); |
998 PassRefPtr<TraceEvent::ConvertableToTraceFormat> devToolsTraceEventData(Executio
nContext*, v8::Handle<v8::Function>, v8::Isolate*); | 998 PassRefPtr<TraceEvent::ConvertableToTraceFormat> devToolsTraceEventData(v8::Isol
ate*, ExecutionContext*, v8::Handle<v8::Function>); |
999 | 999 |
1000 class V8RethrowTryCatchScope final { | 1000 class V8RethrowTryCatchScope final { |
1001 public: | 1001 public: |
1002 explicit V8RethrowTryCatchScope(v8::TryCatch& block) : m_block(block) { } | 1002 explicit V8RethrowTryCatchScope(v8::TryCatch& block) : m_block(block) { } |
1003 ~V8RethrowTryCatchScope() | 1003 ~V8RethrowTryCatchScope() |
1004 { | 1004 { |
1005 // ReThrow() is a no-op if no exception has been caught, so always call. | 1005 // ReThrow() is a no-op if no exception has been caught, so always call. |
1006 m_block.ReThrow(); | 1006 m_block.ReThrow(); |
1007 } | 1007 } |
1008 | 1008 |
1009 private: | 1009 private: |
1010 v8::TryCatch& m_block; | 1010 v8::TryCatch& m_block; |
1011 }; | 1011 }; |
1012 | 1012 |
1013 // Returns an object representing {done: true, value: undefined}. | 1013 // Returns an object representing {done: true, value: undefined}. |
1014 v8::Local<v8::Value> v8DoneIteratorResult(v8::Isolate*); | 1014 v8::Local<v8::Value> v8DoneIteratorResult(v8::Isolate*); |
1015 | 1015 |
1016 // Returns an object representing {done: false, value: |value|}. | 1016 // Returns an object representing {done: false, value: |value|}. |
1017 v8::Local<v8::Value> v8IteratorResult(v8::Isolate*, v8::Handle<v8::Value>); | 1017 v8::Local<v8::Value> v8IteratorResult(v8::Isolate*, v8::Handle<v8::Value>); |
1018 template <typename T> | 1018 template <typename T> |
1019 v8::Local<v8::Value> v8IteratorResult(ScriptState* scriptState, const T& value) | 1019 v8::Local<v8::Value> v8IteratorResult(ScriptState* scriptState, const T& value) |
1020 { | 1020 { |
1021 return v8IteratorResult(scriptState->isolate(), V8ValueTraits<T>::toV8Value(
value, scriptState->context()->Global(), scriptState->isolate())); | 1021 return v8IteratorResult(scriptState->isolate(), V8ValueTraits<T>::toV8Value(
value, scriptState->context()->Global(), scriptState->isolate())); |
1022 } | 1022 } |
1023 | 1023 |
1024 } // namespace blink | 1024 } // namespace blink |
1025 | 1025 |
1026 #endif // V8Binding_h | 1026 #endif // V8Binding_h |
OLD | NEW |