OLD | NEW |
---|---|
1 /* | 1 /* |
2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) | 2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) |
3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org) | 3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org) |
4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org) | 4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org) |
5 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) | 5 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) |
6 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. | 6 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. |
7 | 7 |
8 This library is free software; you can redistribute it and/or | 8 This library is free software; you can redistribute it and/or |
9 modify it under the terms of the GNU Library General Public | 9 modify it under the terms of the GNU Library General Public |
10 License as published by the Free Software Foundation; either | 10 License as published by the Free Software Foundation; either |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
219 return; | 219 return; |
220 | 220 |
221 if (m_cachedMetadata) { | 221 if (m_cachedMetadata) { |
222 const Vector<char>& serializedData = m_cachedMetadata->serialize(); | 222 const Vector<char>& serializedData = m_cachedMetadata->serialize(); |
223 Platform::current()->cacheMetadataInCacheStorage(response().url(), respo nse().responseTime(), serializedData.data(), serializedData.size(), WebSecurityO rigin(m_securityOrigin), response().cacheStorageCacheName()); | 223 Platform::current()->cacheMetadataInCacheStorage(response().url(), respo nse().responseTime(), serializedData.data(), serializedData.size(), WebSecurityO rigin(m_securityOrigin), response().cacheStorageCacheName()); |
224 } else { | 224 } else { |
225 Platform::current()->cacheMetadataInCacheStorage(response().url(), respo nse().responseTime(), nullptr, 0, WebSecurityOrigin(m_securityOrigin), response( ).cacheStorageCacheName()); | 225 Platform::current()->cacheMetadataInCacheStorage(response().url(), respo nse().responseTime(), nullptr, 0, WebSecurityOrigin(m_securityOrigin), response( ).cacheStorageCacheName()); |
226 } | 226 } |
227 } | 227 } |
228 | 228 |
229 class Resource::ResourceCallback final : public GarbageCollectedFinalized<Resour ceCallback> { | 229 // This class cannot be on-heap because the first callbackHandler() call |
230 // instantiates the singleton object while we can call it in the | |
231 // pre-finalization step. | |
232 class Resource::ResourceCallback final { | |
230 public: | 233 public: |
231 static ResourceCallback& callbackHandler(); | 234 static ResourceCallback& callbackHandler(); |
232 DECLARE_TRACE(); | |
233 void schedule(Resource*); | 235 void schedule(Resource*); |
234 void cancel(Resource*); | 236 void cancel(Resource*); |
235 bool isScheduled(Resource*) const; | 237 bool isScheduled(Resource*) const; |
236 private: | 238 private: |
237 ResourceCallback(); | 239 ResourceCallback(); |
238 | 240 |
239 void runTask(); | 241 void runTask(); |
240 std::unique_ptr<CancellableTaskFactory> m_callbackTaskFactory; | 242 std::unique_ptr<CancellableTaskFactory> m_callbackTaskFactory; |
241 HeapHashSet<Member<Resource>> m_resourcesWithPendingClients; | 243 HashSet<Persistent<Resource>> m_resourcesWithPendingClients; |
242 }; | 244 }; |
243 | 245 |
244 Resource::ResourceCallback& Resource::ResourceCallback::callbackHandler() | 246 Resource::ResourceCallback& Resource::ResourceCallback::callbackHandler() |
245 { | 247 { |
246 // Oilpan + LSan: as the callbackHandler() singleton is used by Resource | 248 // Oilpan + LSan: as the callbackHandler() singleton is used by Resource |
yhirano
2016/08/29 04:34:11
haraken@: Sorry I forgot to ask, I don't know if w
haraken
2016/08/29 04:37:02
This is a oilpan & DISABLE_STATIC_LOCAL specific t
yhirano
2016/08/29 04:40:46
Thanks!
| |
247 // and ResourcePtr finalizers, it cannot be released upon shutdown in | 249 // and ResourcePtr finalizers, it cannot be released upon shutdown in |
248 // preparation for leak detection. | 250 // preparation for leak detection. |
249 // | 251 // |
250 // Keep it out of LSan's reach instead. | 252 // Keep it out of LSan's reach instead. |
251 LEAK_SANITIZER_DISABLED_SCOPE; | 253 LEAK_SANITIZER_DISABLED_SCOPE; |
252 DEFINE_STATIC_LOCAL(ResourceCallback, callbackHandler, (new ResourceCallback )); | 254 DEFINE_STATIC_LOCAL(ResourceCallback, callbackHandler, ()); |
253 return callbackHandler; | 255 return callbackHandler; |
254 } | 256 } |
255 | 257 |
256 DEFINE_TRACE(Resource::ResourceCallback) | |
257 { | |
258 visitor->trace(m_resourcesWithPendingClients); | |
259 } | |
260 | |
261 Resource::ResourceCallback::ResourceCallback() | 258 Resource::ResourceCallback::ResourceCallback() |
262 : m_callbackTaskFactory(CancellableTaskFactory::create(this, &ResourceCallba ck::runTask)) | 259 : m_callbackTaskFactory(CancellableTaskFactory::create(this, &ResourceCallba ck::runTask)) |
263 { | 260 { |
264 } | 261 } |
265 | 262 |
266 void Resource::ResourceCallback::schedule(Resource* resource) | 263 void Resource::ResourceCallback::schedule(Resource* resource) |
267 { | 264 { |
268 if (!m_callbackTaskFactory->isPending()) | 265 if (!m_callbackTaskFactory->isPending()) |
269 Platform::current()->currentThread()->scheduler()->loadingTaskRunner()-> postTask(BLINK_FROM_HERE, m_callbackTaskFactory->cancelAndCreate()); | 266 Platform::current()->currentThread()->scheduler()->loadingTaskRunner()-> postTask(BLINK_FROM_HERE, m_callbackTaskFactory->cancelAndCreate()); |
270 m_resourcesWithPendingClients.add(resource); | 267 m_resourcesWithPendingClients.add(resource); |
(...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1065 case Resource::TextTrack: | 1062 case Resource::TextTrack: |
1066 case Resource::Media: | 1063 case Resource::Media: |
1067 case Resource::Manifest: | 1064 case Resource::Manifest: |
1068 return false; | 1065 return false; |
1069 } | 1066 } |
1070 ASSERT_NOT_REACHED(); | 1067 ASSERT_NOT_REACHED(); |
1071 return false; | 1068 return false; |
1072 } | 1069 } |
1073 | 1070 |
1074 } // namespace blink | 1071 } // namespace blink |
OLD | NEW |