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

Side by Side Diff: Source/wtf/InstanceCounter.h

Issue 1317563005: Fix binary size increase because of class name loading. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: fix build. Created 5 years, 3 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 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 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 16 matching lines...) Expand all
27 #define InstanceCounter_h 27 #define InstanceCounter_h
28 28
29 #include "wtf/Compiler.h" 29 #include "wtf/Compiler.h"
30 #include "wtf/WTFExport.h" 30 #include "wtf/WTFExport.h"
31 31
32 namespace WTF { 32 namespace WTF {
33 33
34 class String; 34 class String;
35 WTF_EXPORT String dumpRefCountedInstanceCounts(); 35 WTF_EXPORT String dumpRefCountedInstanceCounts();
36 36
37 // Warning: Using extractTypeNameFromFunctionName bloats binary size. 37 #if ENABLE(INSTANCE_COUNTER) || ENABLE(GC_PROFILING)
38 // This function should be only used for debug and profiling purposes, 38 WTF_EXPORT void incrementInstanceCount(const char* extractNameFunctionName, void * ptr);
39 // and should be never enabled on release builds. 39 WTF_EXPORT void decrementInstanceCount(const char* extractNameFunctionName, void * ptr);
40 // TODO(kouhei): Move this inside #if when all dependencies are removed. 40
41 WTF_EXPORT String extractTypeNameFromFunctionName(const char* funcName); 41 WTF_EXPORT String extractTypeNameFromFunctionName(const char* funcName);
42 42
43 template<typename T> 43 template<typename T>
44 inline const char* extractNameFunction() 44 inline const char* extractNameFunction()
45 { 45 {
46 return WTF_PRETTY_FUNCTION; 46 return WTF_PRETTY_FUNCTION;
47 } 47 }
48 48
49 #if ENABLE(INSTANCE_COUNTER) || ENABLE(GC_PROFILING)
50 WTF_EXPORT void incrementInstanceCount(const char* extractNameFunctionName, void * ptr);
51 WTF_EXPORT void decrementInstanceCount(const char* extractNameFunctionName, void * ptr);
52 49
53 template<typename T> 50 template<typename T>
54 inline void incrementInstanceCount(T* p) 51 inline void incrementInstanceCount(T* p)
55 { 52 {
56 incrementInstanceCount(extractNameFunction<T>(), p); 53 incrementInstanceCount(extractNameFunction<T>(), p);
57 } 54 }
58 55
59 template<typename T> 56 template<typename T>
60 inline void decrementInstanceCount(T* p) 57 inline void decrementInstanceCount(T* p)
61 { 58 {
62 decrementInstanceCount(extractNameFunction<T>(), p); 59 decrementInstanceCount(extractNameFunction<T>(), p);
63 } 60 }
64 61
65 #endif // ENABLE(INSTANCE_COUNTER) || ENABLE(GC_PROFILING) 62 #endif // ENABLE(INSTANCE_COUNTER) || ENABLE(GC_PROFILING)
66 63
67 } // namespace WTF 64 } // namespace WTF
68 65
69 #endif 66 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698