Index: third_party/WebKit/Source/bindings/core/v8/V8ValueCache.h |
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8ValueCache.h b/third_party/WebKit/Source/bindings/core/v8/V8ValueCache.h |
index 56f8128d86836b694f73224ade45c58526e29e51..dcb2e2e48a6c9ca00213dae21932c47346a0e9b1 100644 |
--- a/third_party/WebKit/Source/bindings/core/v8/V8ValueCache.h |
+++ b/third_party/WebKit/Source/bindings/core/v8/V8ValueCache.h |
@@ -23,101 +23,6 @@ |
* THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
-#ifndef V8ValueCache_h |
-#define V8ValueCache_h |
- |
-#include "bindings/core/v8/V8GlobalValueMap.h" |
-#include "core/CoreExport.h" |
-#include "platform/wtf/Allocator.h" |
-#include "platform/wtf/HashMap.h" |
-#include "platform/wtf/Noncopyable.h" |
-#include "platform/wtf/RefPtr.h" |
-#include "platform/wtf/text/AtomicString.h" |
-#include "platform/wtf/text/WTFString.h" |
-#include "v8/include/v8.h" |
- |
-namespace blink { |
- |
-class StringCacheMapTraits |
- : public V8GlobalValueMapTraits<StringImpl*, |
- v8::String, |
- v8::kWeakWithParameter> { |
- STATIC_ONLY(StringCacheMapTraits); |
- |
- public: |
- // Weak traits: |
- typedef StringImpl WeakCallbackDataType; |
- typedef v8::GlobalValueMap<StringImpl*, v8::String, StringCacheMapTraits> |
- MapType; |
- |
- static WeakCallbackDataType* WeakCallbackParameter( |
- MapType* map, |
- StringImpl* key, |
- v8::Local<v8::String>& value) { |
- return key; |
- } |
- static void DisposeCallbackData(WeakCallbackDataType* callback_data) {} |
- |
- static MapType* MapFromWeakCallbackInfo( |
- const v8::WeakCallbackInfo<WeakCallbackDataType>&); |
- |
- static StringImpl* KeyFromWeakCallbackInfo( |
- const v8::WeakCallbackInfo<WeakCallbackDataType>& data) { |
- return data.GetParameter(); |
- } |
- |
- static void OnWeakCallback(const v8::WeakCallbackInfo<WeakCallbackDataType>&); |
- |
- static void Dispose(v8::Isolate*, |
- v8::Global<v8::String> value, |
- StringImpl* key); |
- static void DisposeWeak(const v8::WeakCallbackInfo<WeakCallbackDataType>&); |
-}; |
- |
-class CORE_EXPORT StringCache { |
- USING_FAST_MALLOC(StringCache); |
- WTF_MAKE_NONCOPYABLE(StringCache); |
- |
- public: |
- explicit StringCache(v8::Isolate* isolate) : string_cache_(isolate) {} |
- |
- v8::Local<v8::String> V8ExternalString(v8::Isolate* isolate, |
- StringImpl* string_impl) { |
- DCHECK(string_impl); |
- if (last_string_impl_.Get() == string_impl) |
- return last_v8_string_.NewLocal(isolate); |
- return V8ExternalStringSlow(isolate, string_impl); |
- } |
- |
- void SetReturnValueFromString(v8::ReturnValue<v8::Value> return_value, |
- StringImpl* string_impl) { |
- DCHECK(string_impl); |
- if (last_string_impl_.Get() == string_impl) |
- last_v8_string_.SetReturnValue(return_value); |
- else |
- SetReturnValueFromStringSlow(return_value, string_impl); |
- } |
- |
- void Dispose(); |
- |
- friend class StringCacheMapTraits; |
- |
- private: |
- v8::Local<v8::String> V8ExternalStringSlow(v8::Isolate*, StringImpl*); |
- void SetReturnValueFromStringSlow(v8::ReturnValue<v8::Value>, StringImpl*); |
- v8::Local<v8::String> CreateStringAndInsertIntoCache(v8::Isolate*, |
- StringImpl*); |
- void InvalidateLastString(); |
- |
- StringCacheMapTraits::MapType string_cache_; |
- StringCacheMapTraits::MapType::PersistentValueReference last_v8_string_; |
- |
- // Note: RefPtr is a must as we cache by StringImpl* equality, not identity |
- // hence lastStringImpl might be not a key of the cache (in sense of identity) |
- // and hence it's not refed on addition. |
- RefPtr<StringImpl> last_string_impl_; |
-}; |
- |
-} // namespace blink |
- |
-#endif // V8ValueCache_h |
+// This file has been moved to platform/bindings/V8ValueCache.h. |
+// TODO(adithyas): Remove this file. |
+#include "platform/bindings/V8ValueCache.h" |