| OLD | NEW |
| 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 30 matching lines...) Expand all Loading... |
| 41 | 41 |
| 42 PendingScript::PendingScript(Element* element, ScriptResource* resource) | 42 PendingScript::PendingScript(Element* element, ScriptResource* resource) |
| 43 : m_watchingForLoad(false) | 43 : m_watchingForLoad(false) |
| 44 , m_element(element) | 44 , m_element(element) |
| 45 , m_integrityFailure(false) | 45 , m_integrityFailure(false) |
| 46 , m_parserBlockingLoadStartTime(0) | 46 , m_parserBlockingLoadStartTime(0) |
| 47 , m_client(nullptr) | 47 , m_client(nullptr) |
| 48 { | 48 { |
| 49 setScriptResource(resource); | 49 setScriptResource(resource); |
| 50 ThreadState::current()->registerPreFinalizer(this); | 50 ThreadState::current()->registerPreFinalizer(this); |
| 51 MemoryCoordinator::instance().registerClient(this); |
| 51 } | 52 } |
| 52 | 53 |
| 53 PendingScript::~PendingScript() | 54 PendingScript::~PendingScript() |
| 54 { | 55 { |
| 55 } | 56 } |
| 56 | 57 |
| 57 void PendingScript::dispose() | 58 void PendingScript::dispose() |
| 58 { | 59 { |
| 59 if (!m_client) | 60 if (!m_client) |
| 60 return; | 61 return; |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 if (m_streamer) | 181 if (m_streamer) |
| 181 m_streamer->notifyAppendData(resource); | 182 m_streamer->notifyAppendData(resource); |
| 182 } | 183 } |
| 183 | 184 |
| 184 DEFINE_TRACE(PendingScript) | 185 DEFINE_TRACE(PendingScript) |
| 185 { | 186 { |
| 186 visitor->trace(m_element); | 187 visitor->trace(m_element); |
| 187 visitor->trace(m_streamer); | 188 visitor->trace(m_streamer); |
| 188 visitor->trace(m_client); | 189 visitor->trace(m_client); |
| 189 ResourceOwner<ScriptResource>::trace(visitor); | 190 ResourceOwner<ScriptResource>::trace(visitor); |
| 191 MemoryCoordinatorClient::trace(visitor); |
| 190 } | 192 } |
| 191 | 193 |
| 192 ScriptSourceCode PendingScript::getSource(const KURL& documentURL, bool& errorOc
curred) const | 194 ScriptSourceCode PendingScript::getSource(const KURL& documentURL, bool& errorOc
curred) const |
| 193 { | 195 { |
| 194 if (resource()) { | 196 if (resource()) { |
| 195 errorOccurred = resource()->errorOccurred() || m_integrityFailure; | 197 errorOccurred = resource()->errorOccurred() || m_integrityFailure; |
| 196 DCHECK(resource()->isLoaded()); | 198 DCHECK(resource()->isLoaded()); |
| 197 if (m_streamer && !m_streamer->streamingSuppressed()) | 199 if (m_streamer && !m_streamer->streamingSuppressed()) |
| 198 return ScriptSourceCode(m_streamer, resource()); | 200 return ScriptSourceCode(m_streamer, resource()); |
| 199 return ScriptSourceCode(resource()); | 201 return ScriptSourceCode(resource()); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 220 | 222 |
| 221 bool PendingScript::errorOccurred() const | 223 bool PendingScript::errorOccurred() const |
| 222 { | 224 { |
| 223 if (resource()) | 225 if (resource()) |
| 224 return resource()->errorOccurred(); | 226 return resource()->errorOccurred(); |
| 225 if (m_streamer && m_streamer->resource()) | 227 if (m_streamer && m_streamer->resource()) |
| 226 return m_streamer->resource()->errorOccurred(); | 228 return m_streamer->resource()->errorOccurred(); |
| 227 return false; | 229 return false; |
| 228 } | 230 } |
| 229 | 231 |
| 232 void PendingScript::prepareToSuspend() |
| 233 { |
| 234 if (!m_streamer) |
| 235 return; |
| 236 m_streamer->cancel(); |
| 237 } |
| 238 |
| 230 } // namespace blink | 239 } // namespace blink |
| OLD | NEW |