OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef IncrementLoadEventDelayCount_h | 5 #ifndef IncrementLoadEventDelayCount_h |
6 #define IncrementLoadEventDelayCount_h | 6 #define IncrementLoadEventDelayCount_h |
7 | 7 |
8 #include "platform/heap/Handle.h" | 8 #include "platform/heap/Handle.h" |
| 9 #include "wtf/Allocator.h" |
9 #include "wtf/Noncopyable.h" | 10 #include "wtf/Noncopyable.h" |
10 #include "wtf/RefPtr.h" | 11 #include "wtf/RefPtr.h" |
11 | 12 |
12 namespace blink { | 13 namespace blink { |
13 | 14 |
14 class Document; | 15 class Document; |
15 | 16 |
16 // A helper class that will increment a document's loadEventDelayCount on | 17 // A helper class that will increment a document's loadEventDelayCount on |
17 // contruction and decrement it on destruction (semantics similar to RefPtr). | 18 // contruction and decrement it on destruction (semantics similar to RefPtr). |
18 class IncrementLoadEventDelayCount { | 19 class IncrementLoadEventDelayCount { |
| 20 WTF_MAKE_FAST_ALLOCATED(IncrementLoadEventDelayCount); |
19 WTF_MAKE_NONCOPYABLE(IncrementLoadEventDelayCount); | 21 WTF_MAKE_NONCOPYABLE(IncrementLoadEventDelayCount); |
20 | 22 |
21 public: | 23 public: |
22 static PassOwnPtr<IncrementLoadEventDelayCount> create(Document&); | 24 static PassOwnPtr<IncrementLoadEventDelayCount> create(Document&); |
23 ~IncrementLoadEventDelayCount(); | 25 ~IncrementLoadEventDelayCount(); |
24 | 26 |
25 // Increments the new document's count and decrements the old count. | 27 // Increments the new document's count and decrements the old count. |
26 void documentChanged(Document& newDocument); | 28 void documentChanged(Document& newDocument); |
27 | 29 |
28 private: | 30 private: |
29 IncrementLoadEventDelayCount(Document&); | 31 IncrementLoadEventDelayCount(Document&); |
30 RefPtrWillBePersistent<Document> m_document; | 32 RefPtrWillBePersistent<Document> m_document; |
31 }; | 33 }; |
32 } | 34 } |
33 | 35 |
34 #endif | 36 #endif |
OLD | NEW |