| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2014 Google Inc. All rights reserved. | 2 * Copyright (C) 2014 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 1218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1229 } | 1229 } |
| 1230 | 1230 |
| 1231 SelfKeepAlive& operator=(Self* self) | 1231 SelfKeepAlive& operator=(Self* self) |
| 1232 { | 1232 { |
| 1233 assign(self); | 1233 assign(self); |
| 1234 return *this; | 1234 return *this; |
| 1235 } | 1235 } |
| 1236 | 1236 |
| 1237 void clear() | 1237 void clear() |
| 1238 { | 1238 { |
| 1239 #if ENABLE(ASSERT) |
| 1240 if (m_keepAlive) |
| 1241 ThreadState::current()->decrementNumberOfSelfRefs(); |
| 1242 #endif |
| 1239 m_keepAlive.clear(); | 1243 m_keepAlive.clear(); |
| 1240 } | 1244 } |
| 1241 | 1245 |
| 1242 typedef Persistent<Self> (SelfKeepAlive::*UnspecifiedBoolType); | 1246 typedef Persistent<Self> (SelfKeepAlive::*UnspecifiedBoolType); |
| 1243 operator UnspecifiedBoolType() const { return m_keepAlive ? &SelfKeepAlive::
m_keepAlive : 0; } | 1247 operator UnspecifiedBoolType() const { return m_keepAlive ? &SelfKeepAlive::
m_keepAlive : 0; } |
| 1244 | 1248 |
| 1245 private: | 1249 private: |
| 1246 void assign(Self* self) | 1250 void assign(Self* self) |
| 1247 { | 1251 { |
| 1248 ASSERT(!m_keepAlive || m_keepAlive.get() == self); | 1252 ASSERT(!m_keepAlive || m_keepAlive.get() == self); |
| 1249 m_keepAlive = self; | 1253 m_keepAlive = self; |
| 1254 #if ENABLE(ASSERT) |
| 1255 ThreadState::current()->incrementNumberOfSelfRefs(); |
| 1256 #endif |
| 1250 } | 1257 } |
| 1251 | 1258 |
| 1252 GC_PLUGIN_IGNORE("420515") | 1259 GC_PLUGIN_IGNORE("420515") |
| 1253 Persistent<Self> m_keepAlive; | 1260 Persistent<Self> m_keepAlive; |
| 1254 }; | 1261 }; |
| 1255 | 1262 |
| 1256 template<typename T> | 1263 template<typename T> |
| 1257 class AllowCrossThreadWeakPersistent { | 1264 class AllowCrossThreadWeakPersistent { |
| 1258 STACK_ALLOCATED(); | 1265 STACK_ALLOCATED(); |
| 1259 public: | 1266 public: |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1504 // TODO(sof): extend WTF::FunctionWrapper call overloading to also handle (C
rossThread)WeakPersistent. | 1511 // TODO(sof): extend WTF::FunctionWrapper call overloading to also handle (C
rossThread)WeakPersistent. |
| 1505 static T* unwrap(const StorageType& value) { return value.get(); } | 1512 static T* unwrap(const StorageType& value) { return value.get(); } |
| 1506 }; | 1513 }; |
| 1507 | 1514 |
| 1508 template<typename T> | 1515 template<typename T> |
| 1509 PassRefPtr<T> adoptRef(blink::RefCountedGarbageCollected<T>*) = delete; | 1516 PassRefPtr<T> adoptRef(blink::RefCountedGarbageCollected<T>*) = delete; |
| 1510 | 1517 |
| 1511 } // namespace WTF | 1518 } // namespace WTF |
| 1512 | 1519 |
| 1513 #endif | 1520 #endif |
| OLD | NEW |