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

Issue 7433006: Pepper quota support (Closed)

Created:
9 years, 5 months ago by kinuko
Modified:
9 years, 4 months ago
CC:
chromium-reviews, joi+watch-content_chromium.org, darin-cc_chromium.org, kinuko+watch, jam, ddorwin
Visibility:
Public.

Description

Pepper quota support Probably this could be better implemented using push notification model, but in this patch I made this very straightforwardly (with possibly minimal change). **NOTE: This design may not be really safe as quota accounting is done in renderer** * Added QuotaFileIO class (in quota_file_io.{cc,h}) which performs pre- and post- write quota related operations. * For Write/SetLength the QuotaFileIO instance first performs QueryFileInfo and QueryAvailableSpace to get the file size and current available space. If the results look good it dispatches actual Write/SetLength operations. After the operation has succeeded it then notifies the browser that it has made a storage modify operation. * For WillWrite/WillSetLength this change assumes they are always followed by actual write/setlength operations and the operations will succeed. Based on another cleanup patch: http://codereview.chromium.org/7438001/ BUG=86556 TEST=manually tested Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=94892

Patch Set 1 #

Total comments: 32

Patch Set 2 : updated #

Total comments: 15

Patch Set 3 : WillUpdate/DidUpdate model #

Patch Set 4 : '' #

Total comments: 17

Patch Set 5 : Separated the quota code into quota_file_io #

Patch Set 6 : fixed tests #

Total comments: 21

Patch Set 7 : '' #

Patch Set 8 : fix #

Total comments: 10

Patch Set 9 : '' #

Total comments: 8

Patch Set 10 : fixed nits #

Patch Set 11 : '' #

