| OLD | NEW |
| 1 // Copyright 2012, Google Inc. | 1 // Copyright 2012, Google Inc. |
| 2 // All rights reserved. | 2 // 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 are | 5 // modification, are permitted provided that the following conditions are |
| 6 // met: | 6 // met: |
| 7 // | 7 // |
| 8 // * Redistributions of source code must retain the above copyright | 8 // * 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 // * Redistributions in binary form must reproduce the above | 10 // * Redistributions in binary form must reproduce the above |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 | 50 |
| 51 return getSlow(stringImpl, autoDartScope); | 51 return getSlow(stringImpl, autoDartScope); |
| 52 } | 52 } |
| 53 | 53 |
| 54 void clearWeakHandles(); | 54 void clearWeakHandles(); |
| 55 | 55 |
| 56 // FIXME: implement clearing on GC. | 56 // FIXME: implement clearing on GC. |
| 57 | 57 |
| 58 private: | 58 private: |
| 59 Dart_WeakPersistentHandle getSlow(StringImpl*, bool autoDartScope); | 59 Dart_WeakPersistentHandle getSlow(StringImpl*, bool autoDartScope); |
| 60 static void handleFinalizer(Dart_WeakPersistentHandle, void* peer); | 60 static void handleFinalizer(Dart_Isolate, Dart_WeakPersistentHandle, void* p
eer); |
| 61 | 61 |
| 62 typedef HashMap<StringImpl*, Dart_WeakPersistentHandle> StringCache; | 62 typedef HashMap<StringImpl*, Dart_WeakPersistentHandle> StringCache; |
| 63 StringCache m_stringCache; | 63 StringCache m_stringCache; |
| 64 Dart_WeakPersistentHandle m_lastDartString; | 64 Dart_WeakPersistentHandle m_lastDartString; |
| 65 // Note: RefPtr is a must as we cache by StringImpl* equality, not identity | 65 // Note: RefPtr is a must as we cache by StringImpl* equality, not identity |
| 66 // hence lastStringImpl might be not a key of the cache (in sense of identit
y) | 66 // hence lastStringImpl might be not a key of the cache (in sense of identit
y) |
| 67 // and hence it's not refed on addition. | 67 // and hence it's not refed on addition. |
| 68 RefPtr<StringImpl> m_lastStringImpl; | 68 RefPtr<StringImpl> m_lastStringImpl; |
| 69 }; | 69 }; |
| 70 | 70 |
| 71 } | 71 } |
| 72 | 72 |
| 73 #endif | 73 #endif |
| OLD | NEW |