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

Unified Diff: Source/bindings/v8/V8StringResource.cpp

Issue 16158008: Mobile Gmail should use 1.3 MB less memory (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Update to new V8 API Created 7 years, 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/v8/V8StringResource.cpp
diff --git a/Source/bindings/v8/V8StringResource.cpp b/Source/bindings/v8/V8StringResource.cpp
index 47f4d9b3fb406fba748cb4287bd860f12c06327f..22e5a487f9ad4aef90485d3f64720fe3ae352ff3 100644
--- a/Source/bindings/v8/V8StringResource.cpp
+++ b/Source/bindings/v8/V8StringResource.cpp
@@ -52,7 +52,6 @@ void WebCoreStringResourceBase::visitStrings(ExternalStringVisitor* visitor)
template<class StringClass> struct StringTraits {
static const StringClass& fromStringResource(WebCoreStringResourceBase*);
- static bool is16BitAtomicString(StringClass&);
template<bool oneByte>
static StringClass fromV8String(v8::Handle<v8::String>, int);
};
@@ -63,10 +62,6 @@ struct StringTraits<String> {
{
return resource->webcoreString();
}
- static bool is16BitAtomicString(String& string)
- {
- return false;
- }
template<bool oneByte>
static String fromV8String(v8::Handle<v8::String>, int);
};
@@ -77,10 +72,6 @@ struct StringTraits<AtomicString> {
{
return resource->atomicString();
}
- static bool is16BitAtomicString(AtomicString& string)
- {
- return !string.string().is8Bit();
- }
template<bool oneByte>
static AtomicString fromV8String(v8::Handle<v8::String>, int);
};
@@ -159,13 +150,13 @@ StringType v8StringToWebCoreString(v8::Handle<v8::String> v8String, ExternalMode
if (UNLIKELY(!length))
return String("");
- bool oneByte = v8String->IsOneByte();
+ bool oneByte = v8String->ContainsOnlyOneByte();
StringType result(oneByte ? StringTraits<StringType>::template fromV8String<true>(v8String, length) : StringTraits<StringType>::template fromV8String<false>(v8String, length));
if (external != Externalize || !v8String->CanMakeExternal())
return result;
- if (oneByte && !StringTraits<StringType>::is16BitAtomicString(result)) {
+ if (result.is8Bit()) {
WebCoreStringResource8* stringResource = new WebCoreStringResource8(result);
if (UNLIKELY(!v8String->MakeExternal(stringResource)))
delete stringResource;
@@ -176,7 +167,7 @@ StringType v8StringToWebCoreString(v8::Handle<v8::String> v8String, ExternalMode
}
return result;
}
-
+
// Explicitly instantiate the above template with the expected parameterizations,
// to ensure the compiler generates the code; otherwise link errors can result in GCC 4.4.
template String v8StringToWebCoreString<String>(v8::Handle<v8::String>, ExternalMode);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698