OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008, 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2008, 2009 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 class ScriptValue { | 45 class ScriptValue { |
46 public: | 46 public: |
47 ScriptValue() | 47 ScriptValue() |
48 : m_isolate(0) | 48 : m_isolate(0) |
49 { } | 49 { } |
50 | 50 |
51 virtual ~ScriptValue(); | 51 virtual ~ScriptValue(); |
52 | 52 |
53 ScriptValue(v8::Handle<v8::Value> value, v8::Isolate* isolate) | 53 ScriptValue(v8::Handle<v8::Value> value, v8::Isolate* isolate) |
54 : m_isolate(isolate) | 54 : m_isolate(isolate) |
55 , m_value(value.IsEmpty() ? 0 : SharedPersistent<v8::Value>::create(valu
e, isolate)) | 55 , m_value(value.IsEmpty() ? nullptr : SharedPersistent<v8::Value>::creat
e(value, isolate)) |
56 { | 56 { |
57 } | 57 } |
58 | 58 |
59 ScriptValue(const ScriptValue& value) | 59 ScriptValue(const ScriptValue& value) |
60 : m_isolate(value.m_isolate) | 60 : m_isolate(value.m_isolate) |
61 , m_value(value.m_value) | 61 , m_value(value.m_value) |
62 { | 62 { |
63 } | 63 } |
64 | 64 |
65 v8::Isolate* isolate() const | 65 v8::Isolate* isolate() const |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 return !value.IsEmpty() && value->IsObject(); | 144 return !value.IsEmpty() && value->IsObject(); |
145 } | 145 } |
146 | 146 |
147 bool hasNoValue() const | 147 bool hasNoValue() const |
148 { | 148 { |
149 return !m_value.get() || m_value->isEmpty(); | 149 return !m_value.get() || m_value->isEmpty(); |
150 } | 150 } |
151 | 151 |
152 void clear() | 152 void clear() |
153 { | 153 { |
154 m_value = 0; | 154 m_value = nullptr; |
155 } | 155 } |
156 | 156 |
157 v8::Handle<v8::Value> v8Value() const | 157 v8::Handle<v8::Value> v8Value() const |
158 { | 158 { |
159 return m_value.get() ? m_value->newLocal(m_isolate) : v8::Handle<v8::Val
ue>(); | 159 return m_value.get() ? m_value->newLocal(m_isolate) : v8::Handle<v8::Val
ue>(); |
160 } | 160 } |
161 | 161 |
162 bool getString(String& result) const; | 162 bool getString(String& result) const; |
163 String toString() const; | 163 String toString() const; |
164 | 164 |
165 PassRefPtr<JSONValue> toJSONValue(ScriptState*) const; | 165 PassRefPtr<JSONValue> toJSONValue(ScriptState*) const; |
166 | 166 |
167 private: | 167 private: |
168 mutable v8::Isolate* m_isolate; | 168 mutable v8::Isolate* m_isolate; |
169 RefPtr<SharedPersistent<v8::Value> > m_value; | 169 RefPtr<SharedPersistent<v8::Value> > m_value; |
170 }; | 170 }; |
171 | 171 |
172 } // namespace WebCore | 172 } // namespace WebCore |
173 | 173 |
174 #endif // ScriptValue_h | 174 #endif // ScriptValue_h |
OLD | NEW |