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

Unified Diff: extensions/renderer/blob_native_handler.cc

Issue 1174343003: blink:bindings: Passes the global context instead of |this| in JS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 | « extensions/renderer/blob_native_handler.h ('k') | extensions/renderer/file_system_natives.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/renderer/blob_native_handler.cc
diff --git a/extensions/renderer/blob_native_handler.cc b/extensions/renderer/blob_native_handler.cc
index b8b2e5189091fa230e95834c0583e4011f2c32ea..d6e757a32a127e8aac22886a00d485db8ab78690 100644
--- a/extensions/renderer/blob_native_handler.cc
+++ b/extensions/renderer/blob_native_handler.cc
@@ -5,6 +5,7 @@
#include "extensions/renderer/blob_native_handler.h"
#include "base/bind.h"
+#include "extensions/renderer/script_context.h"
#include "third_party/WebKit/public/platform/WebCString.h"
#include "third_party/WebKit/public/platform/WebURL.h"
#include "third_party/WebKit/public/web/WebBlob.h"
@@ -19,11 +20,24 @@ void GetBlobUuid(const v8::FunctionCallbackInfo<v8::Value>& args) {
v8::String::NewFromUtf8(args.GetIsolate(), blob.uuid().utf8().data()));
}
+} // namespace
+
+namespace extensions {
+
+BlobNativeHandler::BlobNativeHandler(ScriptContext* context)
+ : ObjectBackedNativeHandler(context) {
+ RouteFunction("GetBlobUuid", base::Bind(&GetBlobUuid));
+ RouteFunction("TakeBrowserProcessBlob",
+ base::Bind(&BlobNativeHandler::TakeBrowserProcessBlob,
+ base::Unretained(this)));
+}
+
// Take ownership of a Blob created on the browser process. Expects the Blob's
// UUID, type, and size as arguments. Returns the Blob we just took to
// Javascript. The Blob reference in the browser process is dropped through
// a separate flow to avoid leaking Blobs if the script context is destroyed.
-void TakeBrowserProcessBlob(const v8::FunctionCallbackInfo<v8::Value>& args) {
+void BlobNativeHandler::TakeBrowserProcessBlob(
+ const v8::FunctionCallbackInfo<v8::Value>& args) {
DCHECK_EQ(3, args.Length());
DCHECK(args[0]->IsString());
DCHECK(args[1]->IsString());
@@ -34,17 +48,8 @@ void TakeBrowserProcessBlob(const v8::FunctionCallbackInfo<v8::Value>& args) {
blink::WebBlob::createFromUUID(blink::WebString::fromUTF8(uuid),
blink::WebString::fromUTF8(type),
args[2]->Int32Value());
- args.GetReturnValue().Set(blob.toV8Value(args.Holder(), args.GetIsolate()));
-}
-
-} // namespace
-
-namespace extensions {
-
-BlobNativeHandler::BlobNativeHandler(ScriptContext* context)
- : ObjectBackedNativeHandler(context) {
- RouteFunction("GetBlobUuid", base::Bind(&GetBlobUuid));
- RouteFunction("TakeBrowserProcessBlob", base::Bind(&TakeBrowserProcessBlob));
+ args.GetReturnValue().Set(blob.toV8Value(
+ context()->v8_context()->Global(), args.GetIsolate()));
}
} // namespace extensions
« no previous file with comments | « extensions/renderer/blob_native_handler.h ('k') | extensions/renderer/file_system_natives.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698