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

Unified Diff: third_party/WebKit/Source/core/fetch/Resource.cpp

Issue 2287483003: Stop ResourceCallback from being an on-heap class (Closed)
Patch Set: fix Created 4 years, 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/fetch/Resource.cpp
diff --git a/third_party/WebKit/Source/core/fetch/Resource.cpp b/third_party/WebKit/Source/core/fetch/Resource.cpp
index a88e43c79f3cd47a0321c0f9c034fee86bcf72e2..f3a89688e24f21f793e4ce4155c2bd7d54bef8a7 100644
--- a/third_party/WebKit/Source/core/fetch/Resource.cpp
+++ b/third_party/WebKit/Source/core/fetch/Resource.cpp
@@ -226,10 +226,12 @@ void Resource::ServiceWorkerResponseCachedMetadataHandler::sendToPlatform()
}
}
-class Resource::ResourceCallback final : public GarbageCollectedFinalized<ResourceCallback> {
+// This class cannot be on-heap because the first callbackHandler() call
+// instantiates the singleton object while we can call it in the
+// pre-finalization step.
+class Resource::ResourceCallback final {
public:
static ResourceCallback& callbackHandler();
- DECLARE_TRACE();
void schedule(Resource*);
void cancel(Resource*);
bool isScheduled(Resource*) const;
@@ -238,26 +240,15 @@ private:
void runTask();
std::unique_ptr<CancellableTaskFactory> m_callbackTaskFactory;
- HeapHashSet<Member<Resource>> m_resourcesWithPendingClients;
+ HashSet<Persistent<Resource>> m_resourcesWithPendingClients;
};
Resource::ResourceCallback& Resource::ResourceCallback::callbackHandler()
{
- // Oilpan + LSan: as the callbackHandler() singleton is used by Resource
- // and ResourcePtr finalizers, it cannot be released upon shutdown in
- // preparation for leak detection.
- //
- // Keep it out of LSan's reach instead.
- LEAK_SANITIZER_DISABLED_SCOPE;
- DEFINE_STATIC_LOCAL(ResourceCallback, callbackHandler, (new ResourceCallback));
+ DEFINE_STATIC_LOCAL(ResourceCallback, callbackHandler, ());
return callbackHandler;
}
-DEFINE_TRACE(Resource::ResourceCallback)
-{
- visitor->trace(m_resourcesWithPendingClients);
-}
-
Resource::ResourceCallback::ResourceCallback()
: m_callbackTaskFactory(CancellableTaskFactory::create(this, &ResourceCallback::runTask))
{
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698