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

Unified Diff: third_party/WebKit/Source/core/dom/ThrowOnDynamicMarkupInsertionCountIncrementer.h

Issue 2369853002: HTML parser: implementing throw-on-dynamic-markup-insertion counter (Closed)
Patch Set: copyright comment update Created 4 years, 3 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: third_party/WebKit/Source/core/dom/ThrowOnDynamicMarkupInsertionCountIncrementer.h
diff --git a/third_party/WebKit/Source/core/dom/ThrowOnDynamicMarkupInsertionCountIncrementer.h b/third_party/WebKit/Source/core/dom/ThrowOnDynamicMarkupInsertionCountIncrementer.h
new file mode 100644
index 0000000000000000000000000000000000000000..7d9df82f1c1b443c30cf747c2d969089c42a6440
--- /dev/null
+++ b/third_party/WebKit/Source/core/dom/ThrowOnDynamicMarkupInsertionCountIncrementer.h
@@ -0,0 +1,38 @@
+// Copyright 2016 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 ThrowOnDynamicMarkupInsertionCountIncrementer_h
+#define ThrowOnDynamicMarkupInsertionCountIncrementer_h
+
+#include "core/dom/Document.h"
+#include "wtf/Allocator.h"
+
+namespace blink {
+
+class ThrowOnDynamicMarkupInsertionCountIncrementer {
+ STACK_ALLOCATED();
+ WTF_MAKE_NONCOPYABLE(ThrowOnDynamicMarkupInsertionCountIncrementer);
+public:
+ explicit ThrowOnDynamicMarkupInsertionCountIncrementer(Document* document)
+ : m_count(document ? &document->m_throwOnDynamicMarkupInsertionCount : 0)
+ {
+ if (!m_count)
+ return;
+ ++(*m_count);
+ }
+
+ ~ThrowOnDynamicMarkupInsertionCountIncrementer()
+ {
+ if (!m_count)
+ return;
+ --(*m_count);
+ }
+
+private:
+ unsigned* m_count;
+};
+
+} // namespace blink
+
+#endif
« no previous file with comments | « third_party/WebKit/Source/core/dom/Document.cpp ('k') | third_party/WebKit/Source/core/html/parser/HTMLConstructionSite.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698