Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(891)

Unified Diff: third_party/WebKit/Source/bindings/core/v8/V8ValueCache.cpp

Issue 2227933002: Revert CompressibleString (and its UMA) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address on Ilya's review Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/bindings/core/v8/V8ValueCache.cpp
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8ValueCache.cpp b/third_party/WebKit/Source/bindings/core/v8/V8ValueCache.cpp
index 605dbedc045849da049c1c85c20cb7b85a1c0ab9..5dfb241df7673339648c8433932cc8323a1a5ee2 100644
--- a/third_party/WebKit/Source/bindings/core/v8/V8ValueCache.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/V8ValueCache.cpp
@@ -55,29 +55,6 @@ void StringCacheMapTraits::OnWeakCallback(const v8::WeakCallbackInfo<WeakCallbac
V8PerIsolateData::from(data.GetIsolate())->getStringCache()->InvalidateLastString();
}
-
-CompressibleStringCacheMapTraits::MapType* CompressibleStringCacheMapTraits::MapFromWeakCallbackInfo(
- const v8::WeakCallbackInfo<WeakCallbackDataType>& data)
-{
- return &(V8PerIsolateData::from(data.GetIsolate())->getStringCache()->m_compressibleStringCache);
-}
-
-void CompressibleStringCacheMapTraits::Dispose(
- v8::Isolate* isolate, v8::Global<v8::String> value, CompressibleStringImpl* key)
-{
- key->deref();
-}
-
-void CompressibleStringCacheMapTraits::DisposeWeak(const v8::WeakCallbackInfo<WeakCallbackDataType>& data)
-{
- data.GetParameter()->deref();
-}
-
-void CompressibleStringCacheMapTraits::OnWeakCallback(const v8::WeakCallbackInfo<WeakCallbackDataType>& data)
-{
-}
-
-
void StringCache::dispose()
{
// The MapType::Dispose callback calls StringCache::InvalidateLastString,
@@ -107,27 +84,6 @@ static v8::Local<v8::String> makeExternalString(v8::Isolate* isolate, const Stri
return newString;
}
-static v8::Local<v8::String> makeExternalString(v8::Isolate* isolate, const CompressibleString& string)
-{
- if (string.is8Bit()) {
- WebCoreCompressibleStringResource8* stringResource = new WebCoreCompressibleStringResource8(string);
- v8::Local<v8::String> newString;
- if (!v8::String::NewExternalOneByte(isolate, stringResource).ToLocal(&newString)) {
- delete stringResource;
- return v8::String::Empty(isolate);
- }
- return newString;
- }
-
- WebCoreCompressibleStringResource16* stringResource = new WebCoreCompressibleStringResource16(string);
- v8::Local<v8::String> newString;
- if (!v8::String::NewExternalTwoByte(isolate, stringResource).ToLocal(&newString)) {
- delete stringResource;
- return v8::String::Empty(isolate);
- }
- return newString;
-}
-
v8::Local<v8::String> StringCache::v8ExternalStringSlow(v8::Isolate* isolate, StringImpl* stringImpl)
{
if (!stringImpl->length())
@@ -143,18 +99,6 @@ v8::Local<v8::String> StringCache::v8ExternalStringSlow(v8::Isolate* isolate, St
return createStringAndInsertIntoCache(isolate, stringImpl);
}
-v8::Local<v8::String> StringCache::v8ExternalStringSlow(v8::Isolate* isolate, const CompressibleString& string)
-{
- if (!string.length())
- return v8::String::Empty(isolate);
-
- CompressibleStringCacheMapTraits::MapType::PersistentValueReference cachedV8String = m_compressibleStringCache.GetReference(string.impl());
- if (!cachedV8String.IsEmpty())
- return cachedV8String.NewLocal(isolate);
-
- return createStringAndInsertIntoCache(isolate, string);
-}
-
void StringCache::setReturnValueFromStringSlow(v8::ReturnValue<v8::Value> returnValue, StringImpl* stringImpl)
{
if (!stringImpl->length()) {
@@ -192,31 +136,6 @@ v8::Local<v8::String> StringCache::createStringAndInsertIntoCache(v8::Isolate* i
return newString;
}
-v8::Local<v8::String> StringCache::createStringAndInsertIntoCache(v8::Isolate* isolate, const CompressibleString& string)
-{
- CompressibleStringImpl* stringImpl = string.impl();
-
- ASSERT(!m_compressibleStringCache.Contains(stringImpl));
- ASSERT(stringImpl->originalLength());
-
- v8::Local<v8::String> newString = makeExternalString(isolate, string);
- ASSERT(!newString.IsEmpty());
- ASSERT(newString->Length());
-
- v8::UniquePersistent<v8::String> wrapper(isolate, newString);
-
- stringImpl->ref();
- wrapper.MarkIndependent();
- // CompressibleStringImpl objects are NOT cached on |m_stringCache| or
- // |m_lastStringImpl|. It's because if even one objects holds a StringImpl
- // object in a CompressibleStringImpl, uncompressed string will exists even
- // when compressing the string.
- CompressibleStringCacheMapTraits::MapType::PersistentValueReference unused;
- m_compressibleStringCache.Set(stringImpl, std::move(wrapper), &unused);
-
- return newString;
-}
-
void StringCache::InvalidateLastString()
{
m_lastStringImpl = nullptr;

Powered by Google App Engine
This is Rietveld 408576698