Bug 68286

Summary: [Chromium] We need an API to expose blob creation to Chromium
Product: WebKit Reporter: Jay Civelli <jcivelli>
Component: WebKit Misc.Assignee: Jay Civelli <jcivelli>
Status: RESOLVED FIXED    
Severity: Normal CC: fishd, michaeln, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Patch for landing
none
Patch for landing none

Description Jay Civelli 2011-09-16 15:08:27 PDT
We need an API to expose blob creation to Chromium.

That is needed for giving access to blobs in Chrome extensions.
Comment 1 Jay Civelli 2011-09-16 15:20:57 PDT
Created attachment 107728 [details]
Patch
Comment 2 Jay Civelli 2011-09-16 15:31:00 PDT
Created attachment 107729 [details]
Patch
Comment 3 Michael Nordman 2011-09-16 16:21:13 PDT
Drive-by-comments only...

Nice to see this doesn't require bunches of code.

  v8::Handle<v8::Value>  createBlobFromFile(...)

Since an opaque v8 handle is the return value, i wonder if the method sig should be tweeked... createBlobFromFileAsV8Handle()?
Comment 4 Darin Fisher (:fishd, Google) 2011-09-20 11:32:59 PDT
Comment on attachment 107729 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=107729&action=review

> Source/WebKit/chromium/public/WebBlob.h:48
> +    static v8::Handle<v8::Value> createBlobFromFile(const WebString& path, long long size);

nit: no need to mention "Blob" in the method name.  just go with WebBlob::createFromFile.

though it may seem heavier than you require, i think it would be better to make
WebBlob be a proper wrapper of WebCore::Blob.  WebCore::Blob is reference counted,
so you can use WebPrivatePtr<T>.  follow the example of WebNode.

then, you can provide a WEBKIT_USING_V8 method name toV8Value().
Comment 5 Jay Civelli 2011-09-20 14:38:42 PDT
Created attachment 108056 [details]
Patch
Comment 6 Darin Fisher (:fishd, Google) 2011-09-20 15:41:15 PDT
Comment on attachment 108056 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=108056&action=review

> Source/WebKit/chromium/public/WebBlob.h:51
> +    virtual ~WebBlob() { reset(); }

nit: this can be non-virtual

> Source/WebKit/chromium/public/WebBlob.h:54
> +    WebBlob(const WebBlob& n) { assign(n); }

nit: the "n" parameter name used in WebNode.h was chosen because "n" stands for "node"
here, perhaps "b" would be a better choice.

> Source/WebKit/chromium/public/WebBlob.h:66
> +    WEBKIT_EXPORT bool equals(const WebBlob&) const;

nit: it's okay to define equals here, but you could also leave it out if you like.
we don't universally provide this for simple WebCore wrappers.

> Source/WebKit/chromium/public/WebBlob.h:69
> +

nit: only one new line here

> Source/WebKit/chromium/public/WebBlob.h:77
> +#if WEBKIT_USING_V8

nit: we normally put WEBKIT_IMPLEMENTATION stuff last in the public section
Comment 7 Jay Civelli 2011-09-20 16:25:16 PDT
Created attachment 108075 [details]
Patch for landing
Comment 8 WebKit Review Bot 2011-09-20 17:16:26 PDT
Comment on attachment 108075 [details]
Patch for landing

Rejecting attachment 108075 [details] from commit-queue.

Failed to run "['/mnt/git/webkit-commit-queue/Tools/Scripts/webkit-patch', '--status-host=queues.webkit.org', '-..." exit_code: 1

Last 500 characters of output:
85e273c316e0d416a2f995b30baa2e9a5ea2dc5a
r95585 = 6e9b58622449856b0904ebe3d271c5190e568d0e
Done rebuilding .git/svn/refs/remotes/origin/master/.rev_map.268f45cc-cd09-0410-ab3c-d52691b4dbfc
First, rewinding head to replay your work on top of it...
Fast-forwarded master to refs/remotes/origin/master.
Updating chromium port dependencies using gclient...

________ running '/usr/bin/python gyp_webkit' in '/mnt/git/webkit-commit-queue/Source/WebKit/chromium'
Updating webkit projects from gyp files...

Full output: http://queues.webkit.org/results/9767473
Comment 9 Jay Civelli 2011-09-20 17:51:39 PDT
Created attachment 108089 [details]
Patch for landing
Comment 10 WebKit Review Bot 2011-09-20 18:06:50 PDT
Comment on attachment 108089 [details]
Patch for landing

Clearing flags on attachment: 108089

Committed r95590: <http://trac.webkit.org/changeset/95590>
Comment 11 WebKit Review Bot 2011-09-20 18:06:55 PDT
All reviewed patches have been landed.  Closing bug.