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

Unified Diff: third_party/WebKit/Source/platform/Supplementable.h

Issue 2136473002: Make Supplement and Supplementable live and die together Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/Supplementable.h
diff --git a/third_party/WebKit/Source/platform/Supplementable.h b/third_party/WebKit/Source/platform/Supplementable.h
index f60bc753d2baaed75356aff073a8d0d3096d37c3..dc37f5de49381c688fe12c5f5350b48c2a30fd5a 100644
--- a/third_party/WebKit/Source/platform/Supplementable.h
+++ b/third_party/WebKit/Source/platform/Supplementable.h
@@ -93,6 +93,11 @@ class Supplementable;
template<typename T>
class Supplement : public GarbageCollectedMixin {
public:
+ // TODO(haraken): Remove this default constructor.
haraken 2016/07/08 06:37:29 I'll fix the TODO before committing. But I want to
sof 2016/07/08 07:07:02 Before Oilpan, Supplementable provided OwnPtr<>-ow
haraken 2016/07/08 07:17:37 Thanks for the details. I feel that it would make
+ Supplement() : m_host(nullptr) { }
+ explicit Supplement(T* host) : m_host(host) { }
+ T* host() const { return m_host; }
+
static void provideTo(Supplementable<T>& host, const char* key, Supplement<T>* supplement)
{
host.provideSupplement(key, supplement);
@@ -107,6 +112,14 @@ public:
{
return host ? host->requireSupplement(key) : 0;
}
+
+ DEFINE_INLINE_VIRTUAL_TRACE()
+ {
+ visitor->trace(m_host);
+ }
+
+private:
+ Member<T> m_host;
};
// Supplementable<T> inherits from GarbageCollectedMixin virtually
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698