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

Side by Side Diff: components/mus/public/cpp/window_property.h

Issue 2029883002: Moves mash/wm into ash/mus (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@remove_static_assert
Patch Set: depend on test_wm Created 4 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 COMPONENTS_MUS_PUBLIC_CPP_WINDOW_PROPERTY_H_ 5 #ifndef COMPONENTS_MUS_PUBLIC_CPP_WINDOW_PROPERTY_H_
6 #define COMPONENTS_MUS_PUBLIC_CPP_WINDOW_PROPERTY_H_ 6 #define COMPONENTS_MUS_PUBLIC_CPP_WINDOW_PROPERTY_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 // To define a new WindowProperty: 10 // To define a new WindowProperty:
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 110
111 template <typename T> 111 template <typename T>
112 void Window::ClearLocalProperty(const WindowProperty<T>* property) { 112 void Window::ClearLocalProperty(const WindowProperty<T>* property) {
113 SetLocalProperty(property, property->default_value); 113 SetLocalProperty(property, property->default_value);
114 } 114 }
115 115
116 } // namespace mus 116 } // namespace mus
117 117
118 // Macros to instantiate the property getter/setter template functions. 118 // Macros to instantiate the property getter/setter template functions.
119 #define MUS_DECLARE_EXPORTED_WINDOW_PROPERTY_TYPE(EXPORT, T) \ 119 #define MUS_DECLARE_EXPORTED_WINDOW_PROPERTY_TYPE(EXPORT, T) \
120 template EXPORT void mus::Window::SetLocalProperty( \ 120 template EXPORT void ::mus::Window::SetLocalProperty( \
121 const mus::WindowProperty<T>*, T); \ 121 const ::mus::WindowProperty<T>*, T); \
122 template EXPORT T mus::Window::GetLocalProperty( \ 122 template EXPORT T::mus::Window::GetLocalProperty( \
123 const mus::WindowProperty<T>*) const; \ 123 const ::mus::WindowProperty<T>*) const; \
124 template EXPORT void mus::Window::ClearLocalProperty( \ 124 template EXPORT void ::mus::Window::ClearLocalProperty( \
125 const mus::WindowProperty<T>*); 125 const ::mus::WindowProperty<T>*);
126 #define MUS_DECLARE_WINDOW_PROPERTY_TYPE(T) \ 126 #define MUS_DECLARE_WINDOW_PROPERTY_TYPE(T) \
127 MUS_DECLARE_EXPORTED_WINDOW_PROPERTY_TYPE(, T) 127 MUS_DECLARE_EXPORTED_WINDOW_PROPERTY_TYPE(, T)
128 128
129 #define MUS_DEFINE_WINDOW_PROPERTY_KEY(TYPE, NAME, DEFAULT) \ 129 #define MUS_DEFINE_WINDOW_PROPERTY_KEY(TYPE, NAME, DEFAULT) \
130 static_assert(sizeof(TYPE) <= sizeof(int64_t), \ 130 static_assert(sizeof(TYPE) <= sizeof(int64_t), \
131 "Property type must fit in 64 bits"); \ 131 "Property type must fit in 64 bits"); \
132 namespace { \ 132 namespace { \
133 const mus::WindowProperty<TYPE> NAME##_Value = {DEFAULT, #NAME, nullptr}; \ 133 const ::mus::WindowProperty<TYPE> NAME##_Value = {DEFAULT, #NAME, nullptr}; \
134 } \ 134 } \
135 const mus::WindowProperty<TYPE>* const NAME = &NAME##_Value; 135 const ::mus::WindowProperty<TYPE>* const NAME = &NAME##_Value;
136 136
137 #define MUS_DEFINE_LOCAL_WINDOW_PROPERTY_KEY(TYPE, NAME, DEFAULT) \ 137 #define MUS_DEFINE_LOCAL_WINDOW_PROPERTY_KEY(TYPE, NAME, DEFAULT) \
138 static_assert(sizeof(TYPE) <= sizeof(int64_t), \ 138 static_assert(sizeof(TYPE) <= sizeof(int64_t), \
139 "Property type must fit in 64 bits"); \ 139 "Property type must fit in 64 bits"); \
140 namespace { \ 140 namespace { \
141 const mus::WindowProperty<TYPE> NAME##_Value = {DEFAULT, #NAME, nullptr}; \ 141 const ::mus::WindowProperty<TYPE> NAME##_Value = {DEFAULT, #NAME, nullptr}; \
142 const mus::WindowProperty<TYPE>* const NAME = &NAME##_Value; \ 142 const ::mus::WindowProperty<TYPE>* const NAME = &NAME##_Value; \
143 } 143 }
144 144
145 #define MUS_DEFINE_OWNED_WINDOW_PROPERTY_KEY(TYPE, NAME, DEFAULT) \ 145 #define MUS_DEFINE_OWNED_WINDOW_PROPERTY_KEY(TYPE, NAME, DEFAULT) \
146 namespace { \ 146 namespace { \
147 void Deallocator##NAME(int64_t p) { \ 147 void Deallocator##NAME(int64_t p) { \
148 enum { type_must_be_complete = sizeof(TYPE) }; \ 148 enum { type_must_be_complete = sizeof(TYPE) }; \
149 delete mus::WindowPropertyCaster<TYPE*>::FromInt64(p); \ 149 delete ::mus::WindowPropertyCaster<TYPE*>::FromInt64(p); \
150 } \ 150 } \
151 const mus::WindowProperty<TYPE*> NAME##_Value = {DEFAULT, #NAME, \ 151 const ::mus::WindowProperty<TYPE*> NAME##_Value = {DEFAULT, #NAME, \
152 &Deallocator##NAME}; \ 152 &Deallocator##NAME}; \
153 } \ 153 } \
154 const mus::WindowProperty<TYPE*>* const NAME = &NAME##_Value; 154 const ::mus::WindowProperty<TYPE*>* const NAME = &NAME##_Value;
155 155
156 #endif // COMPONENTS_MUS_PUBLIC_CPP_WINDOW_PROPERTY_H_ 156 #endif // COMPONENTS_MUS_PUBLIC_CPP_WINDOW_PROPERTY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698