| 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 19 matching lines...) Expand all Loading... |
| 30 | 30 |
| 31 #include "sky/engine/config.h" | 31 #include "sky/engine/config.h" |
| 32 #include "sky/engine/core/html/imports/HTMLImportLoader.h" | 32 #include "sky/engine/core/html/imports/HTMLImportLoader.h" |
| 33 | 33 |
| 34 #include "base/bind.h" | 34 #include "base/bind.h" |
| 35 #include "sky/engine/core/app/Module.h" | 35 #include "sky/engine/core/app/Module.h" |
| 36 #include "sky/engine/core/dom/Document.h" | 36 #include "sky/engine/core/dom/Document.h" |
| 37 #include "sky/engine/core/dom/DocumentParser.h" | 37 #include "sky/engine/core/dom/DocumentParser.h" |
| 38 #include "sky/engine/core/dom/StyleEngine.h" | 38 #include "sky/engine/core/dom/StyleEngine.h" |
| 39 #include "sky/engine/core/dom/custom/CustomElementSyncMicrotaskQueue.h" | 39 #include "sky/engine/core/dom/custom/CustomElementSyncMicrotaskQueue.h" |
| 40 #include "sky/engine/core/html/HTMLDocument.h" | |
| 41 #include "sky/engine/core/html/imports/HTMLImportChild.h" | 40 #include "sky/engine/core/html/imports/HTMLImportChild.h" |
| 42 #include "sky/engine/core/html/imports/HTMLImportsController.h" | 41 #include "sky/engine/core/html/imports/HTMLImportsController.h" |
| 43 | 42 |
| 44 namespace blink { | 43 namespace blink { |
| 45 | 44 |
| 46 HTMLImportLoader::HTMLImportLoader(HTMLImportsController* controller) | 45 HTMLImportLoader::HTMLImportLoader(HTMLImportsController* controller) |
| 47 : m_controller(controller) | 46 : m_controller(controller) |
| 48 , m_state(StateLoading) | 47 , m_state(StateLoading) |
| 49 , m_microtaskQueue(CustomElementSyncMicrotaskQueue::create()) | 48 , m_microtaskQueue(CustomElementSyncMicrotaskQueue::create()) |
| 50 { | 49 { |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 } | 94 } |
| 96 | 95 |
| 97 HTMLImportLoader::State HTMLImportLoader::startWritingAndParsing(mojo::URLRespon
sePtr response) | 96 HTMLImportLoader::State HTMLImportLoader::startWritingAndParsing(mojo::URLRespon
sePtr response) |
| 98 { | 97 { |
| 99 ASSERT(!m_imports.isEmpty()); | 98 ASSERT(!m_imports.isEmpty()); |
| 100 WeakPtr<Document> contextDocument = m_controller->master()->contextDocument(
); | 99 WeakPtr<Document> contextDocument = m_controller->master()->contextDocument(
); |
| 101 ASSERT(contextDocument.get()); | 100 ASSERT(contextDocument.get()); |
| 102 KURL url(ParsedURLString, String::fromUTF8(response->url)); | 101 KURL url(ParsedURLString, String::fromUTF8(response->url)); |
| 103 DocumentInit init = DocumentInit(url, 0, contextDocument, m_controller) | 102 DocumentInit init = DocumentInit(url, 0, contextDocument, m_controller) |
| 104 .withRegistrationContext(m_controller->master()->registrationContext()); | 103 .withRegistrationContext(m_controller->master()->registrationContext()); |
| 105 m_document = HTMLDocument::create(init); | 104 m_document = Document::create(init); |
| 106 m_module = Module::create(contextDocument.get(), nullptr, m_document.get(),
url.string()); | 105 m_module = Module::create(contextDocument.get(), nullptr, m_document.get(),
url.string()); |
| 107 m_document->startParsing()->parse(response->body.Pass(), base::Bind(base::Do
Nothing)); | 106 m_document->startParsing()->parse(response->body.Pass(), base::Bind(base::Do
Nothing)); |
| 108 return StateLoading; | 107 return StateLoading; |
| 109 } | 108 } |
| 110 | 109 |
| 111 HTMLImportLoader::State HTMLImportLoader::finishWriting() | 110 HTMLImportLoader::State HTMLImportLoader::finishWriting() |
| 112 { | 111 { |
| 113 return StateWritten; | 112 return StateWritten; |
| 114 } | 113 } |
| 115 | 114 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 { | 183 { |
| 185 return firstImport()->state().shouldBlockScriptExecution(); | 184 return firstImport()->state().shouldBlockScriptExecution(); |
| 186 } | 185 } |
| 187 | 186 |
| 188 PassRefPtr<CustomElementSyncMicrotaskQueue> HTMLImportLoader::microtaskQueue() c
onst | 187 PassRefPtr<CustomElementSyncMicrotaskQueue> HTMLImportLoader::microtaskQueue() c
onst |
| 189 { | 188 { |
| 190 return m_microtaskQueue; | 189 return m_microtaskQueue; |
| 191 } | 190 } |
| 192 | 191 |
| 193 } // namespace blink | 192 } // namespace blink |
| OLD | NEW |