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

Issue 11419131: Refactor FileIO to the new design (Closed)

Created:
8 years, 1 month ago by victorhsieh
Modified:
7 years, 9 months ago
CC:
chromium-reviews, joi+watch-content_chromium.org, darin-cc_chromium.org, jam, bbudge
Base URL:
http://git.chromium.org/chromium/src.git@master
Visibility:
Public.

Description

Refactor FileIO to the new design. GetOSDescriptor is done by passing raw file descriptor via in-process messaging. Operations are kept exclusive, but the restriction can be easily removed if needed. BUG=

Patch Set 1 : #

Total comments: 70

Patch Set 2 : #

Total comments: 7

Patch Set 3 : #

Total comments: 6

Patch Set 4 : #

Total comments: 8

Patch Set 5 : #

Total comments: 24

Patch Set 6 : #

Total comments: 20

Patch Set 7 : #

Patch Set 8 : #

Patch Set 9 : int32_t #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1250 lines, -1569 lines) Patch
M content/content_renderer.gypi View 1 2 3 4 5 6 1 chunk +2 lines, -0 lines 0 comments Download
M content/renderer/pepper/content_renderer_pepper_host_factory.cc View 1 2 3 4 5 6 2 chunks +4 lines, -0 lines 0 comments Download
A content/renderer/pepper/pepper_file_io_host.h View 1 2 3 4 5 6 1 chunk +128 lines, -0 lines 0 comments Download
A content/renderer/pepper/pepper_file_io_host.cc View 1 2 3 4 5 6 1 chunk +564 lines, -0 lines 0 comments Download
M content/renderer/pepper/pepper_in_process_resource_creation.h View 1 2 3 4 5 6 1 chunk +1 line, -0 lines 0 comments Download
M content/renderer/pepper/pepper_in_process_resource_creation.cc View 1 2 3 4 5 6 2 chunks +8 lines, -0 lines 0 comments Download
M content/renderer/pepper/pepper_plugin_delegate_impl.cc View 1 2 3 4 5 6 1 chunk +0 lines, -1 line 0 comments Download
M ppapi/ppapi_proxy.gypi View 1 2 3 4 5 6 2 chunks +2 lines, -2 lines 0 comments Download
M ppapi/ppapi_shared.gypi View 1 2 3 4 5 2 chunks +2 lines, -2 lines 0 comments Download
A ppapi/proxy/file_io_resource.h View 1 2 3 4 5 6 1 chunk +92 lines, -0 lines 0 comments Download
A ppapi/proxy/file_io_resource.cc View 1 2 3 4 5 6 1 chunk +286 lines, -0 lines 0 comments Download
M ppapi/proxy/interface_list.cc View 1 2 3 4 5 6 1 chunk +0 lines, -1 line 0 comments Download
M ppapi/proxy/ppapi_messages.h View 1 2 3 4 5 6 3 chunks +32 lines, -53 lines 0 comments Download
D ppapi/proxy/ppb_file_io_proxy.h View 1 chunk +0 lines, -93 lines 0 comments Download
D ppapi/proxy/ppb_file_io_proxy.cc View 1 chunk +0 lines, -457 lines 0 comments Download
M ppapi/proxy/resource_creation_proxy.cc View 1 2 3 4 5 6 3 chunks +2 lines, -2 lines 0 comments Download
A ppapi/shared_impl/file_io_state_manager.h View 1 2 3 4 5 6 7 8 1 chunk +68 lines, -0 lines 0 comments Download
A ppapi/shared_impl/file_io_state_manager.cc View 1 2 3 4 5 6 1 chunk +55 lines, -0 lines 0 comments Download
M ppapi/shared_impl/ppb_file_io_shared.h View 1 2 3 4 5 1 chunk +0 lines, -159 lines 0 comments Download
M ppapi/shared_impl/ppb_file_io_shared.cc View 1 2 3 4 5 1 chunk +0 lines, -244 lines 0 comments Download
M ppapi/thunk/interfaces_ppb_private.h View 1 2 3 4 5 6 2 chunks +2 lines, -3 lines 0 comments Download
M ppapi/thunk/interfaces_ppb_public_stable.h View 1 2 3 4 5 6 2 chunks +2 lines, -3 lines 0 comments Download
M webkit/glue/webkit_glue.gypi View 1 2 3 4 5 6 1 chunk +0 lines, -2 lines 0 comments Download
D webkit/plugins/ppapi/ppb_file_io_impl.h View 1 chunk +0 lines, -110 lines 0 comments Download
D webkit/plugins/ppapi/ppb_file_io_impl.cc View 1 chunk +0 lines, -431 lines 0 comments Download
M webkit/plugins/ppapi/resource_creation_impl.h View 1 2 3 4 5 6 1 chunk +0 lines, -1 line 0 comments Download
M webkit/plugins/ppapi/resource_creation_impl.cc View 1 2 3 4 5 6 2 chunks +0 lines, -5 lines 0 comments Download

