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

Unified Diff: Source/core/loader/appcache/ApplicationCacheHost.cpp

Issue 1194003004: Oilpan: enable appcache + move DocumentLoader to the heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: add outer loader protection Created 5 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/loader/appcache/ApplicationCacheHost.cpp
diff --git a/Source/core/loader/appcache/ApplicationCacheHost.cpp b/Source/core/loader/appcache/ApplicationCacheHost.cpp
index aca55a24e73aff8ed4a31e2d34c6ef3f67c87007..1f09d158e7852887f25f11c0882464fc9b3d2de0 100644
--- a/Source/core/loader/appcache/ApplicationCacheHost.cpp
+++ b/Source/core/loader/appcache/ApplicationCacheHost.cpp
@@ -166,15 +166,16 @@ void ApplicationCacheHost::setApplicationCache(ApplicationCache* domApplicationC
void ApplicationCacheHost::dispose()
{
- // FIXME: Oilpan: remove the dispose step when the owning DocumentLoader
- // becomes a garbage collected object. Until that time, have the
- // DocumentLoader dispose and disable this ApplicationCacheHost when
- // it is finalized. Releasing the WebApplicationCacheHost is needed
- // to prevent further embedder notifications, which risk accessing an
+#if !ENABLE(OILPAN)
haraken 2015/06/22 01:57:58 Can we move the #if !ENABLE(OILPAN) to the entire
sof 2015/06/22 06:49:18 Renamed as detachFromDocumentLoader() instead (cf.
+ // The owning DocumentLoader must explicitly dispose of and
+ // disable this ApplicationCacheHost when it is finalized.
+ // Releasing the WebApplicationCacheHost is needed to prevent
+ // further embedder notifications, which risk accessing an
// invalid DocumentLoader.
setApplicationCache(0);
m_host.clear();
m_documentLoader = nullptr;
haraken 2015/06/22 01:57:59 Now in non-oilpan, both DocumentLoader and Applica
sof 2015/06/22 05:03:46 That will not work. The Persistent<> on DocumentLo
haraken 2015/06/22 05:28:55 I'm not sure but maybe can we clear the Persistent
+#endif
}
void ApplicationCacheHost::notifyApplicationCache(EventID id, int progressTotal, int progressDone, WebApplicationCacheHost::ErrorReason errorReason, const String& errorURL, int errorStatus, const String& errorMessage)
@@ -216,7 +217,7 @@ void ApplicationCacheHost::fillResourceList(ResourceInfoList* resources)
void ApplicationCacheHost::stopDeferringEvents()
{
- RefPtr<DocumentLoader> protect(documentLoader());
+ RefPtrWillBeRawPtr<DocumentLoader> protect(documentLoader());
for (unsigned i = 0; i < m_deferredEvents.size(); ++i) {
const DeferredEvent& deferred = m_deferredEvents[i];
dispatchDOMEvent(deferred.eventID, deferred.progressTotal, deferred.progressDone, deferred.errorReason, deferred.errorURL, deferred.errorStatus, deferred.errorMessage);
@@ -227,17 +228,18 @@ void ApplicationCacheHost::stopDeferringEvents()
void ApplicationCacheHost::dispatchDOMEvent(EventID id, int progressTotal, int progressDone, WebApplicationCacheHost::ErrorReason errorReason, const String& errorURL, int errorStatus, const String& errorMessage)
{
- if (m_domApplicationCache) {
- const AtomicString& eventType = ApplicationCache::toEventType(id);
- RefPtrWillBeRawPtr<Event> event = nullptr;
- if (id == PROGRESS_EVENT)
- event = ProgressEvent::create(eventType, true, progressDone, progressTotal);
- else if (id == ERROR_EVENT)
- event = ApplicationCacheErrorEvent::create(errorReason, errorURL, errorStatus, errorMessage);
- else
- event = Event::create(eventType);
- m_domApplicationCache->dispatchEvent(event, ASSERT_NO_EXCEPTION);
- }
+ if (!m_domApplicationCache)
+ return;
+
+ const AtomicString& eventType = ApplicationCache::toEventType(id);
+ RefPtrWillBeRawPtr<Event> event = nullptr;
+ if (id == PROGRESS_EVENT)
+ event = ProgressEvent::create(eventType, true, progressDone, progressTotal);
+ else if (id == ERROR_EVENT)
+ event = ApplicationCacheErrorEvent::create(errorReason, errorURL, errorStatus, errorMessage);
+ else
+ event = Event::create(eventType);
+ m_domApplicationCache->dispatchEvent(event, ASSERT_NO_EXCEPTION);
}
ApplicationCacheHost::Status ApplicationCacheHost::status() const
@@ -293,6 +295,7 @@ void ApplicationCacheHost::notifyErrorEventListener(WebApplicationCacheHost::Err
DEFINE_TRACE(ApplicationCacheHost)
{
visitor->trace(m_domApplicationCache);
+ visitor->trace(m_documentLoader);
}
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698