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

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: 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 b6733bbb5e5a4f4519c6f4cff58ce1b89447579b..565aef3a28cb03b4edbb6f6aba416d0c5320b326 100644
--- a/third_party/WebKit/Source/core/fetch/Resource.h
+++ b/third_party/WebKit/Source/core/fetch/Resource.h
@@ -38,6 +38,7 @@
#include "platform/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"
@@ -363,6 +364,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;
@@ -413,6 +420,8 @@ class CORE_EXPORT Resource : public GarbageCollectedFinalized<Resource>,
bool m_isRevalidating : 1;
bool m_isAlive : 1;
+ bool m_isAddRemoveClientProhibited;
+
// Ordered list of all redirects followed while fetching this resource.
Vector<RedirectPair> m_redirectChain;

Powered by Google App Engine
This is Rietveld 408576698