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

Side by Side Diff: third_party/WebKit/Source/core/fetch/Resource.h

Issue 1850413002: Improve DEFINE_STATIC_LOCAL()'s handling of Blink GCed objects. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address compilation failure Created 4 years, 8 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
OLDNEW
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) 2006 Samuel Weinig (sam.weinig@gmail.com) 4 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
5 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 5 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
6 6
7 This library is free software; you can redistribute it and/or 7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Library General Public 8 modify it under the terms of the GNU Library General Public
9 License as published by the Free Software Foundation; either 9 License as published by the Free Software Foundation; either
10 version 2 of the License, or (at your option) any later version. 10 version 2 of the License, or (at your option) any later version.
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 void willAddClientOrObserver(); 265 void willAddClientOrObserver();
266 266
267 // |this| object may be dead after didRemoveClientOrObserver(). 267 // |this| object may be dead after didRemoveClientOrObserver().
268 void didRemoveClientOrObserver(); 268 void didRemoveClientOrObserver();
269 virtual void allClientsAndObserversRemoved(); 269 virtual void allClientsAndObserversRemoved();
270 270
271 HashCountedSet<ResourceClient*> m_clients; 271 HashCountedSet<ResourceClient*> m_clients;
272 HashCountedSet<ResourceClient*> m_clientsAwaitingCallback; 272 HashCountedSet<ResourceClient*> m_clientsAwaitingCallback;
273 HashCountedSet<ResourceClient*> m_finishedClients; 273 HashCountedSet<ResourceClient*> m_finishedClients;
274 274
275 class ResourceCallback : public GarbageCollectedFinalized<ResourceCallback> {
276 public:
277 static ResourceCallback* callbackHandler();
278 DECLARE_TRACE();
279 void schedule(Resource*);
280 void cancel(Resource*);
281 bool isScheduled(Resource*) const;
282 private:
283 ResourceCallback();
284 void runTask();
285 OwnPtr<CancellableTaskFactory> m_callbackTaskFactory;
286 HeapHashSet<Member<Resource>> m_resourcesWithPendingClients;
287 };
288
289 bool hasClient(ResourceClient* client) { return m_clients.contains(client) | | m_clientsAwaitingCallback.contains(client) || m_finishedClients.contains(clien t); } 275 bool hasClient(ResourceClient* client) { return m_clients.contains(client) | | m_clientsAwaitingCallback.contains(client) || m_finishedClients.contains(clien t); }
290 276
291 struct RedirectPair { 277 struct RedirectPair {
292 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); 278 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW();
293 public: 279 public:
294 explicit RedirectPair(const ResourceRequest& request, const ResourceResp onse& redirectResponse) 280 explicit RedirectPair(const ResourceRequest& request, const ResourceResp onse& redirectResponse)
295 : m_request(request) 281 : m_request(request)
296 , m_redirectResponse(redirectResponse) 282 , m_redirectResponse(redirectResponse)
297 { 283 {
298 } 284 }
(...skipping 18 matching lines...) Expand all
317 ResourceLoaderOptions m_options; 303 ResourceLoaderOptions m_options;
318 304
319 ResourceResponse m_response; 305 ResourceResponse m_response;
320 double m_responseTimestamp; 306 double m_responseTimestamp;
321 307
322 RefPtr<SharedBuffer> m_data; 308 RefPtr<SharedBuffer> m_data;
323 Timer<Resource> m_cancelTimer; 309 Timer<Resource> m_cancelTimer;
324 310
325 private: 311 private:
326 class CacheHandler; 312 class CacheHandler;
313 class ResourceCallback;
314
327 void cancelTimerFired(Timer<Resource>*); 315 void cancelTimerFired(Timer<Resource>*);
328 316
329 void revalidationSucceeded(const ResourceResponse&); 317 void revalidationSucceeded(const ResourceResponse&);
330 void revalidationFailed(); 318 void revalidationFailed();
331 319
332 size_t calculateOverheadSize() const; 320 size_t calculateOverheadSize() const;
333 321
334 bool unlock(); 322 bool unlock();
335 323
336 void setCachedMetadata(unsigned dataTypeID, const char*, size_t, CachedMetad ataHandler::CacheType); 324 void setCachedMetadata(unsigned dataTypeID, const char*, size_t, CachedMetad ataHandler::CacheType);
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 Resource::Type m_type; 376 Resource::Type m_type;
389 }; 377 };
390 378
391 #define DEFINE_RESOURCE_TYPE_CASTS(typeName) \ 379 #define DEFINE_RESOURCE_TYPE_CASTS(typeName) \
392 DEFINE_TYPE_CASTS(typeName##Resource, Resource, resource, resource->getType( ) == Resource::typeName, resource.getType() == Resource::typeName); \ 380 DEFINE_TYPE_CASTS(typeName##Resource, Resource, resource, resource->getType( ) == Resource::typeName, resource.getType() == Resource::typeName); \
393 inline typeName##Resource* to##typeName##Resource(const RawPtr<Resource>& pt r) { return to##typeName##Resource(ptr.get()); } 381 inline typeName##Resource* to##typeName##Resource(const RawPtr<Resource>& pt r) { return to##typeName##Resource(ptr.get()); }
394 382
395 } // namespace blink 383 } // namespace blink
396 384
397 #endif 385 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/fetch/FetchContext.cpp ('k') | third_party/WebKit/Source/core/fetch/Resource.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698