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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/fetch/Resource.h
diff --git a/third_party/WebKit/Source/core/fetch/Resource.h b/third_party/WebKit/Source/core/fetch/Resource.h
index 365fd3f0c777f971d9a13edbc842717b558f00cd..a8066ef6e97e8cb0c18a6bd1a3447aa9b2043f2c 100644
--- a/third_party/WebKit/Source/core/fetch/Resource.h
+++ b/third_party/WebKit/Source/core/fetch/Resource.h
@@ -39,6 +39,7 @@
#include "platform/tracing/web_process_memory_dump.h"
#include "public/platform/WebDataConsumerHandle.h"
#include "wtf/Allocator.h"
+#include "wtf/AutoReset.h"
#include "wtf/HashCountedSet.h"
#include "wtf/HashSet.h"
#include "wtf/text/WTFString.h"
@@ -367,6 +368,12 @@ class CORE_EXPORT Resource : public GarbageCollectedFinalized<Resource>,
SharedBuffer* data() const { return m_data.get(); }
void clearData() { m_data.clear(); }
+ class ProhibitAddRemoveClientInScope : public AutoReset<bool> {
+ public:
+ ProhibitAddRemoveClientInScope(Resource* resource)
+ : AutoReset(&resource->m_isAddRemoveClientProhibited, true) {}
+ };
+
private:
class ResourceCallback;
class CachedMetadataHandlerImpl;
@@ -420,6 +427,8 @@ class CORE_EXPORT Resource : public GarbageCollectedFinalized<Resource>,
ResourceIntegrityDisposition m_integrityDisposition;
IntegrityMetadataSet m_integrityMetadata;
+ bool m_isAddRemoveClientProhibited;
+
// Ordered list of all redirects followed while fetching this resource.
Vector<RedirectPair> m_redirectChain;
« 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