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

Side by Side Diff: Source/core/html/imports/HTMLImportLoader.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
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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 HTMLImportLoader::HTMLImportLoader(HTMLImportsController* controller) 47 HTMLImportLoader::HTMLImportLoader(HTMLImportsController* controller)
48 : m_controller(controller) 48 : m_controller(controller)
49 , m_state(StateLoading) 49 , m_state(StateLoading)
50 , m_microtaskQueue(CustomElementSyncMicrotaskQueue::create()) 50 , m_microtaskQueue(CustomElementSyncMicrotaskQueue::create())
51 { 51 {
52 } 52 }
53 53
54 HTMLImportLoader::~HTMLImportLoader() 54 HTMLImportLoader::~HTMLImportLoader()
55 { 55 {
56 #if !ENABLE(OILPAN) 56 #if !ENABLE(OILPAN)
57 clear(); 57 dispose();
58 #endif 58 #endif
59 } 59 }
60 60
61 #if !ENABLE(OILPAN) 61 void HTMLImportLoader::dispose()
62 void HTMLImportLoader::importDestroyed()
63 {
64 clear();
65 }
66
67 void HTMLImportLoader::clear()
68 { 62 {
69 m_controller = nullptr; 63 m_controller = nullptr;
70 if (m_document) { 64 if (m_document) {
71 m_document->setImportsController(0); 65 m_document->setImportsController(nullptr);
72 m_document->cancelParsing(); 66 m_document->cancelParsing();
73 m_document.clear(); 67 m_document.clear();
74 } 68 }
75 } 69 }
76 #endif
77 70
78 void HTMLImportLoader::startLoading(const ResourcePtr<RawResource>& resource) 71 void HTMLImportLoader::startLoading(const ResourcePtr<RawResource>& resource)
79 { 72 {
80 setResource(resource); 73 setResource(resource);
81 } 74 }
82 75
83 void HTMLImportLoader::responseReceived(Resource* resource, const ResourceRespon se& response, PassOwnPtr<WebDataConsumerHandle> handle) 76 void HTMLImportLoader::responseReceived(Resource* resource, const ResourceRespon se& response, PassOwnPtr<WebDataConsumerHandle> handle)
84 { 77 {
85 ASSERT_UNUSED(handle, !handle); 78 ASSERT_UNUSED(handle, !handle);
86 // Resource may already have been loaded with the import loader 79 // Resource may already have been loaded with the import loader
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 void HTMLImportLoader::addImport(HTMLImportChild* import) 193 void HTMLImportLoader::addImport(HTMLImportChild* import)
201 { 194 {
202 ASSERT(kNotFound == m_imports.find(import)); 195 ASSERT(kNotFound == m_imports.find(import));
203 196
204 m_imports.append(import); 197 m_imports.append(import);
205 import->normalize(); 198 import->normalize();
206 if (isDone()) 199 if (isDone())
207 import->didFinishLoading(); 200 import->didFinishLoading();
208 } 201 }
209 202
210 #if !ENABLE(OILPAN)
211 void HTMLImportLoader::removeImport(HTMLImportChild* client) 203 void HTMLImportLoader::removeImport(HTMLImportChild* client)
212 { 204 {
213 ASSERT(kNotFound != m_imports.find(client)); 205 ASSERT(kNotFound != m_imports.find(client));
214 m_imports.remove(m_imports.find(client)); 206 m_imports.remove(m_imports.find(client));
215 } 207 }
216 #endif
217 208
218 bool HTMLImportLoader::shouldBlockScriptExecution() const 209 bool HTMLImportLoader::shouldBlockScriptExecution() const
219 { 210 {
220 return firstImport()->state().shouldBlockScriptExecution(); 211 return firstImport()->state().shouldBlockScriptExecution();
221 } 212 }
222 213
223 PassRefPtrWillBeRawPtr<CustomElementSyncMicrotaskQueue> HTMLImportLoader::microt askQueue() const 214 PassRefPtrWillBeRawPtr<CustomElementSyncMicrotaskQueue> HTMLImportLoader::microt askQueue() const
224 { 215 {
225 return m_microtaskQueue; 216 return m_microtaskQueue;
226 } 217 }
227 218
228 DEFINE_TRACE(HTMLImportLoader) 219 DEFINE_TRACE(HTMLImportLoader)
229 { 220 {
230 visitor->trace(m_controller); 221 visitor->trace(m_controller);
231 #if ENABLE(OILPAN) 222 #if ENABLE(OILPAN)
232 visitor->trace(m_imports); 223 visitor->trace(m_imports);
233 #endif 224 #endif
234 visitor->trace(m_document); 225 visitor->trace(m_document);
235 visitor->trace(m_writer); 226 visitor->trace(m_writer);
236 visitor->trace(m_microtaskQueue); 227 visitor->trace(m_microtaskQueue);
237 DocumentParserClient::trace(visitor); 228 DocumentParserClient::trace(visitor);
238 } 229 }
239 230
240 } // namespace blink 231 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/html/imports/HTMLImportLoader.h ('k') | Source/core/html/imports/HTMLImportTreeRoot.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698