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

Side by Side Diff: Source/core/html/imports/HTMLImportStateResolver.cpp

Issue 251813006: HTML Imports: Let @async import not block its sibling. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « LayoutTests/http/tests/htmlimports/resources/not-slow.html ('k') | no next file » | 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) 2014 Google Inc. All rights reserved. 2 * Copyright (C) 2014 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 19 matching lines...) Expand all
30 30
31 #include "config.h" 31 #include "config.h"
32 #include "core/html/imports/HTMLImportStateResolver.h" 32 #include "core/html/imports/HTMLImportStateResolver.h"
33 33
34 #include "core/html/imports/HTMLImport.h" 34 #include "core/html/imports/HTMLImport.h"
35 35
36 namespace WebCore { 36 namespace WebCore {
37 37
38 inline bool HTMLImportStateResolver::isBlockingFollowers(HTMLImport* import) 38 inline bool HTMLImportStateResolver::isBlockingFollowers(HTMLImport* import)
39 { 39 {
40 if (!import->isSync())
41 return false;
40 if (!import->loader()) 42 if (!import->loader())
41 return true; 43 return true;
42 return !import->state().isReady(); 44 return !import->state().isReady();
43 } 45 }
44 46
45 inline bool HTMLImportStateResolver::shouldBlockScriptExecution() const 47 inline bool HTMLImportStateResolver::shouldBlockScriptExecution() const
46 { 48 {
47 for (const HTMLImport* ancestor = m_import; ancestor; ancestor = ancestor->p arent()) { 49 for (const HTMLImport* ancestor = m_import; ancestor; ancestor = ancestor->p arent()) {
48 if (ancestor->previous() && isBlockingFollowers(ancestor->previous())) 50 if (ancestor->previous() && isBlockingFollowers(ancestor->previous()))
49 return true; 51 return true;
50 } 52 }
51 53
52 for (HTMLImport* child = m_import->firstChild(); child; child = child->next( )) { 54 for (HTMLImport* child = m_import->firstChild(); child; child = child->next( )) {
53 if (child->isSync() && isBlockingFollowers(child)) 55 if (isBlockingFollowers(child))
54 return true; 56 return true;
55 } 57 }
56 58
57 return false; 59 return false;
58 } 60 }
59 61
60 inline bool HTMLImportStateResolver::isActive() const 62 inline bool HTMLImportStateResolver::isActive() const
61 { 63 {
62 return !m_import->isDone(); 64 return !m_import->isDone();
63 } 65 }
64 66
65 HTMLImportState HTMLImportStateResolver::resolve() const 67 HTMLImportState HTMLImportStateResolver::resolve() const
66 { 68 {
67 if (shouldBlockScriptExecution()) 69 if (shouldBlockScriptExecution())
68 return HTMLImportState(HTMLImportState::BlockingScriptExecution); 70 return HTMLImportState(HTMLImportState::BlockingScriptExecution);
69 if (isActive()) 71 if (isActive())
70 return HTMLImportState(HTMLImportState::Active); 72 return HTMLImportState(HTMLImportState::Active);
71 return HTMLImportState(HTMLImportState::Ready); 73 return HTMLImportState(HTMLImportState::Ready);
72 } 74 }
73 75
74 } 76 }
75 77
OLDNEW
« no previous file with comments | « LayoutTests/http/tests/htmlimports/resources/not-slow.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698