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 27 matching lines...) Expand all Loading... |
38 return new PendingScript(element, resource); | 38 return new PendingScript(element, resource); |
39 } | 39 } |
40 | 40 |
41 PendingScript::PendingScript(Element* element, ScriptResource* resource) | 41 PendingScript::PendingScript(Element* element, ScriptResource* resource) |
42 : m_watchingForLoad(false), | 42 : m_watchingForLoad(false), |
43 m_element(element), | 43 m_element(element), |
44 m_integrityFailure(false), | 44 m_integrityFailure(false), |
45 m_parserBlockingLoadStartTime(0), | 45 m_parserBlockingLoadStartTime(0), |
46 m_client(nullptr) { | 46 m_client(nullptr) { |
47 setScriptResource(resource); | 47 setScriptResource(resource); |
48 ThreadState::current()->registerPreFinalizer(this); | |
49 MemoryCoordinator::instance().registerClient(this); | 48 MemoryCoordinator::instance().registerClient(this); |
50 } | 49 } |
51 | 50 |
52 PendingScript::~PendingScript() {} | 51 PendingScript::~PendingScript() {} |
53 | 52 |
54 void PendingScript::dispose() { | 53 void PendingScript::dispose() { |
55 stopWatchingForLoad(); | 54 stopWatchingForLoad(); |
56 DCHECK(!m_client); | 55 DCHECK(!m_client); |
57 DCHECK(!m_watchingForLoad); | 56 DCHECK(!m_watchingForLoad); |
58 | 57 |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 void PendingScript::onMemoryStateChange(MemoryState state) { | 219 void PendingScript::onMemoryStateChange(MemoryState state) { |
221 if (state != MemoryState::SUSPENDED) | 220 if (state != MemoryState::SUSPENDED) |
222 return; | 221 return; |
223 if (!m_streamer) | 222 if (!m_streamer) |
224 return; | 223 return; |
225 m_streamer->cancel(); | 224 m_streamer->cancel(); |
226 m_streamer = nullptr; | 225 m_streamer = nullptr; |
227 } | 226 } |
228 | 227 |
229 } // namespace blink | 228 } // namespace blink |
OLD | NEW |