Chromium Code Reviews| Index: Source/bindings/v8/ScriptValue.h |
| diff --git a/Source/bindings/v8/ScriptValue.h b/Source/bindings/v8/ScriptValue.h |
| index 124ea110c3a81f88e4a2aef6efb7731469c3ec17..1f9e74aa956565dd7375c159ace96bd79e4c8124 100644 |
| --- a/Source/bindings/v8/ScriptValue.h |
| +++ b/Source/bindings/v8/ScriptValue.h |
| @@ -31,8 +31,8 @@ |
| #ifndef ScriptValue_h |
| #define ScriptValue_h |
| -#include "bindings/v8/SharedPersistent.h" |
| -#include "wtf/PassRefPtr.h" |
| +#include "bindings/v8/ScopedPersistent.h" |
| +#include "wtf/RefCounted.h" |
| #include "wtf/RefPtr.h" |
| #include "wtf/text/WTFString.h" |
| #include <v8.h> |
| @@ -42,6 +42,32 @@ namespace WebCore { |
| class JSONValue; |
| class ScriptState; |
| +template <typename T> |
| +class SharedPersistent : public RefCounted<SharedPersistent<T> > { |
|
jochen (gone - plz use gerrit)
2014/01/24 12:19:21
doesn't need to be a template anymore, does it?
y
haraken
2014/01/24 12:31:06
Good point, fixed.
|
| + WTF_MAKE_NONCOPYABLE(SharedPersistent); |
| +public: |
| + static PassRefPtr<SharedPersistent<T> > create(v8::Handle<T> value, v8::Isolate* isolate) |
| + { |
| + return adoptRef(new SharedPersistent<T>(value, isolate)); |
| + } |
| + |
| + v8::Local<T> newLocal(v8::Isolate* isolate) const |
| + { |
| + return m_value.newLocal(isolate); |
| + } |
| + |
| + bool isEmpty() { return m_value.isEmpty(); } |
| + |
| + bool operator==(const SharedPersistent<T>& other) |
| + { |
| + return m_value == other.m_value; |
| + } |
| + |
| +private: |
| + SharedPersistent(v8::Handle<T> value, v8::Isolate* isolate) : m_value(isolate, value) { } |
| + ScopedPersistent<T> m_value; |
| +}; |
| + |
| class ScriptValue { |
| public: |
| ScriptValue() |