diff options
Diffstat (limited to 'Source/WebCore/inspector/InspectorHistory.h')
-rw-r--r-- | Source/WebCore/inspector/InspectorHistory.h | 56 |
1 files changed, 23 insertions, 33 deletions
diff --git a/Source/WebCore/inspector/InspectorHistory.h b/Source/WebCore/inspector/InspectorHistory.h index 7224a393e..318fca376 100644 --- a/Source/WebCore/inspector/InspectorHistory.h +++ b/Source/WebCore/inspector/InspectorHistory.h @@ -28,63 +28,53 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef InspectorHistory_h -#define InspectorHistory_h +#pragma once -#include "ExceptionCode.h" - -#include <wtf/OwnPtr.h> +#include "ExceptionOr.h" #include <wtf/Vector.h> -#include <wtf/text/WTFString.h> namespace WebCore { -class ContainerNode; -class Element; -class Node; - -#if ENABLE(INSPECTOR) - -class InspectorHistory { +class InspectorHistory final { WTF_MAKE_NONCOPYABLE(InspectorHistory); WTF_MAKE_FAST_ALLOCATED; public: class Action { WTF_MAKE_FAST_ALLOCATED; public: - Action(const String& name); - virtual ~Action(); - virtual String toString(); + explicit Action(const String& name) + : m_name { name } + { + } + + virtual ~Action() = default; + virtual String toString() { return m_name; } - virtual String mergeId(); - virtual void merge(PassOwnPtr<Action>); + virtual String mergeId() { return emptyString(); } + virtual void merge(std::unique_ptr<Action>) { }; - virtual bool perform(ExceptionCode&) = 0; + virtual ExceptionOr<void> perform() = 0; - virtual bool undo(ExceptionCode&) = 0; - virtual bool redo(ExceptionCode&) = 0; + virtual ExceptionOr<void> undo() = 0; + virtual ExceptionOr<void> redo() = 0; + + virtual bool isUndoableStateMark() { return false; } - virtual bool isUndoableStateMark(); private: String m_name; }; - InspectorHistory(); - virtual ~InspectorHistory(); + InspectorHistory() = default; - bool perform(PassOwnPtr<Action>, ExceptionCode&); + ExceptionOr<void> perform(std::unique_ptr<Action>); void markUndoableState(); - bool undo(ExceptionCode&); - bool redo(ExceptionCode&); + ExceptionOr<void> undo(); + ExceptionOr<void> redo(); void reset(); private: - Vector<OwnPtr<Action>> m_history; - size_t m_afterLastActionIndex; + Vector<std::unique_ptr<Action>> m_history; + size_t m_afterLastActionIndex { 0 }; }; -#endif // ENABLE(INSPECTOR) - } // namespace WebCore - -#endif // !defined(InspectorHistory_h) |