| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2008 Apple 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 29 matching lines...) Expand all Loading... |
| 40 #if OS(MACOSX) | 40 #if OS(MACOSX) |
| 41 #include "wtf/RetainPtr.h" | 41 #include "wtf/RetainPtr.h" |
| 42 #include <CoreFoundation/CoreFoundation.h> | 42 #include <CoreFoundation/CoreFoundation.h> |
| 43 #endif | 43 #endif |
| 44 | 44 |
| 45 namespace WTF { | 45 namespace WTF { |
| 46 | 46 |
| 47 static UCollator* cachedCollator; | 47 static UCollator* cachedCollator; |
| 48 static Mutex& cachedCollatorMutex() | 48 static Mutex& cachedCollatorMutex() |
| 49 { | 49 { |
| 50 AtomicallyInitializedStatic(Mutex&, mutex = *new Mutex); | 50 AtomicallyInitializedStaticReference(Mutex, mutex, new Mutex); |
| 51 return mutex; | 51 return mutex; |
| 52 } | 52 } |
| 53 | 53 |
| 54 Collator::Collator(const char* locale) | 54 Collator::Collator(const char* locale) |
| 55 : m_collator(0) | 55 : m_collator(0) |
| 56 , m_locale(locale ? strdup(locale) : 0) | 56 , m_locale(locale ? strdup(locale) : 0) |
| 57 , m_lowerFirst(false) | 57 , m_lowerFirst(false) |
| 58 { | 58 { |
| 59 } | 59 } |
| 60 | 60 |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 { | 137 { |
| 138 Locker<Mutex> lock(cachedCollatorMutex()); | 138 Locker<Mutex> lock(cachedCollatorMutex()); |
| 139 if (cachedCollator) | 139 if (cachedCollator) |
| 140 ucol_close(cachedCollator); | 140 ucol_close(cachedCollator); |
| 141 cachedCollator = m_collator; | 141 cachedCollator = m_collator; |
| 142 m_collator = 0; | 142 m_collator = 0; |
| 143 } | 143 } |
| 144 } | 144 } |
| 145 | 145 |
| 146 } // namespace WTF | 146 } // namespace WTF |
| OLD | NEW |