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

Side by Side Diff: third_party/WebKit/Source/core/style/MemberCopy.h

Issue 2926053002: Make RareNonInheritedData use MemberCopy and DataEquivalent. (Closed)
Patch Set: Rebase Created 3 years, 6 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
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef MemberCopy_h 5 #ifndef MemberCopy_h
6 #define MemberCopy_h 6 #define MemberCopy_h
7 7
8 #include <memory>
9 #include "core/style/ContentData.h"
10 #include "core/style/DataPersistent.h"
11 #include "core/style/DataRef.h"
8 #include "platform/heap/Persistent.h" 12 #include "platform/heap/Persistent.h"
9 #include "platform/wtf/RefPtr.h" 13 #include "platform/wtf/RefPtr.h"
10 14
11 namespace blink { 15 namespace blink {
12 16
13 template <typename T> 17 template <typename T>
14 RefPtr<T> MemberCopy(const RefPtr<T>& v) { 18 RefPtr<T> MemberCopy(const RefPtr<T>& v) {
15 return v; 19 return v;
16 } 20 }
17 21
18 template <typename T> 22 template <typename T>
19 Persistent<T> MemberCopy(const Persistent<T>& v) { 23 Persistent<T> MemberCopy(const Persistent<T>& v) {
20 return v; 24 return v;
21 } 25 }
22 26
27 template <typename T>
28 std::unique_ptr<T> MemberCopy(const std::unique_ptr<T>& v) {
29 return v ? v->Clone() : nullptr;
30 }
31
32 template <typename T>
33 DataPersistent<T> MemberCopy(const DataPersistent<T>& v) {
34 return v;
35 }
36
37 // TODO(shend): Remove this once all subgroups of StyleRareNonInheritedData are
38 // generated
39 template <typename T>
40 DataRef<T> MemberCopy(const DataRef<T>& v) {
41 return v;
42 }
43
44 inline Persistent<ContentData> MemberCopy(const Persistent<ContentData>& v) {
45 return v ? v->Clone() : nullptr;
46 }
47
23 } // namespace blink 48 } // namespace blink
24 49
25 #endif // MemberCopy_h 50 #endif // MemberCopy_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698