| Index: sky/engine/bindings2/exception_state.h
|
| diff --git a/sky/engine/bindings2/exception_state.h b/sky/engine/bindings2/exception_state.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..e73b88a6fe501d6aa8c8591fb2b8da6e9bef1f75
|
| --- /dev/null
|
| +++ b/sky/engine/bindings2/exception_state.h
|
| @@ -0,0 +1,68 @@
|
| +// Copyright 2014 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef SKY_ENGINE_BINDINGS2_EXCEPTION_STATE_H_
|
| +#define SKY_ENGINE_BINDINGS2_EXCEPTION_STATE_H_
|
| +
|
| +#include "sky/engine/tonic/dart_persistent_value.h"
|
| +#include "sky/engine/wtf/Noncopyable.h"
|
| +#include "sky/engine/wtf/text/WTFString.h"
|
| +
|
| +namespace blink {
|
| +
|
| +typedef int ExceptionCode;
|
| +
|
| +class ExceptionState {
|
| + WTF_MAKE_NONCOPYABLE(ExceptionState);
|
| +
|
| + public:
|
| + enum Context {
|
| + ConstructionContext,
|
| + ExecutionContext,
|
| + DeletionContext,
|
| + GetterContext,
|
| + SetterContext,
|
| + EnumerationContext,
|
| + QueryContext,
|
| + IndexedGetterContext,
|
| + IndexedSetterContext,
|
| + IndexedDeletionContext,
|
| + UnknownContext, // FIXME: Remove this once we've flipped over to the new
|
| + // API.
|
| + };
|
| +
|
| + ExceptionState();
|
| + ExceptionState(Context context, const char* interfaceName);
|
| + ExceptionState(Context context,
|
| + const char* propertyName,
|
| + const char* interfaceName);
|
| + ~ExceptionState();
|
| +
|
| + void ThrowDOMException(const ExceptionCode& code, const String& message);
|
| + void ThrowTypeError(const String& message);
|
| + void ThrowRangeError(const String& message);
|
| +
|
| + bool ThrowIfNeeded();
|
| + void ClearException();
|
| +
|
| + ExceptionCode code() const { return code_; }
|
| + const String& message() const { return message_; }
|
| + bool had_exception() const { return had_exception_ || code_; }
|
| +
|
| + Dart_Handle GetDartException(Dart_NativeArguments args, bool auto_scope);
|
| +
|
| + private:
|
| + ExceptionCode code_;
|
| + String message_;
|
| + bool had_exception_;
|
| + DartPersistentValue exception_;
|
| +};
|
| +
|
| +class NonThrowableExceptionState final : public ExceptionState {};
|
| +
|
| +class TrackExceptionState final : public ExceptionState {};
|
| +
|
| +} // namespace blink
|
| +
|
| +#endif // SKY_ENGINE_BINDINGS2_EXCEPTION_STATE_H_
|
|
|