summaryrefslogtreecommitdiff
path: root/Source/WebCore/inspector/InspectorHistory.h
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2017-06-27 06:07:23 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2017-06-27 06:07:23 +0000
commit1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch)
tree46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/WebCore/inspector/InspectorHistory.h
parent32761a6cee1d0dee366b885b7b9c777e67885688 (diff)
downloadWebKitGtk-tarball-master.tar.gz
Diffstat (limited to 'Source/WebCore/inspector/InspectorHistory.h')
-rw-r--r--Source/WebCore/inspector/InspectorHistory.h56
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)