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 949 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
960 | 960 |
961 class V8IsolateInterruptor : public ThreadState::Interruptor { | 961 class V8IsolateInterruptor : public ThreadState::Interruptor { |
962 public: | 962 public: |
963 explicit V8IsolateInterruptor(v8::Isolate* isolate) : m_isolate(isolate) { } | 963 explicit V8IsolateInterruptor(v8::Isolate* isolate) : m_isolate(isolate) { } |
964 | 964 |
965 static void onInterruptCallback(v8::Isolate* isolate, void* data) | 965 static void onInterruptCallback(v8::Isolate* isolate, void* data) |
966 { | 966 { |
967 reinterpret_cast<V8IsolateInterruptor*>(data)->onInterrupted(); | 967 reinterpret_cast<V8IsolateInterruptor*>(data)->onInterrupted(); |
968 } | 968 } |
969 | 969 |
970 virtual void requestInterrupt() OVERRIDE | 970 virtual void requestInterrupt() override |
971 { | 971 { |
972 m_isolate->RequestInterrupt(&onInterruptCallback, this); | 972 m_isolate->RequestInterrupt(&onInterruptCallback, this); |
973 } | 973 } |
974 | 974 |
975 virtual void clearInterrupt() OVERRIDE | 975 virtual void clearInterrupt() override |
976 { | 976 { |
977 m_isolate->ClearInterrupt(); | 977 m_isolate->ClearInterrupt(); |
978 } | 978 } |
979 | 979 |
980 private: | 980 private: |
981 v8::Isolate* m_isolate; | 981 v8::Isolate* m_isolate; |
982 }; | 982 }; |
983 | 983 |
984 class V8TestingScope { | 984 class V8TestingScope { |
985 public: | 985 public: |
986 explicit V8TestingScope(v8::Isolate*); | 986 explicit V8TestingScope(v8::Isolate*); |
987 ScriptState* scriptState() const; | 987 ScriptState* scriptState() const; |
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(Executio
nContext*, v8::Handle<v8::Function>, v8::Isolate*); |
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 |