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

Side by Side Diff: third_party/WebKit/Source/core/dom/IncrementLoadEventDelayCount.h

Issue 2837763003: Reland "Move most of FrameLoader::CheckCompleted() to Document" (Closed)
Patch Set: Fix comment typos Created 3 years, 7 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 unified diff | Download patch
OLDNEW
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 <memory> 8 #include <memory>
9 #include "core/CoreExport.h"
9 #include "platform/heap/Handle.h" 10 #include "platform/heap/Handle.h"
10 #include "platform/wtf/Allocator.h" 11 #include "platform/wtf/Allocator.h"
11 #include "platform/wtf/Noncopyable.h" 12 #include "platform/wtf/Noncopyable.h"
12 13
13 namespace blink { 14 namespace blink {
14 15
15 class Document; 16 class Document;
16 17
17 // A helper class that will increment a document's loadEventDelayCount on 18 // A helper class that will increment a document's loadEventDelayCount on
18 // contruction and decrement it on destruction (semantics similar to RefPtr). 19 // contruction and decrement it on destruction (semantics similar to RefPtr).
19 class IncrementLoadEventDelayCount { 20 class CORE_EXPORT IncrementLoadEventDelayCount {
20 USING_FAST_MALLOC(IncrementLoadEventDelayCount); 21 USING_FAST_MALLOC(IncrementLoadEventDelayCount);
21 WTF_MAKE_NONCOPYABLE(IncrementLoadEventDelayCount); 22 WTF_MAKE_NONCOPYABLE(IncrementLoadEventDelayCount);
22 23
23 public: 24 public:
24 static std::unique_ptr<IncrementLoadEventDelayCount> Create(Document&); 25 static std::unique_ptr<IncrementLoadEventDelayCount> Create(Document&);
25 ~IncrementLoadEventDelayCount(); 26 ~IncrementLoadEventDelayCount();
26 27
27 // Decrements the loadEventDelayCount and checks load event synchronously, 28 // Decrements the loadEventDelayCount and checks load event synchronously,
28 // and thus can cause synchronous Document load event/JavaScript execution. 29 // and thus can cause synchronous Document load event/JavaScript execution.
29 // Call this only when it is safe, e.g. at the top of an async task. 30 // Call this only when it is safe, e.g. at the top of an async task.
30 // After calling this, |this| no longer blocks document's load event and 31 // After calling this, |this| no longer blocks document's load event and
31 // will not decrement loadEventDelayCount at destruction. 32 // will not decrement loadEventDelayCount at destruction.
32 void ClearAndCheckLoadEvent(); 33 void ClearAndCheckLoadEvent();
33 34
34 // Increments the new document's count and decrements the old count. 35 // Increments the new document's count and decrements the old count.
35 void DocumentChanged(Document& new_document); 36 void DocumentChanged(Document& new_document);
36 37
37 private: 38 private:
38 IncrementLoadEventDelayCount(Document&); 39 IncrementLoadEventDelayCount(Document&);
39 Persistent<Document> document_; 40 Persistent<Document> document_;
40 }; 41 };
41 } // namespace blink 42 } // namespace blink
42 43
43 #endif 44 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698