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

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

Issue 2438353002: Avoid copying value in ComputedStyle CoW comparions (compareEqual) (Closed)
Patch Set: Created 4 years, 1 month 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 | « no previous file | 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) 2000 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
3 * (C) 2000 Antti Koivisto (koivisto@kde.org) 3 * (C) 2000 Antti Koivisto (koivisto@kde.org)
4 * (C) 2000 Dirk Mueller (mueller@kde.org) 4 * (C) 2000 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2003, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All 5 * Copyright (C) 2003, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All
6 * rights reserved. 6 * rights reserved.
7 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com) 7 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com)
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 #include "wtf/LeakAnnotations.h" 75 #include "wtf/LeakAnnotations.h"
76 #include "wtf/RefCounted.h" 76 #include "wtf/RefCounted.h"
77 #include "wtf/Vector.h" 77 #include "wtf/Vector.h"
78 #include <memory> 78 #include <memory>
79 79
80 template <typename T, typename U> 80 template <typename T, typename U>
81 inline bool compareEqual(const T& t, const U& u) { 81 inline bool compareEqual(const T& t, const U& u) {
82 return t == static_cast<T>(u); 82 return t == static_cast<T>(u);
83 } 83 }
84 84
85 template <typename T>
86 inline bool compareEqual(const T& a, const T& b) {
87 return a == b;
88 }
89
85 #define SET_VAR(group, variable, value) \ 90 #define SET_VAR(group, variable, value) \
86 if (!compareEqual(group->variable, value)) \ 91 if (!compareEqual(group->variable, value)) \
87 group.access()->variable = value 92 group.access()->variable = value
88 93
89 #define SET_NESTED_VAR(group, base, variable, value) \ 94 #define SET_NESTED_VAR(group, base, variable, value) \
90 if (!compareEqual(group->base->variable, value)) \ 95 if (!compareEqual(group->base->variable, value)) \
91 group.access()->base.access()->variable = value 96 group.access()->base.access()->variable = value
92 97
93 #define SET_VAR_WITH_SETTER(group, getter, setter, value) \ 98 #define SET_VAR_WITH_SETTER(group, getter, setter, value) \
94 if (!compareEqual(group->getter(), value)) \ 99 if (!compareEqual(group->getter(), value)) \
(...skipping 4018 matching lines...) Expand 10 before | Expand all | Expand 10 after
4113 m_nonInheritedData.m_pseudoBits |= 1 << (pseudo - 1); 4118 m_nonInheritedData.m_pseudoBits |= 1 << (pseudo - 1);
4114 } 4119 }
4115 4120
4116 inline bool ComputedStyle::hasPseudoElementStyle() const { 4121 inline bool ComputedStyle::hasPseudoElementStyle() const {
4117 return m_nonInheritedData.m_pseudoBits & ElementPseudoIdMask; 4122 return m_nonInheritedData.m_pseudoBits & ElementPseudoIdMask;
4118 } 4123 }
4119 4124
4120 } // namespace blink 4125 } // namespace blink
4121 4126
4122 #endif // ComputedStyle_h 4127 #endif // ComputedStyle_h
OLDNEW
« 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