| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2008 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
| 5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
| 6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
| 7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
| 8 * | 8 * |
| 9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 #include "wtf/Assertions.h" | 23 #include "wtf/Assertions.h" |
| 24 | 24 |
| 25 #if ENABLE(ASSERT) | 25 #if ENABLE(ASSERT) |
| 26 #include "wtf/Atomics.h" | 26 #include "wtf/Atomics.h" |
| 27 #endif | 27 #endif |
| 28 | 28 |
| 29 namespace WTF { | 29 namespace WTF { |
| 30 | 30 |
| 31 #if !ENABLE(ASSERT) | 31 #if !ENABLE(ASSERT) |
| 32 | 32 |
| 33 RefCountedLeakCounter::RefCountedLeakCounter(const char*) { } | 33 RefCountedLeakCounter::RefCountedLeakCounter(const char*) {} |
| 34 RefCountedLeakCounter::~RefCountedLeakCounter() { } | 34 RefCountedLeakCounter::~RefCountedLeakCounter() {} |
| 35 | 35 |
| 36 void RefCountedLeakCounter::increment() { } | 36 void RefCountedLeakCounter::increment() {} |
| 37 void RefCountedLeakCounter::decrement() { } | 37 void RefCountedLeakCounter::decrement() {} |
| 38 | 38 |
| 39 #else | 39 #else |
| 40 | 40 |
| 41 #define LOG_CHANNEL_PREFIX Log | 41 #define LOG_CHANNEL_PREFIX Log |
| 42 static WTFLogChannel LogRefCountedLeaks = { WTFLogChannelOn }; | 42 static WTFLogChannel LogRefCountedLeaks = {WTFLogChannelOn}; |
| 43 | 43 |
| 44 RefCountedLeakCounter::RefCountedLeakCounter(const char* description) | 44 RefCountedLeakCounter::RefCountedLeakCounter(const char* description) |
| 45 : m_description(description) | 45 : m_description(description) { |
| 46 { | |
| 47 } | 46 } |
| 48 | 47 |
| 49 RefCountedLeakCounter::~RefCountedLeakCounter() | 48 RefCountedLeakCounter::~RefCountedLeakCounter() { |
| 50 { | 49 if (!m_count) |
| 51 if (!m_count) | 50 return; |
| 52 return; | |
| 53 | 51 |
| 54 WTF_LOG(RefCountedLeaks, "LEAK: %u %s", m_count, m_description); | 52 WTF_LOG(RefCountedLeaks, "LEAK: %u %s", m_count, m_description); |
| 55 } | 53 } |
| 56 | 54 |
| 57 void RefCountedLeakCounter::increment() | 55 void RefCountedLeakCounter::increment() { |
| 58 { | 56 atomicIncrement(&m_count); |
| 59 atomicIncrement(&m_count); | |
| 60 } | 57 } |
| 61 | 58 |
| 62 void RefCountedLeakCounter::decrement() | 59 void RefCountedLeakCounter::decrement() { |
| 63 { | 60 atomicDecrement(&m_count); |
| 64 atomicDecrement(&m_count); | |
| 65 } | 61 } |
| 66 | 62 |
| 67 #endif | 63 #endif |
| 68 | 64 |
| 69 } // namespace WTF | 65 } // namespace WTF |
| OLD | NEW |