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)) |
{ |