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

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

Issue 298863010: Oilpan: have PendingScripts trace their script elements. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Trace HTMLScriptRunnerHost from HTMLScriptRunner Created 6 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
« no previous file with comments | « Source/core/dom/Document.cpp ('k') | Source/core/dom/PendingScript.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) 2010 Google, Inc. All Rights Reserved. 2 * Copyright (C) 2010 Google, 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 11 matching lines...) Expand all
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */ 24 */
25 25
26 #ifndef PendingScript_h 26 #ifndef PendingScript_h
27 #define PendingScript_h 27 #define PendingScript_h
28 28
29 #include "core/fetch/ResourceClient.h" 29 #include "core/fetch/ResourceClient.h"
30 #include "core/fetch/ResourceOwner.h" 30 #include "core/fetch/ResourceOwner.h"
31 #include "core/fetch/ScriptResource.h" 31 #include "core/fetch/ScriptResource.h"
32 #include "platform/heap/Handle.h"
32 #include "wtf/PassRefPtr.h" 33 #include "wtf/PassRefPtr.h"
33 #include "wtf/RefPtr.h" 34 #include "wtf/RefPtr.h"
34 #include "wtf/text/TextPosition.h" 35 #include "wtf/text/TextPosition.h"
35 36
36 namespace WebCore { 37 namespace WebCore {
37 38
38 class Element; 39 class Element;
39 class ScriptResource; 40 class ScriptResource;
40 41
41 // A container for an external script which may be loaded and executed. 42 // A container for an external script which may be loaded and executed.
42 // 43 //
43 // A ResourcePtr alone does not prevent the underlying Resource 44 // A ResourcePtr alone does not prevent the underlying Resource
44 // from purging its data buffer. This class holds a dummy client open for its 45 // from purging its data buffer. This class holds a dummy client open for its
45 // lifetime in order to guarantee that the data buffer will not be purged. 46 // lifetime in order to guarantee that the data buffer will not be purged.
46 class PendingScript : public ResourceOwner<ScriptResource> { 47 class PendingScript FINAL : public ResourceOwner<ScriptResource> {
48 ALLOW_ONLY_INLINE_ALLOCATION();
47 public: 49 public:
48 PendingScript() 50 PendingScript()
49 : m_watchingForLoad(false) 51 : m_watchingForLoad(false)
50 , m_startingPosition(TextPosition::belowRangePosition()) 52 , m_startingPosition(TextPosition::belowRangePosition())
51 { 53 {
52 } 54 }
53 55
54 PendingScript(Element* element, ScriptResource* resource) 56 PendingScript(Element* element, ScriptResource* resource)
55 : m_watchingForLoad(false) 57 : m_watchingForLoad(false)
56 , m_element(element) 58 , m_element(element)
(...skipping 26 matching lines...) Expand all
83 } 85 }
84 86
85 TextPosition startingPosition() const { return m_startingPosition; } 87 TextPosition startingPosition() const { return m_startingPosition; }
86 void setStartingPosition(const TextPosition& position) { m_startingPosition = position; } 88 void setStartingPosition(const TextPosition& position) { m_startingPosition = position; }
87 89
88 bool watchingForLoad() const { return m_watchingForLoad; } 90 bool watchingForLoad() const { return m_watchingForLoad; }
89 void setWatchingForLoad(bool b) { m_watchingForLoad = b; } 91 void setWatchingForLoad(bool b) { m_watchingForLoad = b; }
90 92
91 Element* element() const { return m_element.get(); } 93 Element* element() const { return m_element.get(); }
92 void setElement(Element* element) { m_element = element; } 94 void setElement(Element* element) { m_element = element; }
93 PassRefPtr<Element> releaseElementAndClear(); 95 PassRefPtrWillBeRawPtr<Element> releaseElementAndClear();
94 96
95 void setScriptResource(ScriptResource*); 97 void setScriptResource(ScriptResource*);
96 98
97 virtual void notifyFinished(Resource*); 99 virtual void notifyFinished(Resource*);
98 100
101 void trace(Visitor*);
102
99 private: 103 private:
100 bool m_watchingForLoad; 104 bool m_watchingForLoad;
101 RefPtr<Element> m_element; 105 RefPtrWillBeMember<Element> m_element;
102 TextPosition m_startingPosition; // Only used for inline script tags. 106 TextPosition m_startingPosition; // Only used for inline script tags.
103 }; 107 };
104 108
105 } 109 }
106 110
107 #endif 111 #endif
OLDNEW
« no previous file with comments | « Source/core/dom/Document.cpp ('k') | Source/core/dom/PendingScript.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698