OLD | NEW |
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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 // The result of stringWithTypeName<T>() is given as |funcName|. | 57 // The result of stringWithTypeName<T>() is given as |funcName|. |
58 // |extractTypeNameFromFunctionName| then extracts a typename string from | 58 // |extractTypeNameFromFunctionName| then extracts a typename string from |
59 // |funcName|. | 59 // |funcName|. |
60 String extractTypeNameFromFunctionName(const char* funcName) { | 60 String extractTypeNameFromFunctionName(const char* funcName) { |
61 #if COMPILER(CLANG) || COMPILER(GCC) || COMPILER(MSVC) | 61 #if COMPILER(CLANG) || COMPILER(GCC) || COMPILER(MSVC) |
62 size_t funcNameLength = strlen(funcName); | 62 size_t funcNameLength = strlen(funcName); |
63 DCHECK_GT(funcNameLength, | 63 DCHECK_GT(funcNameLength, |
64 stringWithTypeNamePrefixLength + stringWithTypeNamePostfixLength); | 64 stringWithTypeNamePrefixLength + stringWithTypeNamePostfixLength); |
65 | 65 |
66 const char* funcNameWithoutPrefix = funcName + stringWithTypeNamePrefixLength; | 66 const char* funcNameWithoutPrefix = funcName + stringWithTypeNamePrefixLength; |
67 return String(funcNameWithoutPrefix, funcNameLength - | 67 return String(funcNameWithoutPrefix, |
68 stringWithTypeNamePrefixLength - | 68 funcNameLength - stringWithTypeNamePrefixLength - |
69 stringWithTypeNamePostfixLength); | 69 stringWithTypeNamePostfixLength); |
70 #else | 70 #else |
71 return String("unknown"); | 71 return String("unknown"); |
72 #endif | 72 #endif |
73 } | 73 } |
74 | 74 |
75 class InstanceCounter { | 75 class InstanceCounter { |
76 public: | 76 public: |
77 void incrementInstanceCount(const String& instanceName, void* ptr); | 77 void incrementInstanceCount(const String& instanceName, void* ptr); |
78 void decrementInstanceCount(const String& instanceName, void* ptr); | 78 void decrementInstanceCount(const String& instanceName, void* ptr); |
79 String dump(); | 79 String dump(); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 | 146 |
147 #else | 147 #else |
148 | 148 |
149 String dumpRefCountedInstanceCounts() { | 149 String dumpRefCountedInstanceCounts() { |
150 return String("{}"); | 150 return String("{}"); |
151 } | 151 } |
152 | 152 |
153 #endif // ENABLE(INSTANCE_COUNTER) | 153 #endif // ENABLE(INSTANCE_COUNTER) |
154 | 154 |
155 } // namespace WTF | 155 } // namespace WTF |
OLD | NEW |