Messages

Total messages: 33 (0 generated)
victorhsieh
The refactoring is done, but I have a few questions. Is the exclusiveness of operation ...
8 years, 1 month ago (2012-11-22 08:16:37 UTC) #1
brettw
->raymes
8 years ago (2012-11-26 18:37:18 UTC) #2
raymes
Some initial comments. I'll finish the review tonight. https://codereview.chromium.org/11419131/diff/2001/content/public/renderer/renderer_ppapi_host.h File content/public/renderer/renderer_ppapi_host.h (right): https://codereview.chromium.org/11419131/diff/2001/content/public/renderer/renderer_ppapi_host.h#newcode84 content/public/renderer/renderer_ppapi_host.h:84: // ...
8 years ago (2012-11-26 22:30:54 UTC) #3
raymes
https://codereview.chromium.org/11419131/diff/2001/ppapi/api/trusted/ppb_file_io_trusted.idl File ppapi/api/trusted/ppb_file_io_trusted.idl (right): https://codereview.chromium.org/11419131/diff/2001/ppapi/api/trusted/ppb_file_io_trusted.idl#newcode23 ppapi/api/trusted/ppb_file_io_trusted.idl:23: [deprecate=0.5] Also I'm curious what the background is behind ...
8 years ago (2012-11-26 22:33:45 UTC) #4
brettw
https://codereview.chromium.org/11419131/diff/2001/ppapi/api/trusted/ppb_file_io_trusted.idl File ppapi/api/trusted/ppb_file_io_trusted.idl (right): https://codereview.chromium.org/11419131/diff/2001/ppapi/api/trusted/ppb_file_io_trusted.idl#newcode23 ppapi/api/trusted/ppb_file_io_trusted.idl:23: [deprecate=0.5] This was only used to implement the SRPC ...
8 years ago (2012-11-26 23:38:45 UTC) #5
raymes
Some more comments but I still have to look at the plugin side of the ...
8 years ago (2012-11-27 06:54:28 UTC) #6
victorhsieh
https://codereview.chromium.org/11419131/diff/2001/content/public/renderer/renderer_ppapi_host.h File content/public/renderer/renderer_ppapi_host.h (right): https://codereview.chromium.org/11419131/diff/2001/content/public/renderer/renderer_ppapi_host.h#newcode84 content/public/renderer/renderer_ppapi_host.h:84: // Returns the PluginDelegate for the given plugin instance, ...
8 years ago (2012-11-27 09:44:42 UTC) #7
raymes
It looks like you might have forgotten to update with the latest patch set. There ...
8 years ago (2012-11-27 16:41:29 UTC) #8
raymes
I asked Brett about the two things: 1) Let's keep the operations mutually exclusive as ...
8 years ago (2012-11-27 21:06:17 UTC) #9
victorhsieh
Operation restriction is added back to the host.
8 years ago (2012-11-28 04:11:36 UTC) #10
victorhsieh
https://codereview.chromium.org/11419131/diff/2001/content/renderer/pepper/pepper_file_io_host.cc File content/renderer/pepper/pepper_file_io_host.cc (right): https://codereview.chromium.org/11419131/diff/2001/content/renderer/pepper/pepper_file_io_host.cc#newcode7 content/renderer/pepper/pepper_file_io_host.cc:7: #include <string> On 2012/11/27 16:41:30, raymes wrote: > On ...
8 years ago (2012-11-28 04:11:55 UTC) #11
raymes1
https://codereview.chromium.org/11419131/diff/2001/ppapi/shared_impl/ppb_file_io_shared.h File ppapi/shared_impl/ppb_file_io_shared.h (right): https://codereview.chromium.org/11419131/diff/2001/ppapi/shared_impl/ppb_file_io_shared.h#newcode1 ppapi/shared_impl/ppb_file_io_shared.h:1: // Copyright (c) 2012 The Chromium Authors. All rights ...
8 years ago (2012-11-28 05:26:26 UTC) #12
victorhsieh
https://codereview.chromium.org/11419131/diff/2001/ppapi/shared_impl/ppb_file_io_shared.h File ppapi/shared_impl/ppb_file_io_shared.h (right): https://codereview.chromium.org/11419131/diff/2001/ppapi/shared_impl/ppb_file_io_shared.h#newcode1 ppapi/shared_impl/ppb_file_io_shared.h:1: // Copyright (c) 2012 The Chromium Authors. All rights ...
8 years ago (2012-11-28 07:11:04 UTC) #13
victorhsieh
@jln, please have a look at ppapi_message.h. Overall the change is a refactoring and doesn't ...
8 years ago (2012-11-28 09:52:17 UTC) #14
raymes
https://codereview.chromium.org/11419131/diff/5036/content/renderer/pepper/pepper_file_io_host.cc File content/renderer/pepper/pepper_file_io_host.cc (right): https://codereview.chromium.org/11419131/diff/5036/content/renderer/pepper/pepper_file_io_host.cc#newcode154 content/renderer/pepper/pepper_file_io_host.cc:154: int32_t rv = CommonPreCondition(false, OPERATION_EXCLUSIVE); If we make the ...
8 years ago (2012-11-28 18:39:35 UTC) #15
raymes
https://codereview.chromium.org/11419131/diff/5036/content/renderer/pepper/pepper_file_io_host.h File content/renderer/pepper/pepper_file_io_host.h (right): https://codereview.chromium.org/11419131/diff/5036/content/renderer/pepper/pepper_file_io_host.h#newcode93 content/renderer/pepper/pepper_file_io_host.h:93: void ExecutePlatformGeneralCallback( We should be able to fit the ...
8 years ago (2012-11-29 00:50:58 UTC) #16
victorhsieh
https://codereview.chromium.org/11419131/diff/5036/content/renderer/pepper/pepper_file_io_host.cc File content/renderer/pepper/pepper_file_io_host.cc (right): https://codereview.chromium.org/11419131/diff/5036/content/renderer/pepper/pepper_file_io_host.cc#newcode154 content/renderer/pepper/pepper_file_io_host.cc:154: int32_t rv = CommonPreCondition(false, OPERATION_EXCLUSIVE); On 2012/11/28 18:39:35, raymes ...
8 years ago (2012-11-29 06:34:55 UTC) #17
jln (very slow on Chromium)
On 2012/11/28 09:52:17, Victor Hsieh wrote: > @jln, please have a look at ppapi_message.h. Overall ...
8 years ago (2012-11-29 20:34:23 UTC) #18
raymes
lgtm with comments. You will need OWNERS approval from Brett and security signoff for the ...
8 years ago (2012-11-29 23:55:19 UTC) #19
brettw
owners lgtm
8 years ago (2012-11-30 00:01:56 UTC) #20
victorhsieh
Done and rebased. https://codereview.chromium.org/11419131/diff/77/ppapi/proxy/file_io_resource.cc File ppapi/proxy/file_io_resource.cc (right): https://codereview.chromium.org/11419131/diff/77/ppapi/proxy/file_io_resource.cc#newcode231 ppapi/proxy/file_io_resource.cc:231: FileIOStateManager::OPERATION_EXCLUSIVE || On 2012/11/29 23:55:19, raymes ...
8 years ago (2012-11-30 01:17:21 UTC) #21
jln (very slow on Chromium)
IPC lgtm on the basis that this is a re-factor that doesn't create additional attack ...
8 years ago (2012-11-30 23:16:53 UTC) #22
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/victorhsieh@chromium.org/11419131/9018
8 years ago (2012-12-01 00:05:05 UTC) #23
commit-bot: I haz the power
Presubmit check for 11419131-9018 failed and returned exit status 1. Running presubmit commit checks ...
8 years ago (2012-12-01 00:05:31 UTC) #24
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/victorhsieh@chromium.org/11419131/14043
8 years ago (2012-12-01 00:30:43 UTC) #25
commit-bot: I haz the power
Sorry for I got bad news for ya. Compile failed with a clobber build on ...
8 years ago (2012-12-01 00:58:35 UTC) #26
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/victorhsieh@chromium.org/11419131/14045
8 years ago (2012-12-01 01:03:20 UTC) #27
commit-bot: I haz the power
Retried try job too often on mac_rel for step(s) nacl_integration
8 years ago (2012-12-01 02:40:34 UTC) #28
victorhsieh
A NaCl chrome_browser_tests crashed at the DCHECK in ppapi_host.cc:OnHostMsgResourceCreated. When pm_manifest_file_test.cc:ManifestOpenTest runs, ContentRendererPepperHostFactory::CreateResourceHost returns a ...
8 years ago (2012-12-01 06:10:59 UTC) #29
victorhsieh
Hi Bill, do you have an idea about the issue here?
8 years ago (2012-12-04 01:12:30 UTC) #30
victorhsieh
The underlying infrastructure of those tests actually replies on FileIO and URLLoader (Brett, so your ...
8 years ago (2012-12-04 14:19:41 UTC) #31
raymes1
Yes this seems bad and my understanding of the NaCl stuff is also limited. Bill ...
8 years ago (2012-12-04 15:53:39 UTC) #32
dmichael(do not use this one)
8 years ago (2012-12-04 22:24:22 UTC) #33
On Tue, Dec 4, 2012 at 2:24 PM, Brett Wilson <brettw@chromium.org> wrote:

> +dmichael
>
> I did some looking at this.
>
> The "nacl plugin" (which is the trusted code that starts NaCl
> developed by Google) starts off as an in-process plugin. It has a
> PluginModule and a RendererPpapiHost. It uses this weird in-process
> router thing to make the resources work. It will use the URLLoader and
> FileIO pepper functions to load the nexe (the untrusted code from the
> web) from the web,
>
> When we load the nexe and start it, we do this crazy thing where we
> switch it over to using the out-of-process implementation (since as
> far as WebKit is concerned, there has only bee one plugin), but from
> our perspective, there are two. The most interesting function here is
> PluginInstance::ResetAsProxied.
>
> Apparently what happens is that we create a new PluginModule and
> RendererPpapiHost that's proxied (the original one was in-process) and
> switch the PluginInstance over to using that one. I wasn't really
> aware this was how it works until I just looked at this. From looking
> at it, it looks consistent to me, but it's weird that there are two
> modules and two RendererPpapiHosts, but one PluginInstance.
>
Yes, it's tricky. I was afraid this might cause trouble. The problem is:
- Every NaCl app instance runs in its own process
- therefore, every NaCl instance needs its own out-of-process proxy
- therefore, every NaCl instance needs its own PluginModule (which owns
each proxy)

This is all mostly workable, except it all goes through the same NaCl
trusted in-process plugin, as you found. You could maybe argue that there
should be 2 PpapiPluginInstances for each actual NaCl instance (one
representing the NaCl plugin, and one for the untrusted app). But as you
say, WebKit only sees it as one instance.

Longer-term, the sane thing to do is to get rid of the trusted NaCl plugin,
so we don't access the APIs from two different places (i.e., plugin and
untrusted app). Shorter-term, we've admittedly been crossing our fingers a
little bit and putting band-aids on the problems that turn up.

