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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 #elif COMPILER(MSVC) | 47 #elif COMPILER(MSVC) |
48 const size_t stringWithTypeNamePrefixLength = | 48 const size_t stringWithTypeNamePrefixLength = |
49 sizeof("const char *__cdecl WTF::getStringWithTypeName<class ") - 1; | 49 sizeof("const char *__cdecl WTF::getStringWithTypeName<class ") - 1; |
50 const size_t stringWithTypeNamePostfixLength = sizeof(">(void)") - 1; | 50 const size_t stringWithTypeNamePostfixLength = sizeof(">(void)") - 1; |
51 #else | 51 #else |
52 #warning \ | 52 #warning \ |
53 "Extracting typename is supported only in compiler GCC, CLANG and MSVC at th
is moment" | 53 "Extracting typename is supported only in compiler GCC, CLANG and MSVC at th
is moment" |
54 #endif | 54 #endif |
55 | 55 |
56 // This function is used to stringify a typename T without using RTTI. | 56 // This function is used to stringify a typename T without using RTTI. |
57 // The result of stringWithTypeName<T>() is given as |funcName|. |extractTypeNam
eFromFunctionName| then extracts a typename string from |funcName|. | 57 // The result of stringWithTypeName<T>() is given as |funcName|. |
| 58 // |extractTypeNameFromFunctionName| then extracts a typename string from |
| 59 // |funcName|. |
58 String extractTypeNameFromFunctionName(const char* funcName) { | 60 String extractTypeNameFromFunctionName(const char* funcName) { |
59 #if COMPILER(CLANG) || COMPILER(GCC) || COMPILER(MSVC) | 61 #if COMPILER(CLANG) || COMPILER(GCC) || COMPILER(MSVC) |
60 size_t funcNameLength = strlen(funcName); | 62 size_t funcNameLength = strlen(funcName); |
61 ASSERT(funcNameLength > | 63 ASSERT(funcNameLength > |
62 stringWithTypeNamePrefixLength + stringWithTypeNamePostfixLength); | 64 stringWithTypeNamePrefixLength + stringWithTypeNamePostfixLength); |
63 | 65 |
64 const char* funcNameWithoutPrefix = funcName + stringWithTypeNamePrefixLength; | 66 const char* funcNameWithoutPrefix = funcName + stringWithTypeNamePrefixLength; |
65 return String(funcNameWithoutPrefix, funcNameLength - | 67 return String(funcNameWithoutPrefix, funcNameLength - |
66 stringWithTypeNamePrefixLength - | 68 stringWithTypeNamePrefixLength - |
67 stringWithTypeNamePostfixLength); | 69 stringWithTypeNamePostfixLength); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 | 146 |
145 #else | 147 #else |
146 | 148 |
147 String dumpRefCountedInstanceCounts() { | 149 String dumpRefCountedInstanceCounts() { |
148 return String("{}"); | 150 return String("{}"); |
149 } | 151 } |
150 | 152 |
151 #endif // ENABLE(INSTANCE_COUNTER) | 153 #endif // ENABLE(INSTANCE_COUNTER) |
152 | 154 |
153 } // namespace WTF | 155 } // namespace WTF |
OLD | NEW |