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

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: 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 20 matching lines...) Expand all
31 #include "platform/SharedBuffer.h" 31 #include "platform/SharedBuffer.h"
32 #include "platform/Timer.h" 32 #include "platform/Timer.h"
33 #include "platform/network/ResourceError.h" 33 #include "platform/network/ResourceError.h"
34 #include "platform/network/ResourceLoadPriority.h" 34 #include "platform/network/ResourceLoadPriority.h"
35 #include "platform/network/ResourceRequest.h" 35 #include "platform/network/ResourceRequest.h"
36 #include "platform/network/ResourceResponse.h" 36 #include "platform/network/ResourceResponse.h"
37 #include "platform/scheduler/CancellableTaskFactory.h" 37 #include "platform/scheduler/CancellableTaskFactory.h"
38 #include "platform/web_process_memory_dump.h" 38 #include "platform/web_process_memory_dump.h"
39 #include "public/platform/WebDataConsumerHandle.h" 39 #include "public/platform/WebDataConsumerHandle.h"
40 #include "wtf/Allocator.h" 40 #include "wtf/Allocator.h"
41 #include "wtf/AutoReset.h"
41 #include "wtf/HashCountedSet.h" 42 #include "wtf/HashCountedSet.h"
42 #include "wtf/HashSet.h" 43 #include "wtf/HashSet.h"
43 #include "wtf/text/WTFString.h" 44 #include "wtf/text/WTFString.h"
44 #include <memory> 45 #include <memory>
45 46
46 namespace blink { 47 namespace blink {
47 48
48 struct FetchInitiatorInfo; 49 struct FetchInitiatorInfo;
49 class CachedMetadata; 50 class CachedMetadata;
50 class FetchRequest; 51 class FetchRequest;
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 DataBufferingPolicy dataBufferingPolicy() const { 357 DataBufferingPolicy dataBufferingPolicy() const {
357 return m_options.dataBufferingPolicy; 358 return m_options.dataBufferingPolicy;
358 } 359 }
359 360
360 void setCachePolicyBypassingCache(); 361 void setCachePolicyBypassingCache();
361 void setLoFiStateOff(); 362 void setLoFiStateOff();
362 363
363 SharedBuffer* data() const { return m_data.get(); } 364 SharedBuffer* data() const { return m_data.get(); }
364 void clearData() { m_data.clear(); } 365 void clearData() { m_data.clear(); }
365 366
367 class ProhibitAddRemoveClientInScope : public AutoReset<bool> {
368 public:
369 ProhibitAddRemoveClientInScope(Resource* resource)
370 : AutoReset(&resource->m_isAddRemoveClientProhibited, true) {}
371 };
372
366 private: 373 private:
367 class ResourceCallback; 374 class ResourceCallback;
368 class CachedMetadataHandlerImpl; 375 class CachedMetadataHandlerImpl;
369 class ServiceWorkerResponseCachedMetadataHandler; 376 class ServiceWorkerResponseCachedMetadataHandler;
370 377
371 void cancelTimerFired(TimerBase*); 378 void cancelTimerFired(TimerBase*);
372 379
373 void revalidationSucceeded(const ResourceResponse&); 380 void revalidationSucceeded(const ResourceResponse&);
374 void revalidationFailed(); 381 void revalidationFailed();
375 382
(...skipping 30 matching lines...) Expand all
406 413
407 unsigned m_preloadResult : 2; // PreloadResult 414 unsigned m_preloadResult : 2; // PreloadResult
408 unsigned m_type : 4; // Type 415 unsigned m_type : 4; // Type
409 unsigned m_status : 3; // Status 416 unsigned m_status : 3; // Status
410 417
411 unsigned m_needsSynchronousCacheHit : 1; 418 unsigned m_needsSynchronousCacheHit : 1;
412 unsigned m_linkPreload : 1; 419 unsigned m_linkPreload : 1;
413 bool m_isRevalidating : 1; 420 bool m_isRevalidating : 1;
414 bool m_isAlive : 1; 421 bool m_isAlive : 1;
415 422
423 bool m_isAddRemoveClientProhibited;
424
416 // Ordered list of all redirects followed while fetching this resource. 425 // Ordered list of all redirects followed while fetching this resource.
417 Vector<RedirectPair> m_redirectChain; 426 Vector<RedirectPair> m_redirectChain;
418 427
419 HeapHashCountedSet<WeakMember<ResourceClient>> m_clients; 428 HeapHashCountedSet<WeakMember<ResourceClient>> m_clients;
420 HeapHashCountedSet<WeakMember<ResourceClient>> m_clientsAwaitingCallback; 429 HeapHashCountedSet<WeakMember<ResourceClient>> m_clientsAwaitingCallback;
421 HeapHashCountedSet<WeakMember<ResourceClient>> m_finishedClients; 430 HeapHashCountedSet<WeakMember<ResourceClient>> m_finishedClients;
422 431
423 ResourceLoaderOptions m_options; 432 ResourceLoaderOptions m_options;
424 433
425 double m_responseTimestamp; 434 double m_responseTimestamp;
(...skipping 23 matching lines...) Expand all
449 }; 458 };
450 459
451 #define DEFINE_RESOURCE_TYPE_CASTS(typeName) \ 460 #define DEFINE_RESOURCE_TYPE_CASTS(typeName) \
452 DEFINE_TYPE_CASTS(typeName##Resource, Resource, resource, \ 461 DEFINE_TYPE_CASTS(typeName##Resource, Resource, resource, \
453 resource->getType() == Resource::typeName, \ 462 resource->getType() == Resource::typeName, \
454 resource.getType() == Resource::typeName); 463 resource.getType() == Resource::typeName);
455 464
456 } // namespace blink 465 } // namespace blink
457 466
458 #endif 467 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698