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

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

Issue 2394793002: Resource: helper class to prohibit {add,remove}Client() calls in scope (Closed)
Patch Set: rebase Created 4 years, 2 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 5 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All
6 rights reserved. 6 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 21 matching lines...) Expand all
32 #include "platform/SharedBuffer.h" 32 #include "platform/SharedBuffer.h"
33 #include "platform/Timer.h" 33 #include "platform/Timer.h"
34 #include "platform/network/ResourceError.h" 34 #include "platform/network/ResourceError.h"
35 #include "platform/network/ResourceLoadPriority.h" 35 #include "platform/network/ResourceLoadPriority.h"
36 #include "platform/network/ResourceRequest.h" 36 #include "platform/network/ResourceRequest.h"
37 #include "platform/network/ResourceResponse.h" 37 #include "platform/network/ResourceResponse.h"
38 #include "platform/scheduler/CancellableTaskFactory.h" 38 #include "platform/scheduler/CancellableTaskFactory.h"
39 #include "platform/tracing/web_process_memory_dump.h" 39 #include "platform/tracing/web_process_memory_dump.h"
40 #include "public/platform/WebDataConsumerHandle.h" 40 #include "public/platform/WebDataConsumerHandle.h"
41 #include "wtf/Allocator.h" 41 #include "wtf/Allocator.h"
42 #include "wtf/AutoReset.h"
42 #include "wtf/HashCountedSet.h" 43 #include "wtf/HashCountedSet.h"
43 #include "wtf/HashSet.h" 44 #include "wtf/HashSet.h"
44 #include "wtf/text/WTFString.h" 45 #include "wtf/text/WTFString.h"
45 #include <memory> 46 #include <memory>
46 47
47 namespace blink { 48 namespace blink {
48 49
49 struct FetchInitiatorInfo; 50 struct FetchInitiatorInfo;
50 class CachedMetadata; 51 class CachedMetadata;
51 class FetchRequest; 52 class FetchRequest;
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 DataBufferingPolicy dataBufferingPolicy() const { 361 DataBufferingPolicy dataBufferingPolicy() const {
361 return m_options.dataBufferingPolicy; 362 return m_options.dataBufferingPolicy;
362 } 363 }
363 364
364 void setCachePolicyBypassingCache(); 365 void setCachePolicyBypassingCache();
365 void setLoFiStateOff(); 366 void setLoFiStateOff();
366 367
367 SharedBuffer* data() const { return m_data.get(); } 368 SharedBuffer* data() const { return m_data.get(); }
368 void clearData() { m_data.clear(); } 369 void clearData() { m_data.clear(); }
369 370
371 class ProhibitAddRemoveClientInScope : public AutoReset<bool> {
372 public:
373 ProhibitAddRemoveClientInScope(Resource* resource)
374 : AutoReset(&resource->m_isAddRemoveClientProhibited, true) {}
375 };
376
370 private: 377 private:
371 class ResourceCallback; 378 class ResourceCallback;
372 class CachedMetadataHandlerImpl; 379 class CachedMetadataHandlerImpl;
373 class ServiceWorkerResponseCachedMetadataHandler; 380 class ServiceWorkerResponseCachedMetadataHandler;
374 381
375 void cancelTimerFired(TimerBase*); 382 void cancelTimerFired(TimerBase*);
376 383
377 void revalidationSucceeded(const ResourceResponse&); 384 void revalidationSucceeded(const ResourceResponse&);
378 void revalidationFailed(); 385 void revalidationFailed();
379 386
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 unsigned m_status : 3; // Status 420 unsigned m_status : 3; // Status
414 421
415 unsigned m_needsSynchronousCacheHit : 1; 422 unsigned m_needsSynchronousCacheHit : 1;
416 unsigned m_linkPreload : 1; 423 unsigned m_linkPreload : 1;
417 bool m_isRevalidating : 1; 424 bool m_isRevalidating : 1;
418 bool m_isAlive : 1; 425 bool m_isAlive : 1;
419 426
420 ResourceIntegrityDisposition m_integrityDisposition; 427 ResourceIntegrityDisposition m_integrityDisposition;
421 IntegrityMetadataSet m_integrityMetadata; 428 IntegrityMetadataSet m_integrityMetadata;
422 429
430 bool m_isAddRemoveClientProhibited;
431
423 // Ordered list of all redirects followed while fetching this resource. 432 // Ordered list of all redirects followed while fetching this resource.
424 Vector<RedirectPair> m_redirectChain; 433 Vector<RedirectPair> m_redirectChain;
425 434
426 HeapHashCountedSet<WeakMember<ResourceClient>> m_clients; 435 HeapHashCountedSet<WeakMember<ResourceClient>> m_clients;
427 HeapHashCountedSet<WeakMember<ResourceClient>> m_clientsAwaitingCallback; 436 HeapHashCountedSet<WeakMember<ResourceClient>> m_clientsAwaitingCallback;
428 HeapHashCountedSet<WeakMember<ResourceClient>> m_finishedClients; 437 HeapHashCountedSet<WeakMember<ResourceClient>> m_finishedClients;
429 438
430 ResourceLoaderOptions m_options; 439 ResourceLoaderOptions m_options;
431 440
432 double m_responseTimestamp; 441 double m_responseTimestamp;
(...skipping 23 matching lines...) Expand all
456 }; 465 };
457 466
458 #define DEFINE_RESOURCE_TYPE_CASTS(typeName) \ 467 #define DEFINE_RESOURCE_TYPE_CASTS(typeName) \
459 DEFINE_TYPE_CASTS(typeName##Resource, Resource, resource, \ 468 DEFINE_TYPE_CASTS(typeName##Resource, Resource, resource, \
460 resource->getType() == Resource::typeName, \ 469 resource->getType() == Resource::typeName, \
461 resource.getType() == Resource::typeName); 470 resource.getType() == Resource::typeName);
462 471
463 } // namespace blink 472 } // namespace blink
464 473
465 #endif 474 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/fetch/MockResourceClients.h ('k') | third_party/WebKit/Source/core/fetch/Resource.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698