summaryrefslogtreecommitdiffstats
path: root/extensions/renderer
diff options
context:
space:
mode:
authoresprehn <esprehn@chromium.org>2016-03-01 20:57:24 -0800
committerCommit bot <commit-bot@chromium.org>2016-03-02 04:58:19 +0000
commit7252f0b67814dbaa6390d76ddc48e95438bbb5a1 (patch)
treefa1a063c080775a2d4bf8e189c41b95b1ed8a2c6 /extensions/renderer
parent4e6623013973747a357b11dd1ff0bb646e1db249 (diff)
downloadchromium_src-7252f0b67814dbaa6390d76ddc48e95438bbb5a1.zip
chromium_src-7252f0b67814dbaa6390d76ddc48e95438bbb5a1.tar.gz
chromium_src-7252f0b67814dbaa6390d76ddc48e95438bbb5a1.tar.bz2
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}
Diffstat (limited to 'extensions/renderer')
-rw-r--r--extensions/renderer/content_watcher.cc1
-rw-r--r--extensions/renderer/css_native_handler.cc13
2 files changed, 7 insertions, 7 deletions
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<v8::Value>& args) {
CHECK_EQ(args.Length(), 1);
CHECK(args[0]->IsString());
- WebString input_selector =
- blink::WebScriptBindings::toWebString(args[0].As<v8::String>());
+ 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