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

Issue 26564009: [PPAPI] It is now possible to pass filesystems from JavaScript to NaCl modules. (Closed)

Created:
7 years, 2 months ago by Matt Giuca
Modified:
7 years, 1 month ago
CC:
chromium-reviews, joi+watch-content_chromium.org, darin-cc_chromium.org, jam, chrome-apps-syd-reviews_chromium.org
Base URL:
http://git.chromium.org/chromium/src.git@master
Visibility:
Public.

Description

[PPAPI] It is now possible to pass filesystems from JavaScript to NaCl modules. If a DOMFileSystem is passed as a message to the NaCl module, it will be converted into a resource var which is available to the plugin via the dev interface PPB_VarResource_Dev. BUG=177017 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=232080

Patch Set 1 #

Total comments: 56

Patch Set 2 : Respond to some of the comments. #

Patch Set 3 : Added comments. #

Patch Set 4 : Remove unused ResourceCreationProxy proxy. #

Patch Set 5 : Wrote browser test. #

Patch Set 6 : Rebase. #

Patch Set 7 : ResourceRawVarData: Allow pp_resource_ to be 0; misc cleanup. #

Patch Set 8 : ResourceRawVarData: Remove ResourceDispatcher and inline everything; much simpler. #

Total comments: 17

Patch Set 9 : Nits. #

Patch Set 10 : Test: Write to a temporary file in JS and read it in the plugin. #

Patch Set 11 : GetConnectionForInstance DCHECKs if in-process. #

Total comments: 7

Patch Set 12 : David's testing suggestions. #

Patch Set 13 : ResourceConverter fails gracefully when given an EXTERNAL file system. #

Total comments: 13

Patch Set 14 : Raymes nits. #

Patch Set 15 : Rebase. #

Patch Set 16 : Move code from ResourceRawVarData to PluginVarTracker (work around deps issues). #

Patch Set 17 : Cleanup after refactor. #

Total comments: 12

Patch Set 18 : Use a vector instead of variable-length array. (Fix Windows compile). #

Total comments: 4

Patch Set 19 : Raymes nits. #

Total comments: 9

Patch Set 20 : Address comments. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+363 lines, -16 lines) Patch
M chrome/test/ppapi/ppapi_browsertest.cc View 1 2 3 4 5 5 chunks +5 lines, -0 lines 0 comments Download
M content/browser/renderer_host/pepper/pepper_renderer_connection.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 2 chunks +23 lines, -6 lines 0 comments Download
M content/renderer/pepper/host_var_tracker.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 1 chunk +5 lines, -0 lines 0 comments Download
M content/renderer/pepper/host_var_tracker.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 1 chunk +11 lines, -0 lines 0 comments Download
M content/renderer/pepper/resource_converter.cc View 1 2 3 4 5 6 7 8 9 10 11 12 3 chunks +85 lines, -2 lines 0 comments Download
M ppapi/proxy/plugin_var_tracker.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 1 chunk +5 lines, -0 lines 0 comments Download
M ppapi/proxy/plugin_var_tracker.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 3 chunks +48 lines, -0 lines 0 comments Download
M ppapi/proxy/ppapi_messages.h View 1 2 3 4 5 1 chunk +10 lines, -0 lines 0 comments Download
M ppapi/proxy/raw_var_data.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 1 chunk +12 lines, -8 lines 0 comments Download
M ppapi/shared_impl/test_globals.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 1 chunk +7 lines, -0 lines 0 comments Download
M ppapi/shared_impl/var_tracker.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 2 chunks +14 lines, -0 lines 0 comments Download
M ppapi/tests/test_post_message.h View 1 2 3 4 5 6 7 8 9 10 11 4 chunks +20 lines, -0 lines 0 comments Download
M ppapi/tests/test_post_message.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 6 chunks +118 lines, -0 lines 0 comments Download

Messages