Patch Set 12 : '' #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1252 lines, -19 lines) Patch
M content/browser/file_system/file_system_dispatcher_host.h View 1 2 1 chunk +2 lines, -0 lines 0 comments Download
M content/browser/file_system/file_system_dispatcher_host.cc View 1 2 3 chunks +28 lines, -0 lines 0 comments Download
M content/common/file_system_messages.h View 1 2 1 chunk +8 lines, -0 lines 0 comments Download
M content/renderer/pepper_plugin_delegate_impl.h View 1 2 3 4 5 6 7 8 9 1 chunk +5 lines, -0 lines 0 comments Download
M content/renderer/pepper_plugin_delegate_impl.cc View 1 2 3 4 5 6 7 8 9 3 chunks +34 lines, -0 lines 0 comments Download
M ppapi/tests/test_file_io.h View 1 2 3 4 1 chunk +1 line, -0 lines 0 comments Download
M ppapi/tests/test_file_io.cc View 1 2 3 4 3 chunks +88 lines, -0 lines 0 comments Download
M webkit/glue/webkit_glue.gypi View 1 2 3 4 5 6 7 8 9 1 chunk +2 lines, -0 lines 0 comments Download
M webkit/plugins/ppapi/mock_plugin_delegate.h View 1 2 3 4 5 6 7 8 9 1 chunk +5 lines, -0 lines 0 comments Download
M webkit/plugins/ppapi/mock_plugin_delegate.cc View 1 2 3 4 5 6 7 8 9 1 chunk +11 lines, -0 lines 0 comments Download
M webkit/plugins/ppapi/plugin_delegate.h View 1 2 3 4 5 6 7 8 9 2 chunks +9 lines, -0 lines 0 comments Download
M webkit/plugins/ppapi/ppapi_unittest.h View 1 2 3 4 2 chunks +4 lines, -1 line 0 comments Download
M webkit/plugins/ppapi/ppapi_unittest.cc View 1 2 3 4 2 chunks +5 lines, -1 line 0 comments Download
M webkit/plugins/ppapi/ppb_file_io_impl.h View 1 2 3 4 5 6 7 8 9 10 11 5 chunks +11 lines, -2 lines 0 comments Download
M webkit/plugins/ppapi/ppb_file_io_impl.cc View 1 2 3 4 5 6 7 8 9 10 11 9 chunks +81 lines, -15 lines 0 comments Download
A webkit/plugins/ppapi/quota_file_io.h View 1 2 3 4 5 6 7 8 9 1 chunk +102 lines, -0 lines 0 comments Download
A webkit/plugins/ppapi/quota_file_io.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +367 lines, -0 lines 0 comments Download
A webkit/plugins/ppapi/quota_file_io_unittest.cc View 1 2 3 4 5 6 7 8 9 1 chunk +488 lines, -0 lines 0 comments Download
M webkit/tools/test_shell/test_shell.gypi View 1 2 3 4 5 6 7 8 9 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 30 (0 generated)
kinuko
This is still rough, but I would like your early feedbacks. Thanks!
9 years, 5 months ago (2011-07-19 12:12:36 UTC) #1
kinuko
On 2011/07/19 12:12:36, kinuko wrote: > This is still rough, but I would like your ...
9 years, 5 months ago (2011-07-19 14:16:29 UTC) #2
yzshen1
I took a look at ppb_file_io_impl.{h,cc}, and here are the first round of comments. http://codereview.chromium.org/7433006/diff/1/webkit/plugins/ppapi/ppb_file_io_impl.cc ...
9 years, 5 months ago (2011-07-19 17:41:54 UTC) #3
brettw
http://codereview.chromium.org/7433006/diff/1/content/renderer/pepper_plugin_delegate_impl.h File content/renderer/pepper_plugin_delegate_impl.h (right): http://codereview.chromium.org/7433006/diff/1/content/renderer/pepper_plugin_delegate_impl.h#newcode204 content/renderer/pepper_plugin_delegate_impl.h:204: It's not clear why you added this. http://codereview.chromium.org/7433006/diff/1/webkit/fileapi/file_system_file_util_proxy.h File ...
9 years, 5 months ago (2011-07-19 20:29:31 UTC) #4
michaeln
http://codereview.chromium.org/7433006/diff/1/webkit/plugins/ppapi/ppb_file_io_impl.cc File webkit/plugins/ppapi/ppb_file_io_impl.cc (right): http://codereview.chromium.org/7433006/diff/1/webkit/plugins/ppapi/ppb_file_io_impl.cc#newcode200 webkit/plugins/ppapi/ppb_file_io_impl.cc:200: int64 expected_growth = offset + bytes_to_write - file_size_; On ...
9 years, 5 months ago (2011-07-19 22:01:45 UTC) #5
yzshen1
http://codereview.chromium.org/7433006/diff/1/webkit/plugins/ppapi/ppb_file_io_impl.cc File webkit/plugins/ppapi/ppb_file_io_impl.cc (right): http://codereview.chromium.org/7433006/diff/1/webkit/plugins/ppapi/ppb_file_io_impl.cc#newcode477 webkit/plugins/ppapi/ppb_file_io_impl.cc:477: RunAndRemoveFirstPendingCallback(PlatformFileErrorToPepperError(error_code)); What is more, the order of multiple write ...
9 years, 5 months ago (2011-07-19 23:14:14 UTC) #6
michaeln
http://codereview.chromium.org/7433006/diff/1/webkit/plugins/ppapi/ppb_file_io_impl.h File webkit/plugins/ppapi/ppb_file_io_impl.h (right): http://codereview.chromium.org/7433006/diff/1/webkit/plugins/ppapi/ppb_file_io_impl.h#newcode34 webkit/plugins/ppapi/ppb_file_io_impl.h:34: class PPB_FileIO_Impl : public Resource, I'm kinda wondering if ...
9 years, 5 months ago (2011-07-19 23:54:58 UTC) #7
brettw
http://codereview.chromium.org/7433006/diff/1/webkit/plugins/ppapi/ppb_file_io_impl.h File webkit/plugins/ppapi/ppb_file_io_impl.h (right): http://codereview.chromium.org/7433006/diff/1/webkit/plugins/ppapi/ppb_file_io_impl.h#newcode68 webkit/plugins/ppapi/ppb_file_io_impl.h:68: virtual int32_t WillSetLength(int64_t length, The proxy gets the OS ...
9 years, 5 months ago (2011-07-20 04:08:06 UTC) #8
kinuko
Thanks for reviewing. I updated the code. http://codereview.chromium.org/7433006/diff/1/content/renderer/pepper_plugin_delegate_impl.h File content/renderer/pepper_plugin_delegate_impl.h (right): http://codereview.chromium.org/7433006/diff/1/content/renderer/pepper_plugin_delegate_impl.h#newcode204 content/renderer/pepper_plugin_delegate_impl.h:204: On 2011/07/19 ...
9 years, 5 months ago (2011-07-20 13:39:35 UTC) #9
michaeln
> (Btw which code do you mean by 'existing file reading IPC'?) WebCore::FileReader uses WebCore::FileReaderLoader ...
9 years, 5 months ago (2011-07-20 17:54:52 UTC) #10
yzshen1
http://codereview.chromium.org/7433006/diff/1/webkit/plugins/ppapi/ppb_file_io_impl.cc File webkit/plugins/ppapi/ppb_file_io_impl.cc (right): http://codereview.chromium.org/7433006/diff/1/webkit/plugins/ppapi/ppb_file_io_impl.cc#newcode231 webkit/plugins/ppapi/ppb_file_io_impl.cc:231: DCHECK_EQ(-1, pending_setlength_length_); Yes, that is correct. On 2011/07/20 13:39:35, ...
9 years, 5 months ago (2011-07-20 20:50:35 UTC) #11
michaeln
http://codereview.chromium.org/7433006/diff/15001/webkit/fileapi/file_system_operation.cc File webkit/fileapi/file_system_operation.cc (right): http://codereview.chromium.org/7433006/diff/15001/webkit/fileapi/file_system_operation.cc#newcode846 webkit/fileapi/file_system_operation.cc:846: is_write_operation_ = true; Seems like an odd place to ...
9 years, 5 months ago (2011-07-20 21:28:32 UTC) #12
kinuko
http://codereview.chromium.org/7433006/diff/15001/webkit/plugins/ppapi/plugin_delegate.h File webkit/plugins/ppapi/plugin_delegate.h (right): http://codereview.chromium.org/7433006/diff/15001/webkit/plugins/ppapi/plugin_delegate.h#newcode300 webkit/plugins/ppapi/plugin_delegate.h:300: int64_t /* file_size */>::Type AsyncOpenFileCallback; On 2011/07/20 21:28:33, michaeln ...
9 years, 5 months ago (2011-07-21 14:34:07 UTC) #13
yzshen1
Here are some more comments for ppb_file_io_impl.{h,cc}. One issue is that this CL cannot accurately ...
9 years, 5 months ago (2011-07-21 22:23:34 UTC) #14
kinuko
On 2011/07/21 22:23:34, yzshen1 wrote: > Here are some more comments for ppb_file_io_impl.{h,cc}. > > ...
9 years, 5 months ago (2011-07-22 00:44:58 UTC) #15
kinuko
On 2011/07/21 22:23:34, yzshen1 wrote: > Here are some more comments for ppb_file_io_impl.{h,cc}. > > ...
9 years, 5 months ago (2011-07-22 00:44:58 UTC) #16
brettw
I only looked briefly at this patch, so sorry if my suggestion is late or ...
9 years, 5 months ago (2011-07-22 18:30:25 UTC) #17
kinuko
On 2011/07/22 18:30:25, brettw wrote: > I only looked briefly at this patch, so sorry ...
9 years, 5 months ago (2011-07-25 18:02:43 UTC) #18
kinuko
> One issue is that this CL cannot accurately control quota usage. I am not ...
9 years, 5 months ago (2011-07-26 16:27:46 UTC) #19
brettw
Thanks, I think this new design is easier to follow! I'll give an LGTM for ...
9 years, 5 months ago (2011-07-26 16:40:13 UTC) #20
michaeln
LGTM, the separate class is soooo much nicer and easier to read! http://codereview.chromium.org/7433006/diff/35001/webkit/plugins/ppapi/quota_file_io.cc File webkit/plugins/ppapi/quota_file_io.cc ...
9 years, 5 months ago (2011-07-26 19:25:08 UTC) #21
yzshen1
Reviewed ppb_file_io_impl.{h,cc} and quota_file_io.{h,cc}. http://codereview.chromium.org/7433006/diff/35001/webkit/plugins/ppapi/ppb_file_io_impl.cc File webkit/plugins/ppapi/ppb_file_io_impl.cc (right): http://codereview.chromium.org/7433006/diff/35001/webkit/plugins/ppapi/ppb_file_io_impl.cc#newcode250 webkit/plugins/ppapi/ppb_file_io_impl.cc:250: int32_t rv = CommonCallValidation(true, OPERATION_WRITE, ...
9 years, 5 months ago (2011-07-26 19:26:43 UTC) #22
michaeln
http://codereview.chromium.org/7433006/diff/35001/webkit/plugins/ppapi/quota_file_io.cc File webkit/plugins/ppapi/quota_file_io.cc (right): http://codereview.chromium.org/7433006/diff/35001/webkit/plugins/ppapi/quota_file_io.cc#newcode78 webkit/plugins/ppapi/quota_file_io.cc:78: if (quota_io_->CheckIfExceedsQuota(offset_ + bytes_to_write_)) { On 2011/07/26 19:26:44, yzshen1 ...
9 years, 5 months ago (2011-07-26 19:58:06 UTC) #23
kinuko
http://codereview.chromium.org/7433006/diff/35001/webkit/plugins/ppapi/ppb_file_io_impl.cc File webkit/plugins/ppapi/ppb_file_io_impl.cc (right): http://codereview.chromium.org/7433006/diff/35001/webkit/plugins/ppapi/ppb_file_io_impl.cc#newcode250 webkit/plugins/ppapi/ppb_file_io_impl.cc:250: int32_t rv = CommonCallValidation(true, OPERATION_WRITE, callback); On 2011/07/26 19:26:44, ...
9 years, 5 months ago (2011-07-27 09:33:13 UTC) #24
yzshen1
http://codereview.chromium.org/7433006/diff/35001/webkit/plugins/ppapi/quota_file_io.cc File webkit/plugins/ppapi/quota_file_io.cc (right): http://codereview.chromium.org/7433006/diff/35001/webkit/plugins/ppapi/quota_file_io.cc#newcode67 webkit/plugins/ppapi/quota_file_io.cc:67: buffer_.reset(new char[bytes_to_write]); The reason why PPB_FileIO_Impl doesn't need to ...
9 years, 5 months ago (2011-07-27 18:26:07 UTC) #25
kinuko
http://codereview.chromium.org/7433006/diff/35001/webkit/plugins/ppapi/quota_file_io.cc File webkit/plugins/ppapi/quota_file_io.cc (right): http://codereview.chromium.org/7433006/diff/35001/webkit/plugins/ppapi/quota_file_io.cc#newcode67 webkit/plugins/ppapi/quota_file_io.cc:67: buffer_.reset(new char[bytes_to_write]); On 2011/07/27 18:26:07, yzshen1 wrote: > The ...
9 years, 4 months ago (2011-07-28 14:10:59 UTC) #26
yzshen1
LGTM for ppb_file_io_impl.* and quota_file_io.* Thanks! http://codereview.chromium.org/7433006/diff/39042/webkit/plugins/ppapi/quota_file_io.cc File webkit/plugins/ppapi/quota_file_io.cc (right): http://codereview.chromium.org/7433006/diff/39042/webkit/plugins/ppapi/quota_file_io.cc#newcode310 webkit/plugins/ppapi/quota_file_io.cc:310: if (--inflight_operations_ == ...
9 years, 4 months ago (2011-07-28 17:40:52 UTC) #27
yzshen1
LGTM for ppb_file_io_impl.* and quota_file_io.* Thanks! http://codereview.chromium.org/7433006/diff/39042/webkit/plugins/ppapi/quota_file_io.cc File webkit/plugins/ppapi/quota_file_io.cc (right): http://codereview.chromium.org/7433006/diff/39042/webkit/plugins/ppapi/quota_file_io.cc#newcode310 webkit/plugins/ppapi/quota_file_io.cc:310: if (--inflight_operations_ == ...
9 years, 4 months ago (2011-07-28 17:40:52 UTC) #28
michaeln
if it lgt shen, then it lgtm
9 years, 4 months ago (2011-07-28 19:39:25 UTC) #29
kinuko
9 years, 4 months ago (2011-07-29 08:39:51 UTC) #30
Thanks for reviewing!  All fixed, I'm going to submit.

