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

Unified Diff: Source/core/html/imports/HTMLImportLoader.cpp

Issue 211663002: Refactoring: Get rid of HTMLImportLoaerClient (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fixed typo and bad grammar Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/html/imports/HTMLImportLoader.h ('k') | Source/core/html/imports/HTMLImportLoaderClient.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/imports/HTMLImportLoader.cpp
diff --git a/Source/core/html/imports/HTMLImportLoader.cpp b/Source/core/html/imports/HTMLImportLoader.cpp
index d7457213f924436d036c8bad13dd7240d34c1a8a..65a5f01a4afc665203096601eb378c2a27302bb9 100644
--- a/Source/core/html/imports/HTMLImportLoader.cpp
+++ b/Source/core/html/imports/HTMLImportLoader.cpp
@@ -35,16 +35,15 @@
#include "core/dom/StyleEngine.h"
#include "core/html/HTMLDocument.h"
#include "core/html/imports/HTMLImport.h"
-#include "core/html/imports/HTMLImportLoaderClient.h"
+#include "core/html/imports/HTMLImportChild.h"
#include "core/loader/DocumentWriter.h"
#include "platform/network/ContentSecurityPolicyResponseHeaders.h"
namespace WebCore {
-HTMLImportLoader::HTMLImportLoader(HTMLImport* import)
- : m_import(import)
- , m_state(StateLoading)
+HTMLImportLoader::HTMLImportLoader()
+ : m_state(StateLoading)
{
}
@@ -90,8 +89,10 @@ void HTMLImportLoader::notifyFinished(Resource* resource)
HTMLImportLoader::State HTMLImportLoader::startWritingAndParsing(const ResourceResponse& response)
{
- DocumentInit init = DocumentInit(response.url(), 0, m_import->master()->contextDocument(), m_import)
- .withRegistrationContext(m_import->master()->registrationContext());
+ ASSERT(!m_imports.isEmpty());
+ HTMLImport* firstImport = m_imports[0];
+ DocumentInit init = DocumentInit(response.url(), 0, firstImport->master()->contextDocument(), firstImport)
+ .withRegistrationContext(firstImport->master()->registrationContext());
m_importedDocument = HTMLDocument::create(init);
m_writer = DocumentWriter::create(m_importedDocument.get(), response.mimeType(), response.textEncodingName());
@@ -157,26 +158,26 @@ Document* HTMLImportLoader::importedDocument() const
void HTMLImportLoader::didFinishLoading()
{
- for (size_t i = 0; i < m_clients.size(); ++i)
- m_clients[i]->didFinishLoading();
+ for (size_t i = 0; i < m_imports.size(); ++i)
+ m_imports[i]->didFinishLoading();
clearResource();
ASSERT(!m_importedDocument || !m_importedDocument->parsing());
}
-void HTMLImportLoader::addClient(HTMLImportLoaderClient* client)
+void HTMLImportLoader::addImport(HTMLImportChild* client)
{
- ASSERT(kNotFound == m_clients.find(client));
- m_clients.append(client);
+ ASSERT(kNotFound == m_imports.find(client));
+ m_imports.append(client);
if (isDone())
client->didFinishLoading();
}
-void HTMLImportLoader::removeClient(HTMLImportLoaderClient* client)
+void HTMLImportLoader::removeImport(HTMLImportChild* client)
{
- ASSERT(kNotFound != m_clients.find(client));
- m_clients.remove(m_clients.find(client));
+ ASSERT(kNotFound != m_imports.find(client));
+ m_imports.remove(m_imports.find(client));
}
} // namespace WebCore
« no previous file with comments | « Source/core/html/imports/HTMLImportLoader.h ('k') | Source/core/html/imports/HTMLImportLoaderClient.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698