| 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
|
|
|