| OLD | NEW |
| 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 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 public: | 44 public: |
| 45 enum CounterType { | 45 enum CounterType { |
| 46 DocumentCounter, | 46 DocumentCounter, |
| 47 NodeCounter, | 47 NodeCounter, |
| 48 JSEventListenerCounter, | 48 JSEventListenerCounter, |
| 49 CounterTypeLength | 49 CounterTypeLength |
| 50 }; | 50 }; |
| 51 | 51 |
| 52 static inline void incrementCounter(CounterType type) | 52 static inline void incrementCounter(CounterType type) |
| 53 { | 53 { |
| 54 #if ENABLE(INSPECTOR) | |
| 55 ASSERT(isMainThread()); | 54 ASSERT(isMainThread()); |
| 56 ++s_counters[type]; | 55 ++s_counters[type]; |
| 57 #else | |
| 58 UNUSED_PARAM(type); | |
| 59 #endif | |
| 60 } | 56 } |
| 61 | 57 |
| 62 static inline void decrementCounter(CounterType type) | 58 static inline void decrementCounter(CounterType type) |
| 63 { | 59 { |
| 64 #if ENABLE(INSPECTOR) | |
| 65 ASSERT(isMainThread()); | 60 ASSERT(isMainThread()); |
| 66 --s_counters[type]; | 61 --s_counters[type]; |
| 67 #else | |
| 68 UNUSED_PARAM(type); | |
| 69 #endif | |
| 70 } | 62 } |
| 71 | 63 |
| 72 #if ENABLE(INSPECTOR) | |
| 73 static int counterValue(CounterType); | 64 static int counterValue(CounterType); |
| 74 #endif | |
| 75 | 65 |
| 76 private: | 66 private: |
| 77 InspectorCounters(); | 67 InspectorCounters(); |
| 78 | 68 |
| 79 #if ENABLE(INSPECTOR) | |
| 80 static int s_counters[CounterTypeLength]; | 69 static int s_counters[CounterTypeLength]; |
| 81 #endif | |
| 82 }; | 70 }; |
| 83 | 71 |
| 84 | 72 |
| 85 #if ENABLE(INSPECTOR) | |
| 86 class ThreadLocalInspectorCounters { | 73 class ThreadLocalInspectorCounters { |
| 87 WTF_MAKE_FAST_ALLOCATED; | 74 WTF_MAKE_FAST_ALLOCATED; |
| 88 public: | 75 public: |
| 89 enum CounterType { | 76 enum CounterType { |
| 90 JSEventListenerCounter, | 77 JSEventListenerCounter, |
| 91 CounterTypeLength | 78 CounterTypeLength |
| 92 }; | 79 }; |
| 93 ThreadLocalInspectorCounters(); | 80 ThreadLocalInspectorCounters(); |
| 94 | 81 |
| 95 inline void incrementCounter(CounterType type) | 82 inline void incrementCounter(CounterType type) |
| 96 { | 83 { |
| 97 ++m_counters[type]; | 84 ++m_counters[type]; |
| 98 } | 85 } |
| 99 | 86 |
| 100 inline void decrementCounter(CounterType type) | 87 inline void decrementCounter(CounterType type) |
| 101 { | 88 { |
| 102 --m_counters[type]; | 89 --m_counters[type]; |
| 103 } | 90 } |
| 104 | 91 |
| 105 int counterValue(CounterType); | 92 int counterValue(CounterType); |
| 106 | 93 |
| 107 static ThreadLocalInspectorCounters& current(); | 94 static ThreadLocalInspectorCounters& current(); |
| 108 | 95 |
| 109 private: | 96 private: |
| 110 int m_counters[CounterTypeLength]; | 97 int m_counters[CounterTypeLength]; |
| 111 }; | 98 }; |
| 112 #endif | |
| 113 | 99 |
| 114 } // namespace WebCore | 100 } // namespace WebCore |
| 115 | 101 |
| 116 #endif // !defined(InspectorCounters_h) | 102 #endif // !defined(InspectorCounters_h) |
| OLD | NEW |