http://codereview.chromium.org/7433006/diff/50001/webkit/plugins/ppapi/quota_...
File webkit/plugins/ppapi/quota_file_io.h (right):

http://codereview.chromium.org/7433006/diff/50001/webkit/plugins/ppapi/quota_...
webkit/plugins/ppapi/quota_file_io.h:37: // Returns true and when the operation
is successfully dispatched.
On 2011/07/28 17:40:52, yzshen1 wrote:
> nit: remove 'and'?

Done.

http://codereview.chromium.org/7433006/diff/50001/webkit/plugins/ppapi/quota_...
webkit/plugins/ppapi/quota_file_io.h:42: // |callback| are always dispatched in
order.
On 2011/07/28 17:40:52, yzshen1 wrote:
> nit: Please be more clear about "in order" in the comments.
> - the same order as Write being called.

Done.

> - do we support multiple inflight SetLength/WillWrite/WillSetLength? (It seems
> WillWrite is okay, but .*SetLength are not. Right?)

Right.  I added the comment too.

http://codereview.chromium.org/7433006/diff/50001/webkit/plugins/ppapi/quota_...
File webkit/plugins/ppapi/quota_file_io_unittest.cc (right):

http://codereview.chromium.org/7433006/diff/50001/webkit/plugins/ppapi/quota_...
webkit/plugins/ppapi/quota_file_io_unittest.cc:8: #include "base/task.h"
On 2011/07/28 17:40:52, yzshen1 wrote:
> Please arrange includes alphabetically.

Done.

http://codereview.chromium.org/7433006/diff/50001/webkit/plugins/ppapi/quota_...
webkit/plugins/ppapi/quota_file_io_unittest.cc:10: #include
"base/memory/scoped_callback_factory.h"
On 2011/07/28 17:40:52, yzshen1 wrote:
> You have redundant includes. 

Done.

Powered by Google App Engine
This is Rietveld 408576698