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) 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 Loading... |
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 |
275 bool hasClient(ResourceClient* client) { return m_clients.contains(client) |
| m_clientsAwaitingCallback.contains(client) || m_finishedClients.contains(clien
t); } | 289 bool hasClient(ResourceClient* client) { return m_clients.contains(client) |
| m_clientsAwaitingCallback.contains(client) || m_finishedClients.contains(clien
t); } |
276 | 290 |
277 struct RedirectPair { | 291 struct RedirectPair { |
278 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); | 292 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); |
279 public: | 293 public: |
280 explicit RedirectPair(const ResourceRequest& request, const ResourceResp
onse& redirectResponse) | 294 explicit RedirectPair(const ResourceRequest& request, const ResourceResp
onse& redirectResponse) |
281 : m_request(request) | 295 : m_request(request) |
282 , m_redirectResponse(redirectResponse) | 296 , m_redirectResponse(redirectResponse) |
283 { | 297 { |
284 } | 298 } |
(...skipping 18 matching lines...) Expand all Loading... |
303 ResourceLoaderOptions m_options; | 317 ResourceLoaderOptions m_options; |
304 | 318 |
305 ResourceResponse m_response; | 319 ResourceResponse m_response; |
306 double m_responseTimestamp; | 320 double m_responseTimestamp; |
307 | 321 |
308 RefPtr<SharedBuffer> m_data; | 322 RefPtr<SharedBuffer> m_data; |
309 Timer<Resource> m_cancelTimer; | 323 Timer<Resource> m_cancelTimer; |
310 | 324 |
311 private: | 325 private: |
312 class CacheHandler; | 326 class CacheHandler; |
313 class ResourceCallback; | |
314 | |
315 void cancelTimerFired(Timer<Resource>*); | 327 void cancelTimerFired(Timer<Resource>*); |
316 | 328 |
317 void revalidationSucceeded(const ResourceResponse&); | 329 void revalidationSucceeded(const ResourceResponse&); |
318 void revalidationFailed(); | 330 void revalidationFailed(); |
319 | 331 |
320 size_t calculateOverheadSize() const; | 332 size_t calculateOverheadSize() const; |
321 | 333 |
322 bool unlock(); | 334 bool unlock(); |
323 | 335 |
324 void setCachedMetadata(unsigned dataTypeID, const char*, size_t, CachedMetad
ataHandler::CacheType); | 336 void setCachedMetadata(unsigned dataTypeID, const char*, size_t, CachedMetad
ataHandler::CacheType); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 Resource::Type m_type; | 388 Resource::Type m_type; |
377 }; | 389 }; |
378 | 390 |
379 #define DEFINE_RESOURCE_TYPE_CASTS(typeName) \ | 391 #define DEFINE_RESOURCE_TYPE_CASTS(typeName) \ |
380 DEFINE_TYPE_CASTS(typeName##Resource, Resource, resource, resource->getType(
) == Resource::typeName, resource.getType() == Resource::typeName); \ | 392 DEFINE_TYPE_CASTS(typeName##Resource, Resource, resource, resource->getType(
) == Resource::typeName, resource.getType() == Resource::typeName); \ |
381 inline typeName##Resource* to##typeName##Resource(const RawPtr<Resource>& pt
r) { return to##typeName##Resource(ptr.get()); } | 393 inline typeName##Resource* to##typeName##Resource(const RawPtr<Resource>& pt
r) { return to##typeName##Resource(ptr.get()); } |
382 | 394 |
383 } // namespace blink | 395 } // namespace blink |
384 | 396 |
385 #endif | 397 #endif |
OLD | NEW |