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

Side by Side Diff: Source/core/loader/appcache/ApplicationCacheHost.cpp

Issue 571003002: Dispose ApplicationCacheHost on DocumentLoader finalization. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 3 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 | « Source/core/loader/appcache/ApplicationCacheHost.h ('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) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 m_host->willStartSubResourceRequest(wrapped); 157 m_host->willStartSubResourceRequest(wrapped);
158 } 158 }
159 } 159 }
160 160
161 void ApplicationCacheHost::setApplicationCache(ApplicationCache* domApplicationC ache) 161 void ApplicationCacheHost::setApplicationCache(ApplicationCache* domApplicationC ache)
162 { 162 {
163 ASSERT(!m_domApplicationCache || !domApplicationCache); 163 ASSERT(!m_domApplicationCache || !domApplicationCache);
164 m_domApplicationCache = domApplicationCache; 164 m_domApplicationCache = domApplicationCache;
165 } 165 }
166 166
167 void ApplicationCacheHost::dispose()
168 {
169 // FIXME: Oilpan: remove the dispose step when the owning DocumentLoader
170 // becomes a garbage collected object. Until that time, have the
171 // DocumentLoader dispose and disable this ApplicationCacheHost when
172 // it is finalized. Releasing the WebApplicationCacheHost is needed
173 // to prevent further embedder notifications, which risk accessing an
174 // invalid DocumentLoader.
175 setApplicationCache(0);
176 m_host.clear();
177 m_documentLoader = nullptr;
178 }
179
167 void ApplicationCacheHost::notifyApplicationCache(EventID id, int progressTotal, int progressDone, WebApplicationCacheHost::ErrorReason errorReason, const Strin g& errorURL, int errorStatus, const String& errorMessage) 180 void ApplicationCacheHost::notifyApplicationCache(EventID id, int progressTotal, int progressDone, WebApplicationCacheHost::ErrorReason errorReason, const Strin g& errorURL, int errorStatus, const String& errorMessage)
168 { 181 {
169 if (id != PROGRESS_EVENT) 182 if (id != PROGRESS_EVENT)
170 InspectorInstrumentation::updateApplicationCacheStatus(m_documentLoader- >frame()); 183 InspectorInstrumentation::updateApplicationCacheStatus(m_documentLoader- >frame());
171 184
172 if (m_defersEvents) { 185 if (m_defersEvents) {
173 // Event dispatching is deferred until document.onload has fired. 186 // Event dispatching is deferred until document.onload has fired.
174 m_deferredEvents.append(DeferredEvent(id, progressTotal, progressDone, e rrorReason, errorURL, errorStatus, errorMessage)); 187 m_deferredEvents.append(DeferredEvent(id, progressTotal, progressDone, e rrorReason, errorURL, errorStatus, errorMessage));
175 return; 188 return;
176 } 189 }
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 { 289 {
277 notifyApplicationCache(ERROR_EVENT, 0, 0, reason, url.string(), status, mess age); 290 notifyApplicationCache(ERROR_EVENT, 0, 0, reason, url.string(), status, mess age);
278 } 291 }
279 292
280 void ApplicationCacheHost::trace(Visitor* visitor) 293 void ApplicationCacheHost::trace(Visitor* visitor)
281 { 294 {
282 visitor->trace(m_domApplicationCache); 295 visitor->trace(m_domApplicationCache);
283 } 296 }
284 297
285 } // namespace blink 298 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/loader/appcache/ApplicationCacheHost.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698