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

Side by Side Diff: sky/engine/core/html/parser/HTMLDocumentParser.cpp

Issue 950603002: Port sky-scrollable to Dart (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: less setAttributes Created 5 years, 10 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 unified diff | Download patch
« no previous file with comments | « sky/engine/core/dom/Document.idl ('k') | sky/examples/data/cities.sky » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 } 387 }
388 388
389 bool HTMLDocumentParser::isWaitingForScripts() const 389 bool HTMLDocumentParser::isWaitingForScripts() const
390 { 390 {
391 return m_treeBuilder->hasParserBlockingScript() || m_scriptRunner || 391 return m_treeBuilder->hasParserBlockingScript() || m_scriptRunner ||
392 !document()->haveImportsLoaded(); 392 !document()->haveImportsLoaded();
393 } 393 }
394 394
395 void HTMLDocumentParser::resumeAfterWaitingForImports() 395 void HTMLDocumentParser::resumeAfterWaitingForImports()
396 { 396 {
397 RefPtr<HTMLDocumentParser> protect(this); 397 if (isWaitingForScripts())
398 ASSERT(!isWaitingForScripts()); 398 return;
399 if (m_pendingChunks.isEmpty()) 399 if (m_pendingChunks.isEmpty())
400 return; 400 return;
401 ASSERT(m_haveBackgroundParser); 401 ASSERT(m_haveBackgroundParser);
402 RefPtr<HTMLDocumentParser> protect(this);
402 pumpPendingChunks(); 403 pumpPendingChunks();
403 } 404 }
404 405
405 // HTMLScriptRunner has finished executing a script. 406 // HTMLScriptRunner has finished executing a script.
406 // Just call resumeAfterWaitingForImports since it happens to do what we need. 407 // Just call resumeAfterWaitingForImports since it happens to do what we need.
407 void HTMLDocumentParser::scriptExecutionCompleted() { 408 void HTMLDocumentParser::scriptExecutionCompleted() {
408 ASSERT(m_scriptRunner); 409 ASSERT(m_scriptRunner);
409 m_scriptRunner.clear(); 410 m_scriptRunner.clear();
410 // To avoid re-entering the parser for synchronous scripts, we use a postTask. 411 // To avoid re-entering the parser for synchronous scripts, we use a postTask.
411 base::MessageLoop::current()->PostTask( 412 base::MessageLoop::current()->PostTask(
412 FROM_HERE, base::Bind(&HTMLDocumentParser::resumeAfterWaitingForImports, 413 FROM_HERE, base::Bind(&HTMLDocumentParser::resumeAfterWaitingForImports,
413 m_weakFactory.GetWeakPtr())); 414 m_weakFactory.GetWeakPtr()));
414 } 415 }
415 } 416 }
OLDNEW
« no previous file with comments | « sky/engine/core/dom/Document.idl ('k') | sky/examples/data/cities.sky » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698