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 20 matching lines...) Expand all Loading... |
31 #ifndef ScriptValue_h | 31 #ifndef ScriptValue_h |
32 #define ScriptValue_h | 32 #define ScriptValue_h |
33 | 33 |
34 #include "bindings/common/AbstractScriptValue.h" | 34 #include "bindings/common/AbstractScriptValue.h" |
35 #include "bindings/dart/DartScriptValue.h" | 35 #include "bindings/dart/DartScriptValue.h" |
36 #include "bindings/v8/SharedPersistent.h" | 36 #include "bindings/v8/SharedPersistent.h" |
37 #include "bindings/v8/V8ScriptValue.h" | 37 #include "bindings/v8/V8ScriptValue.h" |
38 #include "wtf/PassRefPtr.h" | 38 #include "wtf/PassRefPtr.h" |
39 #include "wtf/RefPtr.h" | 39 #include "wtf/RefPtr.h" |
40 #include "wtf/text/WTFString.h" | 40 #include "wtf/text/WTFString.h" |
| 41 #include <dart_debugger_api.h> |
41 #include <v8.h> | 42 #include <v8.h> |
42 | 43 |
43 namespace WebCore { | 44 namespace WebCore { |
44 | 45 |
45 class JSONValue; | 46 class JSONValue; |
46 class ScriptState; | 47 class ScriptState; |
47 class V8ScriptState; | 48 class V8ScriptState; |
48 | 49 |
49 // Indirection to avoid re-writing the parts of Blink that pass ScriptValue by | 50 // Indirection to avoid re-writing the parts of Blink that pass ScriptValue by |
50 // value. | 51 // value. |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 | 167 |
167 AbstractScriptValue* scriptValue() const | 168 AbstractScriptValue* scriptValue() const |
168 { | 169 { |
169 return m_implScriptValue.get(); | 170 return m_implScriptValue.get(); |
170 } | 171 } |
171 | 172 |
172 private: | 173 private: |
173 RefPtr<AbstractScriptValue> m_implScriptValue; | 174 RefPtr<AbstractScriptValue> m_implScriptValue; |
174 }; | 175 }; |
175 | 176 |
| 177 // FIXMEDART: where should we define this class that holds either a V8 or Dart |
| 178 // stack trace? |
| 179 class StackTrace { |
| 180 public: |
| 181 explicit StackTrace() |
| 182 { |
| 183 m_isJavaScript = true; |
| 184 m_dartStackTrace = 0; |
| 185 } |
| 186 |
| 187 explicit StackTrace(const ScriptValue& stackTrace) |
| 188 { |
| 189 m_isJavaScript = true; |
| 190 m_scriptValue = stackTrace; |
| 191 m_dartStackTrace = 0; |
| 192 } |
| 193 |
| 194 explicit StackTrace(Dart_StackTrace stackTrace) |
| 195 { |
| 196 m_isJavaScript = false; |
| 197 m_dartStackTrace = stackTrace; |
| 198 } |
| 199 |
| 200 bool isJavaScript() const |
| 201 { |
| 202 return m_isJavaScript; |
| 203 } |
| 204 |
| 205 ScriptValue asJavaScript() const |
| 206 { |
| 207 ASSERT(m_isJavaScript); |
| 208 return m_scriptValue; |
| 209 } |
| 210 |
| 211 Dart_StackTrace asDart() const |
| 212 { |
| 213 ASSERT(!m_isJavaScript); |
| 214 return m_dartStackTrace; |
| 215 } |
| 216 |
| 217 bool isNull() const |
| 218 { |
| 219 return m_isJavaScript ? m_scriptValue.isNull() : !m_dartStackTrace; |
| 220 } |
| 221 |
| 222 private: |
| 223 bool m_isJavaScript; |
| 224 ScriptValue m_scriptValue; |
| 225 Dart_StackTrace m_dartStackTrace; |
| 226 }; |
| 227 |
| 228 // FIXMEDART: where should we define this class that holds either a V8 or Dart |
| 229 // activation frame? |
| 230 class ActivationFrame { |
| 231 public: |
| 232 explicit ActivationFrame() |
| 233 { |
| 234 m_isJavaScript = true; |
| 235 m_dartActivationFrame = 0; |
| 236 } |
| 237 |
| 238 explicit ActivationFrame(const ScriptValue& activationFrame) |
| 239 { |
| 240 m_isJavaScript = true; |
| 241 m_scriptValue = activationFrame; |
| 242 m_dartActivationFrame = 0; |
| 243 } |
| 244 |
| 245 explicit ActivationFrame(Dart_ActivationFrame activationFrame) |
| 246 { |
| 247 m_isJavaScript = false; |
| 248 m_dartActivationFrame = activationFrame; |
| 249 } |
| 250 |
| 251 bool isJavaScript() const { return m_isJavaScript; } |
| 252 ScriptValue asJavaScript() const |
| 253 { |
| 254 ASSERT(m_isJavaScript); |
| 255 return m_scriptValue; |
| 256 } |
| 257 |
| 258 Dart_ActivationFrame asDart() const |
| 259 { |
| 260 ASSERT(!m_isJavaScript); |
| 261 return m_dartActivationFrame; |
| 262 } |
| 263 |
| 264 private: |
| 265 bool m_isJavaScript; |
| 266 ScriptValue m_scriptValue; |
| 267 Dart_ActivationFrame m_dartActivationFrame; |
| 268 }; |
| 269 |
176 } // namespace WebCore | 270 } // namespace WebCore |
177 | 271 |
178 #endif // ScriptValue_h | 272 #endif // ScriptValue_h |
OLD | NEW |