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
3 // found in the LICENSE file.
5 #ifndef IncrementLoadEventDelayCount_h
6 #define IncrementLoadEventDelayCount_h
8 #include "platform/heap/Handle.h"
9 #include "wtf/Allocator.h"
10 #include "wtf/Noncopyable.h"
11 #include "wtf/RefPtr.h"
17 // A helper class that will increment a document's loadEventDelayCount on
18 // contruction and decrement it on destruction (semantics similar to RefPtr).
19 class IncrementLoadEventDelayCount
{
20 WTF_MAKE_FAST_ALLOCATED(IncrementLoadEventDelayCount
);
21 WTF_MAKE_NONCOPYABLE(IncrementLoadEventDelayCount
);
24 static PassOwnPtr
<IncrementLoadEventDelayCount
> create(Document
&);
25 ~IncrementLoadEventDelayCount();
27 // Increments the new document's count and decrements the old count.
28 void documentChanged(Document
& newDocument
);
31 IncrementLoadEventDelayCount(Document
&);
32 RefPtrWillBePersistent
<Document
> m_document
;