| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef ThrowOnDynamicMarkupInsertionCountIncrementer_h |
| 6 #define ThrowOnDynamicMarkupInsertionCountIncrementer_h |
| 7 |
| 8 #include "core/dom/Document.h" |
| 9 #include "wtf/Allocator.h" |
| 10 |
| 11 namespace blink { |
| 12 |
| 13 class ThrowOnDynamicMarkupInsertionCountIncrementer { |
| 14 STACK_ALLOCATED(); |
| 15 WTF_MAKE_NONCOPYABLE(ThrowOnDynamicMarkupInsertionCountIncrementer); |
| 16 public: |
| 17 explicit ThrowOnDynamicMarkupInsertionCountIncrementer(Document* document) |
| 18 : m_count(document ? &document->m_throwOnDynamicMarkupInsertionCount : 0
) |
| 19 { |
| 20 if (!m_count) |
| 21 return; |
| 22 ++(*m_count); |
| 23 } |
| 24 |
| 25 ~ThrowOnDynamicMarkupInsertionCountIncrementer() |
| 26 { |
| 27 if (!m_count) |
| 28 return; |
| 29 --(*m_count); |
| 30 } |
| 31 |
| 32 private: |
| 33 unsigned* m_count; |
| 34 }; |
| 35 |
| 36 } // namespace blink |
| 37 |
| 38 #endif |
| OLD | NEW |