OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 UI_AURA_WINDOW_PROPERTY_H_ | 5 #ifndef UI_AURA_WINDOW_PROPERTY_H_ |
6 #define UI_AURA_WINDOW_PROPERTY_H_ | 6 #define UI_AURA_WINDOW_PROPERTY_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "ui/aura/aura_export.h" | 9 #include "ui/aura/aura_export.h" |
10 #include "ui/aura/window.h" | 10 #include "ui/aura/window.h" |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 } \ | 122 } \ |
123 template<> EXPORT void Window::ClearProperty( \ | 123 template<> EXPORT void Window::ClearProperty( \ |
124 const WindowProperty<T >* property) { \ | 124 const WindowProperty<T >* property) { \ |
125 subtle::PropertyHelper::Clear<T>(this, property); \ | 125 subtle::PropertyHelper::Clear<T>(this, property); \ |
126 } \ | 126 } \ |
127 } | 127 } |
128 #define DECLARE_WINDOW_PROPERTY_TYPE(T) \ | 128 #define DECLARE_WINDOW_PROPERTY_TYPE(T) \ |
129 DECLARE_EXPORTED_WINDOW_PROPERTY_TYPE(, T) | 129 DECLARE_EXPORTED_WINDOW_PROPERTY_TYPE(, T) |
130 | 130 |
131 #define DEFINE_WINDOW_PROPERTY_KEY(TYPE, NAME, DEFAULT) \ | 131 #define DEFINE_WINDOW_PROPERTY_KEY(TYPE, NAME, DEFAULT) \ |
132 COMPILE_ASSERT(sizeof(TYPE) <= sizeof(int64), property_type_too_large); \ | 132 static_assert(sizeof(TYPE) <= sizeof(int64), "property type too large"); \ |
133 namespace { \ | 133 namespace { \ |
134 const aura::WindowProperty<TYPE> NAME ## _Value = \ | 134 const aura::WindowProperty<TYPE> NAME ## _Value = \ |
135 {DEFAULT, #NAME, nullptr}; \ | 135 {DEFAULT, #NAME, nullptr}; \ |
136 } \ | 136 } \ |
137 const aura::WindowProperty<TYPE>* const NAME = & NAME ## _Value; | 137 const aura::WindowProperty<TYPE>* const NAME = & NAME ## _Value; |
138 | 138 |
139 #define DEFINE_LOCAL_WINDOW_PROPERTY_KEY(TYPE, NAME, DEFAULT) \ | 139 #define DEFINE_LOCAL_WINDOW_PROPERTY_KEY(TYPE, NAME, DEFAULT) \ |
140 COMPILE_ASSERT(sizeof(TYPE) <= sizeof(int64), property_type_too_large); \ | 140 static_assert(sizeof(TYPE) <= sizeof(int64), "property type too large"); \ |
141 namespace { \ | 141 namespace { \ |
142 const aura::WindowProperty<TYPE> NAME ## _Value = \ | 142 const aura::WindowProperty<TYPE> NAME ## _Value = \ |
143 {DEFAULT, #NAME, nullptr}; \ | 143 {DEFAULT, #NAME, nullptr}; \ |
144 const aura::WindowProperty<TYPE>* const NAME = & NAME ## _Value; \ | 144 const aura::WindowProperty<TYPE>* const NAME = & NAME ## _Value; \ |
145 } | 145 } |
146 | 146 |
147 #define DEFINE_OWNED_WINDOW_PROPERTY_KEY(TYPE, NAME, DEFAULT) \ | 147 #define DEFINE_OWNED_WINDOW_PROPERTY_KEY(TYPE, NAME, DEFAULT) \ |
148 namespace { \ | 148 namespace { \ |
149 void Deallocator ## NAME (int64 p) { \ | 149 void Deallocator ## NAME (int64 p) { \ |
150 enum { type_must_be_complete = sizeof(TYPE) }; \ | 150 enum { type_must_be_complete = sizeof(TYPE) }; \ |
151 delete aura::WindowPropertyCaster<TYPE*>::FromInt64(p); \ | 151 delete aura::WindowPropertyCaster<TYPE*>::FromInt64(p); \ |
152 } \ | 152 } \ |
153 const aura::WindowProperty<TYPE*> NAME ## _Value = \ | 153 const aura::WindowProperty<TYPE*> NAME ## _Value = \ |
154 {DEFAULT,#NAME,&Deallocator ## NAME}; \ | 154 {DEFAULT,#NAME,&Deallocator ## NAME}; \ |
155 } \ | 155 } \ |
156 const aura::WindowProperty<TYPE*>* const NAME = & NAME ## _Value; | 156 const aura::WindowProperty<TYPE*>* const NAME = & NAME ## _Value; |
157 | 157 |
158 #endif // UI_AURA_WINDOW_PROPERTY_H_ | 158 #endif // UI_AURA_WINDOW_PROPERTY_H_ |
OLD | NEW |