Bug 34652 - [chromium] Add the chromium interface to support Blob.slice.
Summary: [chromium] Add the chromium interface to support Blob.slice.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Jian Li
URL:
Keywords:
Depends on:
Blocks: 32993
  Show dependency treegraph
 
Reported: 2010-02-05 10:48 PST by Jian Li
Modified: 2010-02-09 12:51 PST (History)
3 users (show)

See Also:


Attachments
Proposed Patch (2.00 KB, patch)
2010-02-05 10:49 PST, Jian Li
fishd: review-
jianli: commit-queue-
Details | Formatted Diff | Diff
Proposed Patch (4.59 KB, patch)
2010-02-08 12:14 PST, Jian Li
jianli: commit-queue-
Details | Formatted Diff | Diff
Proposed Patch (4.59 KB, patch)
2010-02-08 12:48 PST, Jian Li
fishd: review-
jianli: commit-queue-
Details | Formatted Diff | Diff
Proposed Patch (5.82 KB, patch)
2010-02-09 11:05 PST, Jian Li
fishd: review+
jianli: commit-queue-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jian Li 2010-02-05 10:48:09 PST
In order to commit patch 32993 (Blob.slice support) without breaking chromium build, we need to add the chromium interface first.
Comment 1 Jian Li 2010-02-05 10:49:42 PST
Created attachment 48241 [details]
Proposed Patch
Comment 2 Dmitry Titov 2010-02-05 13:42:46 PST
Darin Fisher is the guy to look at chromium/public change.
Comment 3 Darin Fisher (:fishd, Google) 2010-02-06 12:43:41 PST
Comment on attachment 48241 [details]
Proposed Patch

> +++ b/WebKit/chromium/public/WebHTTPBody.h
> @@ -50,6 +50,9 @@ public:
>          enum { TypeData, TypeFile } type;
>          WebData data;
>          WebString filePath;
> +        long long fileStart;
> +        long long fileLength;

^^^ do negative values have any meaning here?  i would imagine that fileStart of 0
and fileLength of -1 means the whole file.  is that your intent?  if so, please
document it.


> +        time_t fileModificationTime;

^^^ we have been using 'double' for timestamps elsewhere in the API.  there's
only one exception, and that's because i wasn't paying close enough attention ;-)


> @@ -78,6 +81,7 @@ public:
>      // Append to the list of elements.
>      WEBKIT_API void appendData(const WebData&);
>      WEBKIT_API void appendFile(const WebString&);
> +    WEBKIT_API void appendFile(const WebString&, long long fileStart, long long fileLength, time_t fileModificationTime);

How about naming this new function appendFileRange or appendFileSlice?

Also, do you foresee ever needing additional properties?  E.g., maybe
one day we'll want to pass mimeType info or other timestamps?  Maybe
it would be wise to create a WebFileInfo struct that contains the
lastModified time stamp and pass that as an argument here?  then, we
can extend that in the future.
Comment 4 Jian Li 2010-02-08 12:14:55 PST
Created attachment 48350 [details]
Proposed Patch

All fixed. Thanks.
Comment 5 WebKit Review Bot 2010-02-08 12:18:05 PST
Attachment 48350 [details] did not pass style-queue:

Failed to run "WebKitTools/Scripts/check-webkit-style" exit_code: 1
WebKit/chromium/src/WebHTTPBody.cpp:32:  Found other header before a header this file implements. Should be: config.h, primary header, blank line, and then alphabetically sorted.  [build/include_order] [4]
Total errors found: 1


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 6 Jian Li 2010-02-08 12:48:40 PST
Created attachment 48354 [details]
Proposed Patch

Fixed style error.
Comment 7 Darin Fisher (:fishd, Google) 2010-02-08 19:46:54 PST
Comment on attachment 48354 [details]
Proposed Patch

> +++ b/WebKit/chromium/public/WebFileInfo.h
...
> +struct WebFileInfo {
> +    // The file path.
> +    WebString filePath;

^^^ I'm sorry... this is a real pedantic nit-pick, but I think it would be
better to leave out the filePath field here.  I say that because this
structure is otherwise similar to the kinds of structures that an OS would
return when 'stat'ing a file in the filesystem.  You can also look at it 
like this:  you can have many paths referring to the same file.  I'd leave
out the filePath field.

Same goes for the fileStart and fileLength fields.  Those do not describe
the file.  They describe a range of a file, so including them in a struct
named WebFileInfo doesn't seem the best to me.

Be sure to add a comment explaining what fileModificationTime of 0.0 means.

Final nit pick:  no need for the "file" prefix as these fields are all
contained in a structure whose name contains the word file.


> +++ b/WebKit/chromium/public/WebHTTPBody.h
...
> +    WEBKIT_API void appendFile(const WebString&); // FIXME: to be removed.
> +    WEBKIT_API void appendFileRange(const WebFileInfo&);

With the range fields folded into the WebFileInfo structure, this method is now
less explicitly about appending a file range.  I would probably do this:

  void appendFile(const WebString& filePath, const WebFileInfo&, long long fileStart, long long fileLength);

You could also call it appendFileRange, but I didn't do this since I figured
the appendFile method would be deleted.

-Darin
Comment 8 Jian Li 2010-02-09 11:05:36 PST
Created attachment 48429 [details]
Proposed Patch

All fixed.
Comment 9 Darin Fisher (:fishd, Google) 2010-02-09 12:00:37 PST
Comment on attachment 48429 [details]
Proposed Patch

> +++ b/WebKit/chromium/public/WebFileInfo.h
...
> +#include "WebString.h"

^^^ you can nuke this include now.


> +++ b/WebKit/chromium/public/WebHTTPBody.h

> +        long long fileStart;
> +        long long fileLength; // -1 means the whole file.

^^^ nit: -1 means to the end of the file.  it would only mean the whole file
if fileStart were 0.


> +    WEBKIT_API void appendFile(const WebString&); // FIXME: to be removed.
> +    WEBKIT_API void appendFile(const WebString&, long long fileStart, long long fileLength, const WebFileInfo&);

^^^ please document the magic value of -1 here as well for fileLength.


otherwise, LGTM.  R=me, assuming you fixup these nits before committing.
Comment 10 Jian Li 2010-02-09 12:51:48 PST
Committed as http://trac.webkit.org/changeset/54565.