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

Unified Diff: third_party/WebKit/Source/core/fetch/ResourceOwner.h

Issue 1569273004: Move ResourceOwner on to the oilpan heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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/ResourceOwner.h
diff --git a/third_party/WebKit/Source/core/fetch/ResourceOwner.h b/third_party/WebKit/Source/core/fetch/ResourceOwner.h
index 20a464cfb347ff4b3a6d84617f3cd8bc2de6263c..faf0a4ec645cb7a1a89de982d48020797d222dcd 100644
--- a/third_party/WebKit/Source/core/fetch/ResourceOwner.h
+++ b/third_party/WebKit/Source/core/fetch/ResourceOwner.h
@@ -37,47 +37,24 @@ namespace blink {
template<class R, class C = typename R::ClientType>
-class ResourceOwner : public C {
+class ResourceOwner : public WillBeGarbageCollectedMixin, public C {
public:
using ResourceType = R;
- virtual ~ResourceOwner();
+ virtual ~ResourceOwner() { clearResource(); }
yhirano 2016/01/12 07:54:49 You cannot call clearResource() in the destructor
Nate Chapin 2016/01/13 20:36:33 Done.
ResourceType* resource() const { return m_resource.get(); }
protected:
- ResourceOwner();
- ResourceOwner(const ResourceOwner& other) { setResource(other.resource()); }
- explicit ResourceOwner(const ResourcePtr<ResourceType>&);
+ ResourceOwner() {}
void setResource(const ResourcePtr<ResourceType>&);
- void clearResource();
-
- ResourceOwner& operator=(const ResourceOwner& other);
+ void clearResource() { setResource(nullptr); }
private:
ResourcePtr<ResourceType> m_resource;
};
template<class R, class C>
-inline ResourceOwner<R, C>::ResourceOwner()
-{
-}
-
-template<class R, class C>
-inline ResourceOwner<R, C>::~ResourceOwner()
-{
- clearResource();
-}
-
-template<class R, class C>
-inline ResourceOwner<R, C>::ResourceOwner(const ResourcePtr<R>& resource)
- : m_resource(resource)
-{
- if (m_resource)
- m_resource->addClient(this);
-}
-
-template<class R, class C>
inline void ResourceOwner<R, C>::setResource(const ResourcePtr<R>& newResource)
{
if (newResource == m_resource)
@@ -96,21 +73,6 @@ inline void ResourceOwner<R, C>::setResource(const ResourcePtr<R>& newResource)
}
}
-template<class R, class C>
-inline void ResourceOwner<R, C>::clearResource()
-{
- setResource(0);
-}
-
-template<class R, class C>
-inline ResourceOwner<R, C>& ResourceOwner<R, C>::operator=(const ResourceOwner<R, C>& other)
-{
- if (this == &other)
- return *this;
- setResource(other.resource());
- return *this;
-}
-
} // namespace blink
#endif

Powered by Google App Engine
This is Rietveld 408576698