OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 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 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 return v8ExternalStringSlow(stringImpl, handleType, isolate); | 59 return v8ExternalStringSlow(stringImpl, handleType, isolate); |
60 } | 60 } |
61 | 61 |
62 void clearOnGC() | 62 void clearOnGC() |
63 { | 63 { |
64 m_lastStringImpl = 0; | 64 m_lastStringImpl = 0; |
65 m_lastV8String.Clear(); | 65 m_lastV8String.Clear(); |
66 } | 66 } |
67 | 67 |
68 void remove(StringImpl*); | 68 void remove(StringImpl*); |
69 void reportMemoryUsage(MemoryObjectInfo*) const; | |
70 | 69 |
71 private: | 70 private: |
72 v8::Handle<v8::String> v8ExternalStringSlow(StringImpl*, ReturnHandleType, v
8::Isolate*); | 71 v8::Handle<v8::String> v8ExternalStringSlow(StringImpl*, ReturnHandleType, v
8::Isolate*); |
73 | 72 |
74 HashMap<StringImpl*, v8::Persistent<v8::String> > m_stringCache; | 73 HashMap<StringImpl*, v8::Persistent<v8::String> > m_stringCache; |
75 v8::Persistent<v8::String> m_lastV8String; | 74 v8::Persistent<v8::String> m_lastV8String; |
76 // Note: RefPtr is a must as we cache by StringImpl* equality, not identity | 75 // Note: RefPtr is a must as we cache by StringImpl* equality, not identity |
77 // hence lastStringImpl might be not a key of the cache (in sense of identit
y) | 76 // hence lastStringImpl might be not a key of the cache (in sense of identit
y) |
78 // and hence it's not refed on addition. | 77 // and hence it's not refed on addition. |
79 RefPtr<StringImpl> m_lastStringImpl; | 78 RefPtr<StringImpl> m_lastStringImpl; |
(...skipping 19 matching lines...) Expand all Loading... |
99 return v8::Integer::NewFromUnsigned(value, isolate); | 98 return v8::Integer::NewFromUnsigned(value, isolate); |
100 } | 99 } |
101 | 100 |
102 private: | 101 private: |
103 ScopedPersistent<v8::Integer> m_smallIntegers[numberOfCachedSmallIntegers]; | 102 ScopedPersistent<v8::Integer> m_smallIntegers[numberOfCachedSmallIntegers]; |
104 }; | 103 }; |
105 | 104 |
106 } // namespace WebCore | 105 } // namespace WebCore |
107 | 106 |
108 #endif // V8ValueCache_h | 107 #endif // V8ValueCache_h |
OLD | NEW |