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

Side by Side Diff: Source/platform/Supplementable.h

Issue 327323002: Start removing the double-negative !ASSERT_DISABLED (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google, Inc. All Rights Reserved. 2 * Copyright (C) 2012 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 14 matching lines...) Expand all
25 25
26 #ifndef Supplementable_h 26 #ifndef Supplementable_h
27 #define Supplementable_h 27 #define Supplementable_h
28 28
29 #include "platform/heap/Handle.h" 29 #include "platform/heap/Handle.h"
30 #include "wtf/Assertions.h" 30 #include "wtf/Assertions.h"
31 #include "wtf/HashMap.h" 31 #include "wtf/HashMap.h"
32 #include "wtf/OwnPtr.h" 32 #include "wtf/OwnPtr.h"
33 #include "wtf/PassOwnPtr.h" 33 #include "wtf/PassOwnPtr.h"
34 34
35 #if !ASSERT_DISABLED 35 #if ASSERT_ENABLED
36 #include "wtf/Threading.h" 36 #include "wtf/Threading.h"
37 #endif 37 #endif
38 38
39 namespace WebCore { 39 namespace WebCore {
40 40
41 // What you should know about Supplementable and Supplement 41 // What you should know about Supplementable and Supplement
42 // ======================================================== 42 // ========================================================
43 // Supplementable and Supplement instances are meant to be thread local. They 43 // Supplementable and Supplement instances are meant to be thread local. They
44 // should only be accessed from within the thread that created them. The 44 // should only be accessed from within the thread that created them. The
45 // 2 classes are not designed for safe access from another thread. Violating 45 // 2 classes are not designed for safe access from another thread. Violating
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 } 173 }
174 174
175 SupplementBase<T, isGarbageCollected>* requireSupplement(const char* key) 175 SupplementBase<T, isGarbageCollected>* requireSupplement(const char* key)
176 { 176 {
177 ASSERT(m_threadId == currentThread()); 177 ASSERT(m_threadId == currentThread());
178 return this->m_supplements.get(key); 178 return this->m_supplements.get(key);
179 } 179 }
180 180
181 void reattachThread() 181 void reattachThread()
182 { 182 {
183 #if !ASSERT_DISABLED 183 #if ASSERT_ENABLED
184 m_threadId = currentThread(); 184 m_threadId = currentThread();
185 #endif 185 #endif
186 } 186 }
187 187
188 virtual void trace(Visitor* visitor) { visitor->trace(m_supplements); } 188 virtual void trace(Visitor* visitor) { visitor->trace(m_supplements); }
189 189
190 void willBeDestroyed() 190 void willBeDestroyed()
191 { 191 {
192 typedef typename SupplementableTraits<T, isGarbageCollected>::Supplement Map::iterator SupplementIterator; 192 typedef typename SupplementableTraits<T, isGarbageCollected>::Supplement Map::iterator SupplementIterator;
193 for (SupplementIterator it = m_supplements.begin(); it != m_supplements. end(); ++it) 193 for (SupplementIterator it = m_supplements.begin(); it != m_supplements. end(); ++it)
194 it->value->willBeDestroyed(); 194 it->value->willBeDestroyed();
195 } 195 }
196 196
197 private: 197 private:
198 // FIXME: Oilpan: Remove this ignore once PersistentHeapSupplementable is re moved again. 198 // FIXME: Oilpan: Remove this ignore once PersistentHeapSupplementable is re moved again.
199 GC_PLUGIN_IGNORE("") 199 GC_PLUGIN_IGNORE("")
200 typename SupplementableTraits<T, isGarbageCollected>::SupplementMap m_supple ments; 200 typename SupplementableTraits<T, isGarbageCollected>::SupplementMap m_supple ments;
201 201
202 #if !ASSERT_DISABLED 202 #if ASSERT_ENABLED
203 protected: 203 protected:
204 SupplementableBase() : m_threadId(currentThread()) { } 204 SupplementableBase() : m_threadId(currentThread()) { }
205 205
206 private: 206 private:
207 ThreadIdentifier m_threadId; 207 ThreadIdentifier m_threadId;
208 #endif 208 #endif
209 }; 209 };
210 210
211 template<typename T> 211 template<typename T>
212 class HeapSupplement : public SupplementBase<T, true> { }; 212 class HeapSupplement : public SupplementBase<T, true> { };
(...skipping 30 matching lines...) Expand all
243 }; 243 };
244 244
245 template<typename T> 245 template<typename T>
246 struct ThreadingTrait<WebCore::SupplementableBase<T, true> > { 246 struct ThreadingTrait<WebCore::SupplementableBase<T, true> > {
247 static const ThreadAffinity Affinity = ThreadingTrait<T>::Affinity; 247 static const ThreadAffinity Affinity = ThreadingTrait<T>::Affinity;
248 }; 248 };
249 249
250 } // namespace WebCore 250 } // namespace WebCore
251 251
252 #endif // Supplementable_h 252 #endif // Supplementable_h
OLDNEW
« no previous file with comments | « Source/modules/webdatabase/DatabaseManager.cpp ('k') | Source/platform/audio/android/FFTFrameOpenMAXDLAndroid.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698