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 21 matching lines...) Expand all Loading... |
32 #include "core/html/imports/HTMLImportChild.h" | 32 #include "core/html/imports/HTMLImportChild.h" |
33 | 33 |
34 #include "core/dom/Document.h" | 34 #include "core/dom/Document.h" |
35 #include "core/dom/custom/CustomElement.h" | 35 #include "core/dom/custom/CustomElement.h" |
36 #include "core/dom/custom/CustomElementMicrotaskImportStep.h" | 36 #include "core/dom/custom/CustomElementMicrotaskImportStep.h" |
37 #include "core/html/imports/HTMLImportChildClient.h" | 37 #include "core/html/imports/HTMLImportChildClient.h" |
38 #include "core/html/imports/HTMLImportLoader.h" | 38 #include "core/html/imports/HTMLImportLoader.h" |
39 | 39 |
40 namespace WebCore { | 40 namespace WebCore { |
41 | 41 |
42 HTMLImportChild::HTMLImportChild(const KURL& url, bool createdByParser) | 42 HTMLImportChild::HTMLImportChild(Document& master, const KURL& url, bool created
ByParser) |
43 : HTMLImport(createdByParser) | 43 : HTMLImport(createdByParser) |
| 44 , m_master(master) |
44 , m_url(url) | 45 , m_url(url) |
45 , m_customElementMicrotaskStep(0) | 46 , m_customElementMicrotaskStep(0) |
46 , m_client(0) | 47 , m_client(0) |
47 { | 48 { |
| 49 m_master.guardRef(); |
48 } | 50 } |
49 | 51 |
50 HTMLImportChild::~HTMLImportChild() | 52 HTMLImportChild::~HTMLImportChild() |
51 { | 53 { |
52 // importDestroyed() should be called before the destruction. | 54 // importDestroyed() should be called before the destruction. |
53 ASSERT(!m_loader); | 55 ASSERT(!m_loader); |
54 | 56 |
55 if (m_customElementMicrotaskStep) { | 57 if (m_customElementMicrotaskStep) { |
56 // if Custom Elements were blocked, must unblock them before death | 58 // if Custom Elements were blocked, must unblock them before death |
57 m_customElementMicrotaskStep->importDidFinish(); | 59 m_customElementMicrotaskStep->importDidFinish(); |
58 m_customElementMicrotaskStep = 0; | 60 m_customElementMicrotaskStep = 0; |
59 } | 61 } |
60 | 62 |
61 if (m_client) | 63 if (m_client) |
62 m_client->importChildWasDestroyed(this); | 64 m_client->importChildWasDestroyed(this); |
| 65 |
| 66 m_master.guardDeref(); |
63 } | 67 } |
64 | 68 |
65 void HTMLImportChild::wasAlreadyLoaded() | 69 void HTMLImportChild::wasAlreadyLoaded() |
66 { | 70 { |
67 ASSERT(!m_loader); | 71 ASSERT(!m_loader); |
68 ASSERT(m_client); | 72 ASSERT(m_client); |
69 stateWillChange(); | 73 stateWillChange(); |
70 } | 74 } |
71 | 75 |
72 void HTMLImportChild::startLoading(const ResourcePtr<RawResource>& resource) | 76 void HTMLImportChild::startLoading(const ResourcePtr<RawResource>& resource) |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 HTMLImport::showThis(); | 242 HTMLImport::showThis(); |
239 fprintf(stderr, " loader=%p own=%s async=%s url=%s", | 243 fprintf(stderr, " loader=%p own=%s async=%s url=%s", |
240 m_loader.get(), | 244 m_loader.get(), |
241 hasLoader() && ownsLoader() ? "Y" : "N", | 245 hasLoader() && ownsLoader() ? "Y" : "N", |
242 isCreatedByParser() ? "Y" : "N", | 246 isCreatedByParser() ? "Y" : "N", |
243 url().string().utf8().data()); | 247 url().string().utf8().data()); |
244 } | 248 } |
245 #endif | 249 #endif |
246 | 250 |
247 } // namespace WebCore | 251 } // namespace WebCore |
OLD | NEW |