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

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

Issue 847803002: Make ScriptStreamer and dependents Oilpan friendly. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Add ScriptSourceCode::isNull() comment Created 5 years, 11 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/dom/PendingScript.h ('k') | Source/core/frame/DOMTimer.h » ('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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 return; 95 return;
96 ASSERT(resource()); 96 ASSERT(resource());
97 if (m_streamer) { 97 if (m_streamer) {
98 m_streamer->removeClient(client); 98 m_streamer->removeClient(client);
99 } else { 99 } else {
100 resource()->removeClient(client); 100 resource()->removeClient(client);
101 } 101 }
102 m_watchingForLoad = false; 102 m_watchingForLoad = false;
103 } 103 }
104 104
105 void PendingScript::setElement(Element* element)
106 {
107 m_element = element;
108 }
109
105 PassRefPtrWillBeRawPtr<Element> PendingScript::releaseElementAndClear() 110 PassRefPtrWillBeRawPtr<Element> PendingScript::releaseElementAndClear()
106 { 111 {
107 setScriptResource(0); 112 setScriptResource(0);
108 m_watchingForLoad = false; 113 m_watchingForLoad = false;
109 m_startingPosition = TextPosition::belowRangePosition(); 114 m_startingPosition = TextPosition::belowRangePosition();
110 if (m_streamer) 115 if (m_streamer)
111 m_streamer->cancel(); 116 m_streamer->cancel();
112 m_streamer.release(); 117 m_streamer.release();
113 return m_element.release(); 118 return m_element.release();
114 } 119 }
(...skipping 11 matching lines...) Expand all
126 131
127 void PendingScript::notifyAppendData(ScriptResource* resource) 132 void PendingScript::notifyAppendData(ScriptResource* resource)
128 { 133 {
129 if (m_streamer) 134 if (m_streamer)
130 m_streamer->notifyAppendData(resource); 135 m_streamer->notifyAppendData(resource);
131 } 136 }
132 137
133 void PendingScript::trace(Visitor* visitor) 138 void PendingScript::trace(Visitor* visitor)
134 { 139 {
135 visitor->trace(m_element); 140 visitor->trace(m_element);
141 visitor->trace(m_streamer);
136 } 142 }
137 143
138 ScriptSourceCode PendingScript::getSource(const KURL& documentURL, bool& errorOc curred) const 144 ScriptSourceCode PendingScript::getSource(const KURL& documentURL, bool& errorOc curred) const
139 { 145 {
140 if (resource()) { 146 if (resource()) {
141 errorOccurred = resource()->errorOccurred(); 147 errorOccurred = resource()->errorOccurred();
142 ASSERT(resource()->isLoaded()); 148 ASSERT(resource()->isLoaded());
143 if (m_streamer && !m_streamer->streamingSuppressed()) 149 if (m_streamer && !m_streamer->streamingSuppressed())
144 return ScriptSourceCode(m_streamer, resource()); 150 return ScriptSourceCode(m_streamer, resource());
145 return ScriptSourceCode(resource()); 151 return ScriptSourceCode(resource());
146 } 152 }
147 errorOccurred = false; 153 errorOccurred = false;
148 return ScriptSourceCode(m_element->textContent(), documentURL, startingPosit ion()); 154 return ScriptSourceCode(m_element->textContent(), documentURL, startingPosit ion());
149 } 155 }
150 156
151 void PendingScript::setStreamer(PassRefPtr<ScriptStreamer> streamer) 157 void PendingScript::setStreamer(PassRefPtrWillBeRawPtr<ScriptStreamer> streamer)
152 { 158 {
153 ASSERT(!m_streamer); 159 ASSERT(!m_streamer);
154 ASSERT(!m_watchingForLoad); 160 ASSERT(!m_watchingForLoad);
155 m_streamer = streamer; 161 m_streamer = streamer;
156 } 162 }
157 163
158 bool PendingScript::isReady() const 164 bool PendingScript::isReady() const
159 { 165 {
160 if (resource() && !resource()->isLoaded()) 166 if (resource() && !resource()->isLoaded())
161 return false; 167 return false;
162 if (m_streamer && !m_streamer->isFinished()) 168 if (m_streamer && !m_streamer->isFinished())
163 return false; 169 return false;
164 return true; 170 return true;
165 } 171 }
166 172
167 } 173 }
OLDNEW
« no previous file with comments | « Source/core/dom/PendingScript.h ('k') | Source/core/frame/DOMTimer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698