From 7252f0b67814dbaa6390d76ddc48e95438bbb5a1 Mon Sep 17 00:00:00 2001 From: esprehn Date: Tue, 1 Mar 2016 20:57:24 -0800 Subject: Remove WebScriptBindings. Extension code does so much work in general (and copies strings), the string optimization here doesn't really save much and adds extra public API surface to blink we'd rather not have. Having WebScriptBindings also encourages writing JS bindings out in content, when they should really be inside blink instead. Lets remove them and just use the normal v8_helpers that the rest of the extensions system uses. As we move more extensions code down into blink we can add optimizations like this back again. BUG=561879 Review URL: https://codereview.chromium.org/1754713003 Cr-Commit-Position: refs/heads/master@{#378692} --- extensions/renderer/content_watcher.cc | 1 - extensions/renderer/css_native_handler.cc | 13 +++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'extensions/renderer') diff --git a/extensions/renderer/content_watcher.cc b/extensions/renderer/content_watcher.cc index 3ab9e59..95c8a57 100644 --- a/extensions/renderer/content_watcher.cc +++ b/extensions/renderer/content_watcher.cc @@ -12,7 +12,6 @@ #include "third_party/WebKit/public/web/WebDocument.h" #include "third_party/WebKit/public/web/WebElement.h" #include "third_party/WebKit/public/web/WebLocalFrame.h" -#include "third_party/WebKit/public/web/WebScriptBindings.h" #include "third_party/WebKit/public/web/WebView.h" namespace extensions { diff --git a/extensions/renderer/css_native_handler.cc b/extensions/renderer/css_native_handler.cc index ab3ec61..d7cdc39 100644 --- a/extensions/renderer/css_native_handler.cc +++ b/extensions/renderer/css_native_handler.cc @@ -5,8 +5,8 @@ #include "extensions/renderer/css_native_handler.h" #include "extensions/renderer/script_context.h" +#include "extensions/renderer/v8_helpers.h" #include "third_party/WebKit/public/platform/WebString.h" -#include "third_party/WebKit/public/web/WebScriptBindings.h" #include "third_party/WebKit/public/web/WebSelector.h" namespace extensions { @@ -24,12 +24,13 @@ void CssNativeHandler::CanonicalizeCompoundSelector( const v8::FunctionCallbackInfo& args) { CHECK_EQ(args.Length(), 1); CHECK(args[0]->IsString()); - WebString input_selector = - blink::WebScriptBindings::toWebString(args[0].As()); + std::string input_selector = *v8::String::Utf8Value(args[0]); + // TODO(esprehn): This API shouldn't exist, the extension code should be + // moved into blink. WebString output_selector = blink::canonicalizeSelector( - input_selector, blink::WebSelectorTypeCompound); - args.GetReturnValue().Set(blink::WebScriptBindings::toV8String( - output_selector, context()->v8_context()->GetIsolate())); + WebString::fromUTF8(input_selector), blink::WebSelectorTypeCompound); + args.GetReturnValue().Set(v8_helpers::ToV8StringUnsafe( + args.GetIsolate(), output_selector.utf8().c_str())); } } // namespace extensions -- cgit v1.1