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

Side by Side Diff: third_party/WebKit/Source/platform/Supplementable.h

Issue 2611133002: Remove ContextClient from NavigatorBeacon (Closed)
Patch Set: temp Created 3 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/modules/beacon/NavigatorBeacon.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google, Inc. All Rights Reserved. 2 * Copyright (C) 2012 Google, Inc. All Rights Reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 91
92 template <typename T> 92 template <typename T>
93 class Supplementable; 93 class Supplementable;
94 94
95 template <typename T> 95 template <typename T>
96 class Supplement : public GarbageCollectedMixin { 96 class Supplement : public GarbageCollectedMixin {
97 public: 97 public:
98 // TODO(haraken): Remove the default constructor. 98 // TODO(haraken): Remove the default constructor.
99 // All Supplement objects should be instantiated with m_host. 99 // All Supplement objects should be instantiated with m_host.
100 Supplement() {} 100 Supplement() {}
101
101 explicit Supplement(T& host) : m_host(&host) {} 102 explicit Supplement(T& host) : m_host(&host) {}
103
104 // Supplementable and its supplements live and die together.
105 // Thus host() should never return null (if the default constructor
106 // is completely removed).
102 T* host() const { return m_host; } 107 T* host() const { return m_host; }
103 108
104 static void provideTo(Supplementable<T>& host, 109 static void provideTo(Supplementable<T>& host,
105 const char* key, 110 const char* key,
106 Supplement<T>* supplement) { 111 Supplement<T>* supplement) {
107 host.provideSupplement(key, supplement); 112 host.provideSupplement(key, supplement);
108 } 113 }
109 114
110 static Supplement<T>* from(Supplementable<T>& host, const char* key) { 115 static Supplement<T>* from(Supplementable<T>& host, const char* key) {
111 return host.requireSupplement(key); 116 return host.requireSupplement(key);
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 }; 188 };
184 189
185 template <typename T> 190 template <typename T>
186 struct ThreadingTrait<Supplementable<T>> { 191 struct ThreadingTrait<Supplementable<T>> {
187 static const ThreadAffinity Affinity = ThreadingTrait<T>::Affinity; 192 static const ThreadAffinity Affinity = ThreadingTrait<T>::Affinity;
188 }; 193 };
189 194
190 } // namespace blink 195 } // namespace blink
191 196
192 #endif // Supplementable_h 197 #endif // Supplementable_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/beacon/NavigatorBeacon.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698