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

Side by Side Diff: public/platform/WebPrivatePtr.h

Issue 802633005: replace COMPILE_ASSERT with static_assert in public/platform/ (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: improve static_assert msgs Created 6 years 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 | « public/platform/WebPrivateOwnPtr.h ('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) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 void assign(const PassRefPtrWillBeRawPtr<T>& val) { PtrStorageImpl<T, Garbag eCollectedLifetime>::assign(val.get()); } 131 void assign(const PassRefPtrWillBeRawPtr<T>& val) { PtrStorageImpl<T, Garbag eCollectedLifetime>::assign(val.get()); }
132 132
133 void assign(const PtrStorageImpl& other) { PtrStorageImpl<T, GarbageCollecte dLifetime>::assign(other.get()); } 133 void assign(const PtrStorageImpl& other) { PtrStorageImpl<T, GarbageCollecte dLifetime>::assign(other.get()); }
134 }; 134 };
135 135
136 template<typename T> 136 template<typename T>
137 class PtrStorage : public PtrStorageImpl<T, LifetimeOf<T>::value> { 137 class PtrStorage : public PtrStorageImpl<T, LifetimeOf<T>::value> {
138 public: 138 public:
139 static PtrStorage& fromSlot(void** slot) 139 static PtrStorage& fromSlot(void** slot)
140 { 140 {
141 COMPILE_ASSERT(sizeof(PtrStorage) == sizeof(void*), PtrStorage_must_be_p ointer_size); 141 static_assert(sizeof(PtrStorage) == sizeof(void*), "PtrStorage must be t he size of a pointer");
142 return *reinterpret_cast<PtrStorage*>(slot); 142 return *reinterpret_cast<PtrStorage*>(slot);
143 } 143 }
144 144
145 static const PtrStorage& fromSlot(void* const* slot) 145 static const PtrStorage& fromSlot(void* const* slot)
146 { 146 {
147 COMPILE_ASSERT(sizeof(PtrStorage) == sizeof(void*), PtrStorage_must_be_p ointer_size); 147 static_assert(sizeof(PtrStorage) == sizeof(void*), "PtrStorage must be t he size of a pointer");
148 return *reinterpret_cast<const PtrStorage*>(slot); 148 return *reinterpret_cast<const PtrStorage*>(slot);
149 } 149 }
150 150
151 private: 151 private:
152 // Prevent construction via normal means. 152 // Prevent construction via normal means.
153 PtrStorage(); 153 PtrStorage();
154 PtrStorage(const PtrStorage&); 154 PtrStorage(const PtrStorage&);
155 }; 155 };
156 #endif 156 #endif
157 157
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 // Disable the copy constructor; classes that contain a WebPrivatePtr 261 // Disable the copy constructor; classes that contain a WebPrivatePtr
262 // should implement their copy constructor using assign(). 262 // should implement their copy constructor using assign().
263 WebPrivatePtr(const WebPrivatePtr<T>&); 263 WebPrivatePtr(const WebPrivatePtr<T>&);
264 264
265 void* m_storage; 265 void* m_storage;
266 }; 266 };
267 267
268 } // namespace blink 268 } // namespace blink
269 269
270 #endif 270 #endif
OLDNEW
« no previous file with comments | « public/platform/WebPrivateOwnPtr.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698