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

Side by Side Diff: Source/core/dom/ContextLifecycleNotifier.h

Issue 17351003: Rename ContextDestructionObserver to ContextLifecycleObserver (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Reapplied Created 7 years, 6 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved.
3 * Copyright (C) 2013 Google Inc. All Rights Reserved. 3 * Copyright (C) 2013 Google Inc. All Rights Reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 20 matching lines...) Expand all
31 #include "wtf/HashSet.h" 31 #include "wtf/HashSet.h"
32 #include "wtf/PassOwnPtr.h" 32 #include "wtf/PassOwnPtr.h"
33 33
34 namespace WTF { 34 namespace WTF {
35 class MemoryObjectInfo; 35 class MemoryObjectInfo;
36 } 36 }
37 37
38 namespace WebCore { 38 namespace WebCore {
39 39
40 class ActiveDOMObject; 40 class ActiveDOMObject;
41 class ContextDestructionObserver; 41 class ContextLifecycleObserver;
42 class ScriptExecutionContext; 42 class ScriptExecutionContext;
43 43
44 class ContextLifecycleNotifier { 44 class ContextLifecycleNotifier {
45 public: 45 public:
46 static PassOwnPtr<ContextLifecycleNotifier> create(ScriptExecutionContext*); 46 static PassOwnPtr<ContextLifecycleNotifier> create(ScriptExecutionContext*);
47 47
48 virtual ~ContextLifecycleNotifier(); 48 virtual ~ContextLifecycleNotifier();
49 49
50 typedef HashSet<ContextDestructionObserver*> ContextObserverSet; 50 typedef HashSet<ContextLifecycleObserver*> ContextObserverSet;
51 typedef HashSet<ActiveDOMObject*> ActiveDOMObjectSet; 51 typedef HashSet<ActiveDOMObject*> ActiveDOMObjectSet;
52 52
53 const ActiveDOMObjectSet& activeDOMObjects() const { return m_activeDOMObjec ts; } 53 const ActiveDOMObjectSet& activeDOMObjects() const { return m_activeDOMObjec ts; }
54 54
55 virtual void addObserver(ContextDestructionObserver*, ContextDestructionObse rver::Type as); 55 virtual void addObserver(ContextLifecycleObserver*, ContextLifecycleObserver ::Type as);
56 virtual void removeObserver(ContextDestructionObserver*, ContextDestructionO bserver::Type as); 56 virtual void removeObserver(ContextLifecycleObserver*, ContextLifecycleObser ver::Type as);
57 57
58 void notifyResumingActiveDOMObjects(); 58 void notifyResumingActiveDOMObjects();
59 void notifySuspendingActiveDOMObjects(ActiveDOMObject::ReasonForSuspension); 59 void notifySuspendingActiveDOMObjects(ActiveDOMObject::ReasonForSuspension);
60 void notifyStoppingActiveDOMObjects(); 60 void notifyStoppingActiveDOMObjects();
61 61
62 bool contains(ActiveDOMObject* object) const { return m_activeDOMObjects.con tains(object); } 62 bool contains(ActiveDOMObject* object) const { return m_activeDOMObjects.con tains(object); }
63 bool canSuspendActiveDOMObjects(); 63 bool canSuspendActiveDOMObjects();
64 bool hasPendingActivity() const; 64 bool hasPendingActivity() const;
65 65
66 void reportMemoryUsage(WTF::MemoryObjectInfo*) const; 66 void reportMemoryUsage(WTF::MemoryObjectInfo*) const;
67 67
68 protected: 68 protected:
69 explicit ContextLifecycleNotifier(ScriptExecutionContext*); 69 explicit ContextLifecycleNotifier(ScriptExecutionContext*);
70 70
71 enum IterationType { 71 enum IterationType {
72 IteratingNone, 72 IteratingNone,
73 IteratingOverActiveDOMObjects, 73 IteratingOverActiveDOMObjects,
74 IteratingOverContextObservers, 74 IteratingOverContextObservers,
75 IteratingOverDocumentObservers 75 IteratingOverDocumentObservers
76 }; 76 };
77 77
78 IterationType m_iterating; 78 IterationType m_iterating;
79 79
80 private: 80 private:
81 ScriptExecutionContext* m_context; 81 ScriptExecutionContext* m_context;
82 ContextObserverSet m_destructionObservers; 82 ContextObserverSet m_contextObservers;
83 ActiveDOMObjectSet m_activeDOMObjects; 83 ActiveDOMObjectSet m_activeDOMObjects;
84 bool m_inDestructor; 84 bool m_inDestructor;
85 }; 85 };
86 86
87 inline PassOwnPtr<ContextLifecycleNotifier> ContextLifecycleNotifier::create(Scr iptExecutionContext* context) 87 inline PassOwnPtr<ContextLifecycleNotifier> ContextLifecycleNotifier::create(Scr iptExecutionContext* context)
88 { 88 {
89 return adoptPtr(new ContextLifecycleNotifier(context)); 89 return adoptPtr(new ContextLifecycleNotifier(context));
90 } 90 }
91 91
92 } // namespace WebCore 92 } // namespace WebCore
93 93
94 #endif // ContextLifecycleNotifier_h 94 #endif // ContextLifecycleNotifier_h
95 95
OLDNEW
« no previous file with comments | « Source/core/dom/ContextDestructionObserver.cpp ('k') | Source/core/dom/ContextLifecycleNotifier.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698