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

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

Issue 1569273004: Move ResourceOwner on to the oilpan heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
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 16 matching lines...) Expand all
27 27
28 #include "bindings/core/v8/ScriptSourceCode.h" 28 #include "bindings/core/v8/ScriptSourceCode.h"
29 #include "bindings/core/v8/ScriptStreamer.h" 29 #include "bindings/core/v8/ScriptStreamer.h"
30 #include "core/dom/Element.h" 30 #include "core/dom/Element.h"
31 #include "core/fetch/ScriptResource.h" 31 #include "core/fetch/ScriptResource.h"
32 #include "core/frame/SubresourceIntegrity.h" 32 #include "core/frame/SubresourceIntegrity.h"
33 #include "platform/SharedBuffer.h" 33 #include "platform/SharedBuffer.h"
34 34
35 namespace blink { 35 namespace blink {
36 36
37 PendingScript::PendingScript()
38 : m_watchingForLoad(false)
39 , m_startingPosition(TextPosition::belowRangePosition())
40 , m_integrityFailure(false)
41 {
42 }
43
44 PendingScript::PendingScript(Element* element, ScriptResource* resource) 37 PendingScript::PendingScript(Element* element, ScriptResource* resource)
45 : m_watchingForLoad(false) 38 : m_watchingForLoad(false)
46 , m_element(element) 39 , m_element(element)
47 , m_integrityFailure(false) 40 , m_integrityFailure(false)
48 { 41 {
49 setScriptResource(resource); 42 setScriptResource(resource);
50 } 43 }
51 44
52 PendingScript::PendingScript(const PendingScript& other)
53 : ResourceOwner(other)
54 , m_watchingForLoad(other.m_watchingForLoad)
55 , m_element(other.m_element)
56 , m_startingPosition(other.m_startingPosition)
57 , m_integrityFailure(other.m_integrityFailure)
58 , m_streamer(other.m_streamer)
59 {
60 setScriptResource(other.resource());
61 }
62
63 PendingScript::~PendingScript() 45 PendingScript::~PendingScript()
64 { 46 {
65 } 47 }
66 48
67 PendingScript& PendingScript::operator=(const PendingScript& other) 49 PendingScript& PendingScript::operator=(const PendingScript& other)
68 { 50 {
69 if (this == &other) 51 if (this == &other)
70 return *this; 52 return *this;
71 53
72 m_watchingForLoad = other.m_watchingForLoad; 54 m_watchingForLoad = other.m_watchingForLoad;
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 159
178 void PendingScript::notifyAppendData(ScriptResource* resource) 160 void PendingScript::notifyAppendData(ScriptResource* resource)
179 { 161 {
180 if (m_streamer) 162 if (m_streamer)
181 m_streamer->notifyAppendData(resource); 163 m_streamer->notifyAppendData(resource);
182 } 164 }
183 165
184 DEFINE_TRACE(PendingScript) 166 DEFINE_TRACE(PendingScript)
185 { 167 {
186 visitor->trace(m_element); 168 visitor->trace(m_element);
187 visitor->trace(m_streamer); 169 visitor->trace(m_streamer);
yhirano 2016/01/14 11:55:29 + ResourceOwner<ScriptResource>::trace(visitor);
Nate Chapin 2016/01/14 22:54:01 Done.
188 } 170 }
189 171
190 ScriptSourceCode PendingScript::getSource(const KURL& documentURL, bool& errorOc curred) const 172 ScriptSourceCode PendingScript::getSource(const KURL& documentURL, bool& errorOc curred) const
191 { 173 {
192 if (resource()) { 174 if (resource()) {
193 errorOccurred = resource()->errorOccurred() || m_integrityFailure; 175 errorOccurred = resource()->errorOccurred() || m_integrityFailure;
194 ASSERT(resource()->isLoaded()); 176 ASSERT(resource()->isLoaded());
195 if (m_streamer && !m_streamer->streamingSuppressed()) 177 if (m_streamer && !m_streamer->streamingSuppressed())
196 return ScriptSourceCode(m_streamer, resource()); 178 return ScriptSourceCode(m_streamer, resource());
197 return ScriptSourceCode(resource()); 179 return ScriptSourceCode(resource());
(...skipping 12 matching lines...) Expand all
210 bool PendingScript::isReady() const 192 bool PendingScript::isReady() const
211 { 193 {
212 if (resource() && !resource()->isLoaded()) 194 if (resource() && !resource()->isLoaded())
213 return false; 195 return false;
214 if (m_streamer && !m_streamer->isFinished()) 196 if (m_streamer && !m_streamer->isFinished())
215 return false; 197 return false;
216 return true; 198 return true;
217 } 199 }
218 200
219 } 201 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698