Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(204)

Unified Diff: Source/bindings/v8/ExceptionState.h

Issue 18398002: Remove IDBNotFoundError ExceptionCode (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Add missing include in code gen wich causes win compile failure Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/bindings/v8/ExceptionState.h
diff --git a/Source/core/animation/AnimatableUnknown.h b/Source/bindings/v8/ExceptionState.h
similarity index 53%
copy from Source/core/animation/AnimatableUnknown.h
copy to Source/bindings/v8/ExceptionState.h
index d253478e752935df4677dfdec8a2ad8261f2f1be..b2b88fb861244e39e6f587a31d47f9d75deb3245 100644
--- a/Source/core/animation/AnimatableUnknown.h
+++ b/Source/bindings/v8/ExceptionState.h
@@ -28,46 +28,68 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef AnimatableUnknown_h
-#define AnimatableUnknown_h
+#ifndef ExceptionState_h
+#define ExceptionState_h
-#include "core/animation/AnimatableValue.h"
+#include "wtf/Noncopyable.h"
+#include <v8.h>
namespace WebCore {
-class AnimatableUnknown : public AnimatableValue {
+typedef int ExceptionCode;
+
+class ExceptionState {
+ WTF_MAKE_NONCOPYABLE(ExceptionState);
public:
- virtual ~AnimatableUnknown() { }
+ explicit ExceptionState(v8::Isolate* isolate)
+ : m_code(0)
+ , m_exceptionThrown(false)
+ , m_isolate(isolate) { }
- static PassRefPtr<AnimatableUnknown> create(PassRefPtr<CSSValue> value)
- {
- return adoptRef(new AnimatableUnknown(value));
- }
+ virtual void throwDOMException(const ExceptionCode&, const char* message = 0);
+ virtual void throwTypeError(const char* message = 0);
- virtual PassRefPtr<CSSValue> toCSSValue() const OVERRIDE { return m_value; }
+ bool hadException() const { return m_exceptionThrown || m_code; }
-protected:
- virtual PassRefPtr<AnimatableValue> interpolateTo(const AnimatableValue* value, double fraction) const OVERRIDE
+ bool throwIfNeeded()
{
- return defaultInterpolateTo(this, value, fraction);
+ if (m_code) {
+ throwDOMException(m_code);
+ return true;
+ }
+ return m_exceptionThrown;
}
- virtual PassRefPtr<AnimatableValue> addWith(const AnimatableValue* value) const OVERRIDE
+ // FIXME: Remove the rest of the public methods/operators once the transition is done.
+ typedef void* ExceptionState::*UnspecifiedBoolType;
+ operator UnspecifiedBoolType*() const
{
- return defaultAddWith(this, value);
+ return m_code ? reinterpret_cast<UnspecifiedBoolType*>(1) : 0;
}
-private:
- explicit AnimatableUnknown(PassRefPtr<CSSValue> value)
- : AnimatableValue(TypeUnknown)
- , m_value(value)
+ operator ExceptionCode& () { return m_code; }
+
+ ExceptionState& operator=(const ExceptionCode& ec)
{
- ASSERT(m_value);
+ throwDOMException(ec);
+ return *this;
}
- RefPtr<CSSValue> m_value;
+protected:
+ ExceptionCode m_code;
+
+private:
+ bool m_exceptionThrown;
+ v8::Isolate* m_isolate;
+};
+
+class NonThrowExceptionState : public ExceptionState {
+public:
+ NonThrowExceptionState();
+ virtual void throwDOMException(const ExceptionCode&, const char* = 0) OVERRIDE FINAL;
+ virtual void throwTypeError(const char* = 0) OVERRIDE FINAL;
};
} // namespace WebCore
-#endif // AnimatableUnknown_h
+#endif // ExceptionState_h

Powered by Google App Engine
This is Rietveld 408576698