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

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

Issue 401603003: Remove ActiveDOMObject::{,un}setPendingActivity (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebased Created 6 years, 5 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
« no previous file with comments | « Source/core/css/FontFaceSet.cpp ('k') | Source/core/dom/ActiveDOMObject.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 27 matching lines...) Expand all
38 38
39 // suspendIfNeeded() should be called exactly once after object construction to synchronize 39 // suspendIfNeeded() should be called exactly once after object construction to synchronize
40 // the suspend state with that in ExecutionContext. 40 // the suspend state with that in ExecutionContext.
41 void suspendIfNeeded(); 41 void suspendIfNeeded();
42 #if ENABLE(ASSERT) 42 #if ENABLE(ASSERT)
43 bool suspendIfNeededCalled() const { return m_suspendIfNeededCalled; } 43 bool suspendIfNeededCalled() const { return m_suspendIfNeededCalled; }
44 #endif 44 #endif
45 45
46 // Should return true if there's any pending asynchronous activity, and so 46 // Should return true if there's any pending asynchronous activity, and so
47 // this object must not be garbage collected. 47 // this object must not be garbage collected.
48 //
49 // Default implementation is that it returns true iff
50 // m_pendingActivityCount is non-zero.
51 virtual bool hasPendingActivity() const; 48 virtual bool hasPendingActivity() const;
52 49
53 // These methods have an empty default implementation so that subclasses 50 // These methods have an empty default implementation so that subclasses
54 // which don't need special treatment can skip implementation. 51 // which don't need special treatment can skip implementation.
55 virtual void suspend(); 52 virtual void suspend();
56 virtual void resume(); 53 virtual void resume();
57 virtual void stop(); 54 virtual void stop();
58 55
59 void didMoveToNewExecutionContext(ExecutionContext*); 56 void didMoveToNewExecutionContext(ExecutionContext*);
60 57
61 protected: 58 protected:
62 virtual ~ActiveDOMObject(); 59 virtual ~ActiveDOMObject();
63 60
64 template<class T> void setPendingActivity(T* thisObject)
65 {
66 ASSERT(thisObject == this);
67 thisObject->ref();
68 m_pendingActivityCount++;
69 }
70
71 template<class T> void unsetPendingActivity(T* thisObject)
72 {
73 ASSERT(m_pendingActivityCount > 0);
74 --m_pendingActivityCount;
75 thisObject->deref();
76 }
77
78 private: 61 private:
79 unsigned m_pendingActivityCount;
80 #if ENABLE(ASSERT) 62 #if ENABLE(ASSERT)
81 bool m_suspendIfNeededCalled; 63 bool m_suspendIfNeededCalled;
82 #endif 64 #endif
83 }; 65 };
84 66
85 } // namespace WebCore 67 } // namespace WebCore
86 68
87 #endif // ActiveDOMObject_h 69 #endif // ActiveDOMObject_h
OLDNEW
« no previous file with comments | « Source/core/css/FontFaceSet.cpp ('k') | Source/core/dom/ActiveDOMObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698