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

Side by Side Diff: Source/platform/heap/Handle.h

Issue 1275863002: Oilpan: catch some self-referential leaks (main thread.) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: add stdio.h include Created 5 years, 4 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
« no previous file with comments | « no previous file | Source/platform/heap/PersistentNode.h » ('j') | 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) 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 930 matching lines...) Expand 10 before | Expand all | Expand 10 after
941 } 941 }
942 942
943 SelfKeepAlive& operator=(Self* self) 943 SelfKeepAlive& operator=(Self* self)
944 { 944 {
945 assign(self); 945 assign(self);
946 return *this; 946 return *this;
947 } 947 }
948 948
949 void clear() 949 void clear()
950 { 950 {
951 #if ENABLE(ASSERT)
952 if (m_keepAlive)
953 ThreadState::decrementSelfKeepAliveAllocations();
954 #endif
951 m_keepAlive.clear(); 955 m_keepAlive.clear();
952 } 956 }
953 957
954 typedef OwnPtr<Persistent<Self>> (SelfKeepAlive::*UnspecifiedBoolType); 958 typedef OwnPtr<Persistent<Self>> (SelfKeepAlive::*UnspecifiedBoolType);
955 operator UnspecifiedBoolType() const { return m_keepAlive ? &SelfKeepAlive:: m_keepAlive : 0; } 959 operator UnspecifiedBoolType() const { return m_keepAlive ? &SelfKeepAlive:: m_keepAlive : 0; }
956 960
957 private: 961 private:
958 void assign(Self* self) 962 void assign(Self* self)
959 { 963 {
960 ASSERT(!m_keepAlive || m_keepAlive->get() == self); 964 ASSERT(!m_keepAlive || m_keepAlive->get() == self);
961 if (!m_keepAlive) 965 if (!m_keepAlive) {
962 m_keepAlive = adoptPtr(new Persistent<Self>); 966 m_keepAlive = adoptPtr(new Persistent<Self>);
967 #if ENABLE(ASSERT)
968 ThreadState::incrementSelfKeepAliveAllocations();
969 #endif
970 }
963 *m_keepAlive = self; 971 *m_keepAlive = self;
964 } 972 }
965 973
966 GC_PLUGIN_IGNORE("420515") 974 GC_PLUGIN_IGNORE("420515")
967 OwnPtr<Persistent<Self>> m_keepAlive; 975 OwnPtr<Persistent<Self>> m_keepAlive;
968 }; 976 };
969 977
970 } // namespace blink 978 } // namespace blink
971 979
972 namespace WTF { 980 namespace WTF {
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
1156 struct ParamStorageTraits<RawPtr<T>> : public PointerParamStorageTraits<T*, blin k::IsGarbageCollectedType<T>::value> { 1164 struct ParamStorageTraits<RawPtr<T>> : public PointerParamStorageTraits<T*, blin k::IsGarbageCollectedType<T>::value> {
1157 static_assert(sizeof(T), "T must be fully defined"); 1165 static_assert(sizeof(T), "T must be fully defined");
1158 }; 1166 };
1159 1167
1160 template<typename T> 1168 template<typename T>
1161 PassRefPtr<T> adoptRef(blink::RefCountedGarbageCollected<T>*) = delete; 1169 PassRefPtr<T> adoptRef(blink::RefCountedGarbageCollected<T>*) = delete;
1162 1170
1163 } // namespace WTF 1171 } // namespace WTF
1164 1172
1165 #endif 1173 #endif
OLDNEW
« no previous file with comments | « no previous file | Source/platform/heap/PersistentNode.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698