OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 ASSERT(!m_master); | 59 ASSERT(!m_master); |
60 } | 60 } |
61 | 61 |
62 void HTMLImportsController::clear() | 62 void HTMLImportsController::clear() |
63 { | 63 { |
64 for (size_t i = 0; i < m_imports.size(); ++i) | 64 for (size_t i = 0; i < m_imports.size(); ++i) |
65 m_imports[i]->importDestroyed(); | 65 m_imports[i]->importDestroyed(); |
66 if (m_master) | 66 if (m_master) |
67 m_master->setImport(0); | 67 m_master->setImport(0); |
68 m_master = 0; | 68 m_master = 0; |
| 69 m_recalcTimer.stop(); |
69 } | 70 } |
70 | 71 |
71 HTMLImportChild* HTMLImportsController::createChild(const KURL& url, HTMLImport*
parent, HTMLImportChildClient* client) | 72 HTMLImportChild* HTMLImportsController::createChild(const KURL& url, HTMLImport*
parent, HTMLImportChildClient* client) |
72 { | 73 { |
73 OwnPtr<HTMLImportChild> loader = adoptPtr(new HTMLImportChild(*m_master, url
, client->isSync())); | 74 OwnPtr<HTMLImportChild> loader = adoptPtr(new HTMLImportChild(*m_master, url
, client->isSync())); |
74 loader->setClient(client); | 75 loader->setClient(client); |
75 parent->appendChild(loader.get()); | 76 parent->appendChild(loader.get()); |
76 m_imports.append(loader.release()); | 77 m_imports.append(loader.release()); |
77 return m_imports.last().get(); | 78 return m_imports.last().get(); |
78 } | 79 } |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 HTMLImport::stateDidChange(); | 160 HTMLImport::stateDidChange(); |
160 | 161 |
161 if (!state().isReady()) | 162 if (!state().isReady()) |
162 return; | 163 return; |
163 if (LocalFrame* frame = m_master->frame()) | 164 if (LocalFrame* frame = m_master->frame()) |
164 frame->loader().checkCompleted(); | 165 frame->loader().checkCompleted(); |
165 } | 166 } |
166 | 167 |
167 void HTMLImportsController::scheduleRecalcState() | 168 void HTMLImportsController::scheduleRecalcState() |
168 { | 169 { |
169 if (m_recalcTimer.isActive()) | 170 if (m_recalcTimer.isActive() || !m_master) |
170 return; | 171 return; |
171 m_recalcTimer.startOneShot(0, FROM_HERE); | 172 m_recalcTimer.startOneShot(0, FROM_HERE); |
172 } | 173 } |
173 | 174 |
174 void HTMLImportsController::recalcTimerFired(Timer<HTMLImportsController>*) | 175 void HTMLImportsController::recalcTimerFired(Timer<HTMLImportsController>*) |
175 { | 176 { |
| 177 ASSERT(m_master); |
| 178 |
176 do { | 179 do { |
177 m_recalcTimer.stop(); | 180 m_recalcTimer.stop(); |
178 HTMLImport::recalcTreeState(this); | 181 HTMLImport::recalcTreeState(this); |
179 } while (m_recalcTimer.isActive()); | 182 } while (m_recalcTimer.isActive()); |
180 } | 183 } |
181 | 184 |
182 } // namespace WebCore | 185 } // namespace WebCore |
OLD | NEW |