Total messages: 45 (0 generated)
Matt Giuca
Hi, this is the final piece of the puzzle to get file passing from JS ...
7 years, 2 months ago (2013-10-10 05:15:38 UTC) #1
raymes
looking good, thanks! https://codereview.chromium.org/26564009/diff/1/content/browser/renderer_host/pepper/pepper_renderer_connection.cc File content/browser/renderer_host/pepper/pepper_renderer_connection.cc (right): https://codereview.chromium.org/26564009/diff/1/content/browser/renderer_host/pepper/pepper_renderer_connection.cc#newcode114 content/browser/renderer_host/pepper/pepper_renderer_connection.cc:114: } else if (nested_msg.type() == PpapiHostMsg_FileSystem_CreateFromRenderer::ID) ...
7 years, 2 months ago (2013-10-11 04:02:24 UTC) #2
raymes
On 2013/10/10 05:15:38, Matt Giuca wrote: > Hi, this is the final piece of the ...
7 years, 2 months ago (2013-10-11 04:16:49 UTC) #3
yzshen1
https://codereview.chromium.org/26564009/diff/1/content/renderer/pepper/resource_converter.cc File content/renderer/pepper/resource_converter.cc (right): https://codereview.chromium.org/26564009/diff/1/content/renderer/pepper/resource_converter.cc#newcode112 content/renderer/pepper/resource_converter.cc:112: if (!dom_file_system.isNull()) { if this if-block doesn't run, |result| ...
7 years, 2 months ago (2013-10-11 17:45:45 UTC) #4
dmichael (off chromium)
https://codereview.chromium.org/26564009/diff/1/content/browser/renderer_host/pepper/pepper_renderer_connection.cc File content/browser/renderer_host/pepper/pepper_renderer_connection.cc (right): https://codereview.chromium.org/26564009/diff/1/content/browser/renderer_host/pepper/pepper_renderer_connection.cc#newcode124 content/browser/renderer_host/pepper/pepper_renderer_connection.cc:124: file_system_type)); Hmm. This could actually go in to content_browser_pepper_host_factory.cc. ...
7 years, 2 months ago (2013-10-11 19:21:36 UTC) #5
Matt Giuca
Responding to some of the review comments. The more complex ones will take a bit ...
7 years, 2 months ago (2013-10-15 00:25:16 UTC) #6
yzshen1
https://codereview.chromium.org/26564009/diff/1/content/renderer/pepper/resource_converter.cc File content/renderer/pepper/resource_converter.cc (right): https://codereview.chromium.org/26564009/diff/1/content/renderer/pepper/resource_converter.cc#newcode66 content/renderer/pepper/resource_converter.cc:66: content::PepperFileSystemHost* file_system_host = nit: You could call Pass() on ...
7 years, 2 months ago (2013-10-15 18:38:02 UTC) #7
raymes
https://codereview.chromium.org/26564009/diff/1/content/renderer/pepper/resource_converter.cc File content/renderer/pepper/resource_converter.cc (right): https://codereview.chromium.org/26564009/diff/1/content/renderer/pepper/resource_converter.cc#newcode123 content/renderer/pepper/resource_converter.cc:123: *result = result_var->GetPPVar(); It shouldn't be important to know ...
7 years, 2 months ago (2013-10-16 00:45:13 UTC) #8
Matt Giuca
https://codereview.chromium.org/26564009/diff/1/content/browser/renderer_host/pepper/pepper_renderer_connection.cc File content/browser/renderer_host/pepper/pepper_renderer_connection.cc (right): https://codereview.chromium.org/26564009/diff/1/content/browser/renderer_host/pepper/pepper_renderer_connection.cc#newcode124 content/browser/renderer_host/pepper/pepper_renderer_connection.cc:124: file_system_type)); Done (comment). Actually, I think we really don't ...
7 years, 2 months ago (2013-10-17 09:17:57 UTC) #9
dmichael (off chromium)
https://codereview.chromium.org/26564009/diff/1/content/browser/renderer_host/pepper/pepper_renderer_connection.cc File content/browser/renderer_host/pepper/pepper_renderer_connection.cc (right): https://codereview.chromium.org/26564009/diff/1/content/browser/renderer_host/pepper/pepper_renderer_connection.cc#newcode124 content/browser/renderer_host/pepper/pepper_renderer_connection.cc:124: file_system_type)); On 2013/10/17 09:17:58, Matt Giuca wrote: > Done ...
7 years, 2 months ago (2013-10-17 17:36:10 UTC) #10
Matt Giuca
https://codereview.chromium.org/26564009/diff/1/ppapi/proxy/raw_var_data.cc File ppapi/proxy/raw_var_data.cc (right): https://codereview.chromium.org/26564009/diff/1/ppapi/proxy/raw_var_data.cc#newcode779 ppapi/proxy/raw_var_data.cc:779: if (PpapiGlobals::Get()->IsPluginGlobals()) { So (I'm obviously going to have ...
7 years, 2 months ago (2013-10-18 00:00:52 UTC) #11
dmichael (off chromium)
You should get HostResourceVars since they're created by the HostVarTracker. Same way ArrayBuffer works. It ...
7 years, 2 months ago (2013-10-18 00:19:45 UTC) #12
Matt Giuca
On 2013/10/18 00:19:45, dmichael wrote: > You should get HostResourceVars since they're created by the ...
7 years, 2 months ago (2013-10-18 00:54:14 UTC) #13
Matt Giuca
https://codereview.chromium.org/26564009/diff/1/content/renderer/pepper/resource_converter.cc File content/renderer/pepper/resource_converter.cc (right): https://codereview.chromium.org/26564009/diff/1/content/renderer/pepper/resource_converter.cc#newcode75 content/renderer/pepper/resource_converter.cc:75: file_system_type); Oh I see where the extra copy is ...
7 years, 2 months ago (2013-10-18 07:09:30 UTC) #14
Matt Giuca
All comments are addressed. PTAL. https://codereview.chromium.org/26564009/diff/1/ppapi/proxy/raw_var_data.cc File ppapi/proxy/raw_var_data.cc (right): https://codereview.chromium.org/26564009/diff/1/ppapi/proxy/raw_var_data.cc#newcode677 ppapi/proxy/raw_var_data.cc:677: class ResourceDispatcher { OK ...
7 years, 2 months ago (2013-10-21 05:20:03 UTC) #15
Matt Giuca
palmer: Hi, adding you for security review on ppapi_messages.h. Note that of the two new ...
7 years, 2 months ago (2013-10-21 05:26:39 UTC) #16
raymes
It would also be good to have a test for ResourceConverter before this feature is ...
7 years, 2 months ago (2013-10-22 05:59:21 UTC) #17
dmichael (off chromium)
https://codereview.chromium.org/26564009/diff/251001/ppapi/proxy/raw_var_data.cc File ppapi/proxy/raw_var_data.cc (right): https://codereview.chromium.org/26564009/diff/251001/ppapi/proxy/raw_var_data.cc#newcode74 ppapi/proxy/raw_var_data.cc:74: return Connection(PluginGlobals::Get()->GetBrowserSender(), dispatcher); I don't think this would do ...
7 years, 2 months ago (2013-10-22 16:04:28 UTC) #18
Matt Giuca
> It would also be good to have a test for ResourceConverter > before this ...
7 years, 2 months ago (2013-10-23 08:05:54 UTC) #19
dmichael (off chromium)
lgtm https://codereview.chromium.org/26564009/diff/251001/ppapi/proxy/raw_var_data.cc File ppapi/proxy/raw_var_data.cc (right): https://codereview.chromium.org/26564009/diff/251001/ppapi/proxy/raw_var_data.cc#newcode716 ppapi/proxy/raw_var_data.cc:716: case PpapiPluginMsg_FileSystem_CreateFromPendingHost::ID: { Oh, right, switch/case is fine. ...
7 years, 2 months ago (2013-10-23 17:33:20 UTC) #20
dmichael (off chromium)
Oops, lost one of my comments somehow. Trying again. https://codereview.chromium.org/26564009/diff/511001/ppapi/tests/test_post_message.cc File ppapi/tests/test_post_message.cc (right): https://codereview.chromium.org/26564009/diff/511001/ppapi/tests/test_post_message.cc#newcode313 ppapi/tests/test_post_message.cc:313: ...
7 years, 2 months ago (2013-10-23 17:36:01 UTC) #21
yzshen1
LGTM Thanks! https://codereview.chromium.org/26564009/diff/1/ppapi/proxy/raw_var_data.cc File ppapi/proxy/raw_var_data.cc (right): https://codereview.chromium.org/26564009/diff/1/ppapi/proxy/raw_var_data.cc#newcode734 ppapi/proxy/raw_var_data.cc:734: ResourceCreationProxy proxy(dispatcher_); ResourceCreationProxy is what we use ...
7 years, 2 months ago (2013-10-23 18:29:23 UTC) #22
Matt Giuca
https://codereview.chromium.org/26564009/diff/511001/content/renderer/pepper/resource_converter.cc File content/renderer/pepper/resource_converter.cc (right): https://codereview.chromium.org/26564009/diff/511001/content/renderer/pepper/resource_converter.cc#newcode112 content/renderer/pepper/resource_converter.cc:112: if (!dom_file_system.isNull()) { No, I don't want to do ...
7 years, 2 months ago (2013-10-24 01:00:10 UTC) #23
Matt Giuca
https://codereview.chromium.org/26564009/diff/1/ppapi/proxy/raw_var_data.cc File ppapi/proxy/raw_var_data.cc (right): https://codereview.chromium.org/26564009/diff/1/ppapi/proxy/raw_var_data.cc#newcode734 ppapi/proxy/raw_var_data.cc:734: ResourceCreationProxy proxy(dispatcher_); OK, this seems like a complicated change ...
7 years, 2 months ago (2013-10-24 03:15:26 UTC) #24
Matt Giuca
Hi Tom, Chris told me he's too busy for a review. Would you be able ...
7 years, 2 months ago (2013-10-24 22:56:11 UTC) #25
tsepez (do not use)
Looking ... On Thu, Oct 24, 2013 at 3:56 PM, <mgiuca@chromium.org> wrote: > Hi Tom, ...
7 years, 2 months ago (2013-10-24 22:56:42 UTC) #26
Tom Sepez
lgtm https://codereview.chromium.org/26564009/diff/681001/ppapi/proxy/ppapi_messages.h File ppapi/proxy/ppapi_messages.h (right): https://codereview.chromium.org/26564009/diff/681001/ppapi/proxy/ppapi_messages.h#newcode1297 ppapi/proxy/ppapi_messages.h:1297: std::string /* root_url */, How does the browser ...
7 years, 2 months ago (2013-10-24 23:02:42 UTC) #27
Matt Giuca
https://codereview.chromium.org/26564009/diff/681001/ppapi/proxy/ppapi_messages.h File ppapi/proxy/ppapi_messages.h (right): https://codereview.chromium.org/26564009/diff/681001/ppapi/proxy/ppapi_messages.h#newcode1297 ppapi/proxy/ppapi_messages.h:1297: std::string /* root_url */, I don't really know the ...
7 years, 2 months ago (2013-10-25 00:55:13 UTC) #28
kinuko
https://codereview.chromium.org/26564009/diff/681001/content/renderer/pepper/resource_converter.cc File content/renderer/pepper/resource_converter.cc (right): https://codereview.chromium.org/26564009/diff/681001/content/renderer/pepper/resource_converter.cc#newcode43 content/renderer/pepper/resource_converter.cc:43: return PP_FILESYSTEMTYPE_EXTERNAL; In my understanding WebFileSystem::TypeExternal and PP_FILESYSTEM_EXTERNAL are ...
7 years, 2 months ago (2013-10-25 05:43:01 UTC) #29
dmichael (off chromium)
(still lgtm from my perspective, just an FYI comment) https://codereview.chromium.org/26564009/diff/511001/ppapi/tests/test_post_message.cc File ppapi/tests/test_post_message.cc (right): https://codereview.chromium.org/26564009/diff/511001/ppapi/tests/test_post_message.cc#newcode637 ppapi/tests/test_post_message.cc:637: ...
7 years, 1 month ago (2013-10-25 20:13:15 UTC) #30
raymes
lgtm with nits https://codereview.chromium.org/26564009/diff/681001/ppapi/tests/test_post_message.cc File ppapi/tests/test_post_message.cc (right): https://codereview.chromium.org/26564009/diff/681001/ppapi/tests/test_post_message.cc#newcode302 ppapi/tests/test_post_message.cc:302: // WaitForMessagesAsync correctly waits until the ...
7 years, 1 month ago (2013-10-27 21:59:33 UTC) #31
Matt Giuca
https://codereview.chromium.org/26564009/diff/681001/content/renderer/pepper/resource_converter.cc File content/renderer/pepper/resource_converter.cc (right): https://codereview.chromium.org/26564009/diff/681001/content/renderer/pepper/resource_converter.cc#newcode43 content/renderer/pepper/resource_converter.cc:43: return PP_FILESYSTEMTYPE_EXTERNAL; I think they are the same. Look ...
7 years, 1 month ago (2013-10-29 12:21:41 UTC) #32
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/mgiuca@chromium.org/26564009/861001
7 years, 1 month ago (2013-10-29 12:22:39 UTC) #33
Matt Giuca
Raymes, would you be able to look at Patch Set 16 to see if it ...
7 years, 1 month ago (2013-10-30 05:52:23 UTC) #34
Matt Giuca
Sorry, now look at the delta between PS 15 and 17. Thanks :)
7 years, 1 month ago (2013-10-30 06:20:09 UTC) #35
raymes
https://codereview.chromium.org/26564009/diff/1041001/content/renderer/pepper/host_var_tracker.cc File content/renderer/pepper/host_var_tracker.cc (right): https://codereview.chromium.org/26564009/diff/1041001/content/renderer/pepper/host_var_tracker.cc#newcode110 content/renderer/pepper/host_var_tracker.cc:110: return VarTracker::MakeResourcePPVar(0); Should this be NOTREACHED? https://codereview.chromium.org/26564009/diff/1041001/ppapi/proxy/plugin_var_tracker.cc File ppapi/proxy/plugin_var_tracker.cc ...
7 years, 1 month ago (2013-10-30 06:31:50 UTC) #36
raymes
lgtm
7 years, 1 month ago (2013-10-30 06:33:03 UTC) #37
Matt Giuca
Yuzhu, David: Please take another look. I discussed this with Raymes. We agreed that in ...
7 years, 1 month ago (2013-10-30 07:00:38 UTC) #38
dmichael (off chromium)
some nits, but o/w lgtm https://codereview.chromium.org/26564009/diff/1041001/ppapi/proxy/plugin_var_tracker.cc File ppapi/proxy/plugin_var_tracker.cc (right): https://codereview.chromium.org/26564009/diff/1041001/ppapi/proxy/plugin_var_tracker.cc#newcode196 ppapi/proxy/plugin_var_tracker.cc:196: return VarTracker::MakeResourcePPVar(pp_resource); On 2013/10/30 ...
7 years, 1 month ago (2013-10-30 17:47:26 UTC) #39
yzshen1
I don't have suggestions other than those given by David. Thanks!
7 years, 1 month ago (2013-10-30 22:42:02 UTC) #40
Matt Giuca
https://codereview.chromium.org/26564009/diff/1041001/ppapi/proxy/plugin_var_tracker.cc File ppapi/proxy/plugin_var_tracker.cc (right): https://codereview.chromium.org/26564009/diff/1041001/ppapi/proxy/plugin_var_tracker.cc#newcode196 ppapi/proxy/plugin_var_tracker.cc:196: return VarTracker::MakeResourcePPVar(pp_resource); On 2013/10/30 17:47:27, dmichael wrote: > On ...
7 years, 1 month ago (2013-10-30 23:13:53 UTC) #41
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/mgiuca@chromium.org/26564009/1511001
7 years, 1 month ago (2013-10-30 23:57:13 UTC) #42
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/mgiuca@chromium.org/26564009/1511001
7 years, 1 month ago (2013-10-31 10:09:51 UTC) #43
commit-bot: I haz the power
Change committed as 232080
7 years, 1 month ago (2013-10-31 10:59:05 UTC) #44
dmichael (off chromium)
7 years, 1 month ago (2013-10-31 16:54:27 UTC) #45
Message was sent while issue was closed.
https://codereview.chromium.org/26564009/diff/1201002/ppapi/tests/test_post_m...
File ppapi/tests/test_post_message.cc (right):

https://codereview.chromium.org/26564009/diff/1201002/ppapi/tests/test_post_m...
ppapi/tests/test_post_message.cc:635: char* buffer = &buffer_vector[0];  //
Note: Not null-terminated!
On 2013/10/30 23:13:54, Matt Giuca wrote:
> You mean the one that read:
> 
> int length = ...;
> char buffer[length];
> 
> ?
> 
> MSVC didn't like it. Apparently, you aren't allowed to initialize a C-like
array
> with a non-constant variable as the length. I'm not sure if this is a rule of
> C++ or a restriction in MSVC, but either way, this code is more likely to be
> standards compliant.
> 
> (IIRC, the ability to do this was added formally in C99, but not C++. It's
> possibly in C++11, but we aren't allowed to use that yet.)
Oh, right, thanks for explaining.

FYI, you could also use scoped_ptr<char[]> in this kind of situation since it's
not going to need to grow. Not an important difference though here.

Powered by Google App Engine
This is Rietveld 408576698