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

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

Issue 1032293002: Oilpan: dispose an HTMLImportsController on document detach/removal. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: No need to call dispose() when destructing HTMLImportsController Created 5 years, 9 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 | « Source/core/html/imports/HTMLImportChild.h ('k') | Source/core/html/imports/HTMLImportLoader.h » ('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) 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 , m_weakFactory(this) 49 , m_weakFactory(this)
50 #endif 50 #endif
51 , m_loader(loader) 51 , m_loader(loader)
52 , m_client(nullptr) 52 , m_client(nullptr)
53 { 53 {
54 } 54 }
55 55
56 HTMLImportChild::~HTMLImportChild() 56 HTMLImportChild::~HTMLImportChild()
57 { 57 {
58 #if !ENABLE(OILPAN) 58 #if !ENABLE(OILPAN)
59 // importDestroyed() should be called before the destruction. 59 // dispose() should be called before the destruction.
60 ASSERT(!m_loader); 60 ASSERT(!m_loader);
61 61
62 if (m_client) 62 if (m_client)
63 m_client->importChildWasDestroyed(this); 63 m_client->importChildWasDestroyed(this);
64 #endif 64 #endif
65 } 65 }
66 66
67 void HTMLImportChild::ownerInserted() 67 void HTMLImportChild::ownerInserted()
68 { 68 {
69 if (!m_loader->isDone()) 69 if (!m_loader->isDone())
(...skipping 23 matching lines...) Expand all
93 stateWillChange(); 93 stateWillChange();
94 CustomElement::didFinishLoadingImport(*(root()->document())); 94 CustomElement::didFinishLoadingImport(*(root()->document()));
95 } 95 }
96 96
97 void HTMLImportChild::didFinishUpgradingCustomElements() 97 void HTMLImportChild::didFinishUpgradingCustomElements()
98 { 98 {
99 stateWillChange(); 99 stateWillChange();
100 m_customElementMicrotaskStep.clear(); 100 m_customElementMicrotaskStep.clear();
101 } 101 }
102 102
103 #if !ENABLE(OILPAN) 103 void HTMLImportChild::dispose()
104 void HTMLImportChild::importDestroyed()
105 { 104 {
106 if (parent()) 105 if (parent())
107 parent()->removeChild(this); 106 parent()->removeChild(this);
108 107
109 ASSERT(m_loader); 108 ASSERT(m_loader);
110 m_loader->removeImport(this); 109 m_loader->removeImport(this);
111 m_loader = nullptr; 110 m_loader = nullptr;
112 } 111 }
113 #endif
114 112
115 Document* HTMLImportChild::document() const 113 Document* HTMLImportChild::document() const
116 { 114 {
117 ASSERT(m_loader); 115 ASSERT(m_loader);
118 return m_loader->document(); 116 return m_loader->document();
119 } 117 }
120 118
121 void HTMLImportChild::stateWillChange() 119 void HTMLImportChild::stateWillChange()
122 { 120 {
123 toHTMLImportTreeRoot(root())->scheduleRecalcState(); 121 toHTMLImportTreeRoot(root())->scheduleRecalcState();
(...skipping 30 matching lines...) Expand all
154 152
155 bool HTMLImportChild::isDone() const 153 bool HTMLImportChild::isDone() const
156 { 154 {
157 ASSERT(m_loader); 155 ASSERT(m_loader);
158 156
159 return m_loader->isDone() && m_loader->microtaskQueue()->isEmpty() && !m_cus tomElementMicrotaskStep; 157 return m_loader->isDone() && m_loader->microtaskQueue()->isEmpty() && !m_cus tomElementMicrotaskStep;
160 } 158 }
161 159
162 HTMLImportLoader* HTMLImportChild::loader() const 160 HTMLImportLoader* HTMLImportChild::loader() const
163 { 161 {
164 // This should never be called after importDestroyed. 162 // This should never be called after dispose().
165 ASSERT(m_loader); 163 ASSERT(m_loader);
166 return m_loader; 164 return m_loader;
167 } 165 }
168 166
169 void HTMLImportChild::setClient(HTMLImportChildClient* client) 167 void HTMLImportChild::setClient(HTMLImportChildClient* client)
170 { 168 {
171 ASSERT(client); 169 ASSERT(client);
172 ASSERT(!m_client); 170 ASSERT(!m_client);
173 m_client = client; 171 m_client = client;
174 } 172 }
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 221
224 DEFINE_TRACE(HTMLImportChild) 222 DEFINE_TRACE(HTMLImportChild)
225 { 223 {
226 visitor->trace(m_customElementMicrotaskStep); 224 visitor->trace(m_customElementMicrotaskStep);
227 visitor->trace(m_loader); 225 visitor->trace(m_loader);
228 visitor->trace(m_client); 226 visitor->trace(m_client);
229 HTMLImport::trace(visitor); 227 HTMLImport::trace(visitor);
230 } 228 }
231 229
232 } // namespace blink 230 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/html/imports/HTMLImportChild.h ('k') | Source/core/html/imports/HTMLImportLoader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698