| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2009, 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2009, 2012 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 20 matching lines...) Expand all Loading... |
| 31 namespace WTF { | 31 namespace WTF { |
| 32 | 32 |
| 33 namespace StringWrapperCFAllocator { | 33 namespace StringWrapperCFAllocator { |
| 34 | 34 |
| 35 static StringImpl* currentString; | 35 static StringImpl* currentString; |
| 36 | 36 |
| 37 static const void* retain(const void* info) { | 37 static const void* retain(const void* info) { |
| 38 return info; | 38 return info; |
| 39 } | 39 } |
| 40 | 40 |
| 41 NO_RETURN_DUE_TO_ASSERT | |
| 42 static void release(const void*) { | 41 static void release(const void*) { |
| 43 ASSERT_NOT_REACHED(); | 42 ASSERT_NOT_REACHED(); |
| 44 } | 43 } |
| 45 | 44 |
| 46 static CFStringRef copyDescription(const void*) { | 45 static CFStringRef copyDescription(const void*) { |
| 47 return CFSTR("WTF::String-based allocator"); | 46 return CFSTR("WTF::String-based allocator"); |
| 48 } | 47 } |
| 49 | 48 |
| 50 static void* allocate(CFIndex size, CFOptionFlags, void*) { | 49 static void* allocate(CFIndex size, CFOptionFlags, void*) { |
| 51 StringImpl* underlyingString = 0; | 50 StringImpl* underlyingString = 0; |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 // StringWrapperCFAllocator. If it is, then we could find the original | 155 // StringWrapperCFAllocator. If it is, then we could find the original |
| 157 // StringImpl and just return that. But to do that we'd have to compute the | 156 // StringImpl and just return that. But to do that we'd have to compute the |
| 158 // offset from CFStringRef to the allocated block; the CFStringRef is *not* at | 157 // offset from CFStringRef to the allocated block; the CFStringRef is *not* at |
| 159 // the start of an allocated block. Testing shows 1000x more calls to | 158 // the start of an allocated block. Testing shows 1000x more calls to |
| 160 // createCFString than calls to the create functions with the appropriate | 159 // createCFString than calls to the create functions with the appropriate |
| 161 // allocator, so it's probably not urgent optimize that case. | 160 // allocator, so it's probably not urgent optimize that case. |
| 162 | 161 |
| 163 } // namespace WTF | 162 } // namespace WTF |
| 164 | 163 |
| 165 #endif // OS(MACOSX) | 164 #endif // OS(MACOSX) |
| OLD | NEW |