| 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 30 matching lines...) Expand all Loading... |
| 41 void HTMLImportsController::provideTo(Document* master) | 41 void HTMLImportsController::provideTo(Document* master) |
| 42 { | 42 { |
| 43 DEFINE_STATIC_LOCAL(const char*, name, ("HTMLImportsController")); | 43 DEFINE_STATIC_LOCAL(const char*, name, ("HTMLImportsController")); |
| 44 OwnPtr<HTMLImportsController> controller = adoptPtr(new HTMLImportsControlle
r(master)); | 44 OwnPtr<HTMLImportsController> controller = adoptPtr(new HTMLImportsControlle
r(master)); |
| 45 master->setImport(controller.get()); | 45 master->setImport(controller.get()); |
| 46 DocumentSupplement::provideTo(master, name, controller.release()); | 46 DocumentSupplement::provideTo(master, name, controller.release()); |
| 47 } | 47 } |
| 48 | 48 |
| 49 HTMLImportsController::HTMLImportsController(Document* master) | 49 HTMLImportsController::HTMLImportsController(Document* master) |
| 50 : m_master(master) | 50 : m_master(master) |
| 51 , m_unblockTimer(this, &HTMLImportsController::unblockTimerFired) | 51 , m_recalcTimer(this, &HTMLImportsController::recalcTimerFired) |
| 52 { | 52 { |
| 53 recalcTreeState(this); // This recomputes initial state. |
| 53 } | 54 } |
| 54 | 55 |
| 55 HTMLImportsController::~HTMLImportsController() | 56 HTMLImportsController::~HTMLImportsController() |
| 56 { | 57 { |
| 57 ASSERT(!m_master); | 58 ASSERT(!m_master); |
| 58 } | 59 } |
| 59 | 60 |
| 60 void HTMLImportsController::clear() | 61 void HTMLImportsController::clear() |
| 61 { | 62 { |
| 62 for (size_t i = 0; i < m_imports.size(); ++i) | 63 for (size_t i = 0; i < m_imports.size(); ++i) |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 | 101 |
| 101 void HTMLImportsController::showSecurityErrorMessage(const String& message) | 102 void HTMLImportsController::showSecurityErrorMessage(const String& message) |
| 102 { | 103 { |
| 103 m_master->addConsoleMessage(JSMessageSource, ErrorMessageLevel, message); | 104 m_master->addConsoleMessage(JSMessageSource, ErrorMessageLevel, message); |
| 104 } | 105 } |
| 105 | 106 |
| 106 HTMLImportChild* HTMLImportsController::findLinkFor(const KURL& url, HTMLImport*
excluding) const | 107 HTMLImportChild* HTMLImportsController::findLinkFor(const KURL& url, HTMLImport*
excluding) const |
| 107 { | 108 { |
| 108 for (size_t i = 0; i < m_imports.size(); ++i) { | 109 for (size_t i = 0; i < m_imports.size(); ++i) { |
| 109 HTMLImportChild* candidate = m_imports[i].get(); | 110 HTMLImportChild* candidate = m_imports[i].get(); |
| 110 if (candidate != excluding && equalIgnoringFragmentIdentifier(candidate-
>url(), url) && !candidate->isBlockedFromCreatingDocument()) | 111 if (candidate != excluding && equalIgnoringFragmentIdentifier(candidate-
>url(), url) && candidate->hasLoader()) |
| 111 return candidate; | 112 return candidate; |
| 112 } | 113 } |
| 113 | 114 |
| 114 return 0; | 115 return 0; |
| 115 } | 116 } |
| 116 | 117 |
| 117 SecurityOrigin* HTMLImportsController::securityOrigin() const | 118 SecurityOrigin* HTMLImportsController::securityOrigin() const |
| 118 { | 119 { |
| 119 return m_master->securityOrigin(); | 120 return m_master->securityOrigin(); |
| 120 } | 121 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 132 Document* HTMLImportsController::document() const | 133 Document* HTMLImportsController::document() const |
| 133 { | 134 { |
| 134 return m_master; | 135 return m_master; |
| 135 } | 136 } |
| 136 | 137 |
| 137 void HTMLImportsController::wasDetachedFromDocument() | 138 void HTMLImportsController::wasDetachedFromDocument() |
| 138 { | 139 { |
| 139 clear(); | 140 clear(); |
| 140 } | 141 } |
| 141 | 142 |
| 142 void HTMLImportsController::didFinishParsing() | |
| 143 { | |
| 144 } | |
| 145 | |
| 146 bool HTMLImportsController::hasLoader() const | 143 bool HTMLImportsController::hasLoader() const |
| 147 { | 144 { |
| 148 return true; | 145 return true; |
| 149 } | 146 } |
| 150 | 147 |
| 151 bool HTMLImportsController::isDone() const | 148 bool HTMLImportsController::isDone() const |
| 152 { | 149 { |
| 153 return !m_master->parsing(); | 150 return !m_master->parsing(); |
| 154 } | 151 } |
| 155 | 152 |
| 156 void HTMLImportsController::blockerGone() | 153 void HTMLImportsController::scheduleRecalcState() |
| 157 { | 154 { |
| 158 scheduleUnblock(); | 155 if (m_recalcTimer.isActive()) |
| 156 return; |
| 157 m_recalcTimer.startOneShot(0); |
| 159 } | 158 } |
| 160 | 159 |
| 161 void HTMLImportsController::scheduleUnblock() | 160 void HTMLImportsController::recalcTimerFired(Timer<HTMLImportsController>*) |
| 162 { | |
| 163 if (m_unblockTimer.isActive()) | |
| 164 return; | |
| 165 m_unblockTimer.startOneShot(0); | |
| 166 } | |
| 167 | |
| 168 void HTMLImportsController::unblockTimerFired(Timer<HTMLImportsController>*) | |
| 169 { | 161 { |
| 170 do { | 162 do { |
| 171 m_unblockTimer.stop(); | 163 m_recalcTimer.stop(); |
| 172 HTMLImport::unblock(this); | 164 HTMLImport::recalcTreeState(this); |
| 173 } while (m_unblockTimer.isActive()); | 165 } while (m_recalcTimer.isActive()); |
| 174 } | 166 } |
| 175 | 167 |
| 176 } // namespace WebCore | 168 } // namespace WebCore |
| OLD | NEW |