| Index: Source/bindings/common/StackTrace.h
|
| diff --git a/Source/bindings/common/StackTrace.h b/Source/bindings/common/StackTrace.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..e08bb4171b2713a30d5c7cc23f03ec8fd0ed4c84
|
| --- /dev/null
|
| +++ b/Source/bindings/common/StackTrace.h
|
| @@ -0,0 +1,134 @@
|
| +/*
|
| + * Copyright (C) 2014 Google Inc. All rights reserved.
|
| + *
|
| + * Redistribution and use in source and binary forms, with or without
|
| + * modification, are permitted provided that the following conditions are
|
| + * met:
|
| + *
|
| + * * Redistributions of source code must retain the above copyright
|
| + * notice, this list of conditions and the following disclaimer.
|
| + * * Redistributions in binary form must reproduce the above
|
| + * copyright notice, this list of conditions and the following disclaimer
|
| + * in the documentation and/or other materials provided with the
|
| + * distribution.
|
| + * * Neither the name of Google Inc. nor the names of its
|
| + * contributors may be used to endorse or promote products derived from
|
| + * this software without specific prior written permission.
|
| + *
|
| + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
| + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
| + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
| + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
| + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
| + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
| + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
| + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
| + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
| + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| + */
|
| +
|
| +#ifndef StackTrace_h
|
| +#define StackTrace_h
|
| +
|
| +#include "bindings/common/ScriptValue.h"
|
| +#include <dart_debugger_api.h>
|
| +
|
| +namespace WebCore {
|
| +
|
| +class JSONValue;
|
| +class ScriptState;
|
| +class V8ScriptState;
|
| +
|
| +class StackTrace {
|
| +public:
|
| + explicit StackTrace()
|
| + {
|
| + m_isJavaScript = true;
|
| + m_dartStackTrace = 0;
|
| + }
|
| +
|
| + explicit StackTrace(const ScriptValue& stackTrace)
|
| + {
|
| + m_isJavaScript = true;
|
| + m_scriptValue = stackTrace;
|
| + m_dartStackTrace = 0;
|
| + }
|
| +
|
| + explicit StackTrace(Dart_StackTrace stackTrace)
|
| + {
|
| + m_isJavaScript = false;
|
| + m_dartStackTrace = stackTrace;
|
| + }
|
| +
|
| + bool isJavaScript() const
|
| + {
|
| + return m_isJavaScript;
|
| + }
|
| +
|
| + ScriptValue asJavaScript() const
|
| + {
|
| + ASSERT(m_isJavaScript);
|
| + return m_scriptValue;
|
| + }
|
| +
|
| + Dart_StackTrace asDart() const
|
| + {
|
| + ASSERT(!m_isJavaScript);
|
| + return m_dartStackTrace;
|
| + }
|
| +
|
| + bool isNull() const
|
| + {
|
| + return m_isJavaScript ? m_scriptValue.isNull() : !m_dartStackTrace;
|
| + }
|
| +
|
| +private:
|
| + bool m_isJavaScript;
|
| + ScriptValue m_scriptValue;
|
| + Dart_StackTrace m_dartStackTrace;
|
| +};
|
| +
|
| +class ActivationFrame {
|
| +public:
|
| + explicit ActivationFrame()
|
| + {
|
| + m_isJavaScript = true;
|
| + m_dartActivationFrame = 0;
|
| + }
|
| +
|
| + explicit ActivationFrame(const ScriptValue& activationFrame)
|
| + {
|
| + m_isJavaScript = true;
|
| + m_scriptValue = activationFrame;
|
| + m_dartActivationFrame = 0;
|
| + }
|
| +
|
| + explicit ActivationFrame(Dart_ActivationFrame activationFrame)
|
| + {
|
| + m_isJavaScript = false;
|
| + m_dartActivationFrame = activationFrame;
|
| + }
|
| +
|
| + bool isJavaScript() const { return m_isJavaScript; }
|
| + ScriptValue asJavaScript() const
|
| + {
|
| + ASSERT(m_isJavaScript);
|
| + return m_scriptValue;
|
| + }
|
| +
|
| + Dart_ActivationFrame asDart() const
|
| + {
|
| + ASSERT(!m_isJavaScript);
|
| + return m_dartActivationFrame;
|
| + }
|
| +
|
| +private:
|
| + bool m_isJavaScript;
|
| + ScriptValue m_scriptValue;
|
| + Dart_ActivationFrame m_dartActivationFrame;
|
| +};
|
| +
|
| +} // namespace WebCore
|
| +
|
| +#endif // StackTrace_h
|
|
|