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

Unified Diff: sky/engine/core/html/parser/HTMLDocumentParser.cpp

Issue 720903002: Script-based imports should basically work (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Use String::format Created 6 years, 1 month 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 | « sky/engine/core/html/parser/HTMLDocumentParser.h ('k') | sky/engine/core/loader/MojoLoader.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/engine/core/html/parser/HTMLDocumentParser.cpp
diff --git a/sky/engine/core/html/parser/HTMLDocumentParser.cpp b/sky/engine/core/html/parser/HTMLDocumentParser.cpp
index d84502f1959d99fbbddb59f65da15146625dadb8..869ab63144d612b2a98e0fde0b8b8fbe3e2dbd9c 100644
--- a/sky/engine/core/html/parser/HTMLDocumentParser.cpp
+++ b/sky/engine/core/html/parser/HTMLDocumentParser.cpp
@@ -73,12 +73,15 @@ HTMLDocumentParser::~HTMLDocumentParser()
#endif
}
-void HTMLDocumentParser::parse(mojo::ScopedDataPipeConsumerHandle source)
+void HTMLDocumentParser::parse(mojo::ScopedDataPipeConsumerHandle source,
+ const base::Closure& completionCallback)
{
ASSERT(!isStopped());
ASSERT(!m_haveBackgroundParser);
m_haveBackgroundParser = true;
+ m_completionCallback = completionCallback;
+
OwnPtr<BackgroundHTMLParser::Configuration> config = adoptPtr(new BackgroundHTMLParser::Configuration);
config->source = source.Pass();
config->parser = m_weakFactory.GetWeakPtr();
@@ -355,8 +358,14 @@ void HTMLDocumentParser::end()
if (m_haveBackgroundParser)
stopBackgroundParser();
+ // Notice that we copy the compleition callback into a local variable
+ // because we might be deleted after we call ffinish() below.
+ base::Closure completionCallback = m_completionCallback;
+
// Informs the the rest of WebCore that parsing is really finished (and deletes this).
m_treeBuilder->finished();
+
+ completionCallback.Run();
}
void HTMLDocumentParser::attemptToEnd()
« no previous file with comments | « sky/engine/core/html/parser/HTMLDocumentParser.h ('k') | sky/engine/core/loader/MojoLoader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698