Index: Source/core/dom/IncrementLoadEventDelayCount.h |
diff --git a/Source/core/dom/IncrementLoadEventDelayCount.h b/Source/core/dom/IncrementLoadEventDelayCount.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..d588de22a6181a920dbe918b2c8f59de97c1ef8c |
--- /dev/null |
+++ b/Source/core/dom/IncrementLoadEventDelayCount.h |
@@ -0,0 +1,32 @@ |
+// 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 IncrementLoadEventDelayCount_h |
+#define IncrementLoadEventDelayCount_h |
+ |
+#include "wtf/Noncopyable.h" |
+#include "wtf/RefPtr.h" |
+ |
+namespace WebCore { |
+ |
+class Document; |
+ |
+// A helper class that will increment a document's loadEventDelayCount on |
+// contruction and decrement it on destruction (semantics similar to RefPtr). |
+class IncrementLoadEventDelayCount { |
+ WTF_MAKE_NONCOPYABLE(IncrementLoadEventDelayCount); |
+ |
+public: |
+ IncrementLoadEventDelayCount(Document&); |
+ ~IncrementLoadEventDelayCount(); |
+ |
+ // Increments the new document's count and decrements the old count. |
+ void documentChanged(Document& newDocument); |
+ |
+private: |
+ RefPtr<Document> m_document; |
+}; |
+} |
+ |
+#endif |