I'd have to look a bit harder to see what the best fix is here, but I
suspect it's not too hard to either:
- have a separate set of Host impl stuff to service the NaCl app
or
- Reset the existing host impl stuff to properly talk to the NaCl app



> One guess as to what's happening for you is that the nacl plugin is
> doing something after this switch has taken place. If we get anything
> coming in on the in-process one (like it's doing some FileIO after the
> switchover), it will check and see that there is no instance
> associated with it, since it was moved to the out-of-process one.
>
> Can you verify that's what's happening? If not, can you figure out
> what's happening with this background information? Once we know
> exactly what's happening we can work on a solution.
>
> Brett
>
> On Tue, Dec 4, 2012 at 7:53 AM, Raymes Khoury <raymes@google.com> wrote:
> > Yes this seems bad and my understanding of the NaCl stuff is also
> > limited. Bill or Brett may be able to help out here. My guess would be
> > that ResetAsProxied should also trigger updating the module_ instance
> > variable in the RendererPpapiHostImpl that's associated with the
> > instance. This might need a little plumbing to make it work.
> >
> > On Tue, Dec 4, 2012 at 6:19 AM, Victor Hsieh <victorhsieh@chromium.org>
> wrote:
> >> The underlying infrastructure of those tests actually replies on FileIO
> and
> >> URLLoader (Brett, so your refactoring might have the same issue?).  In
> the
> >> initial phase of the test, it relies on FileDownloader (as trusted
> code) to
> >> open the NaCl manifest it downloads (in this case, the unit test nmf).
>  It
> >> uses pp::FileIO for that, before the actual tests.  Later,
> InitAsProxiedNaCl
> >> is called when starting ppapi proxy, and that change the module of the
> >> plugin instance.  By the time the actual (untrusted) test is run,
> >> ContentRendererPepperHostFactory tries to create another
> PepperFileIOHost by
> >> first making sure the instance is valid.  But the module has been
> changed,
> >> thus the factory refuses to create a host for invalid instance.
> >>
> >> I'm not sure this behavior is test only or not (I guess not, since NaCl
> >> tests in browser_tests passed?).  How should we fix it?  I probably
> have to
> >> leave the change to someone if there is no simply workaround (e.g.
> disable
> >> IsValidInstance() check in ContentRendererPepperHostFactory).  Please
> >> suggest the next step.  Thanks.
> >>
> >> On Tue, Dec 4, 2012 at 9:12 AM, <victorhsieh@chromium.org> wrote:
> >>>
> >>> Hi Bill, do you have an idea about the issue here?
> >>>
> >>> https://codereview.chromium.org/11419131/
> >>
> >>
>

Powered by Google App Engine
This is Rietveld 408576698