|
|
Created:
5 years ago by Charlie Harrison Modified:
4 years, 2 months ago CC:
chromium-apps-reviews_chromium.org, chromium-reviews, creis+watch_chromium.org, Charlie Reis, darin-cc_chromium.org, extensions-reviews_chromium.org, jam, loading-reviews_chromium.org, nasko+codewatch_chromium.org, site-isolation-reviews_chromium.org, mmenke Base URL:
https://chromium.googlesource.com/chromium/src.git@master Target Ref:
refs/pending/heads/master Project:
chromium Visibility:
Public. |
DescriptionRefactored blocked_loaders_map_ to key by render frame route id
This change is a necessary step to completely refactor out render view ids from the ResourceDispatcherHostImpl.
This means that the interface to block, resume, or cancel requests now require passing in the frame routing id and the child id.
The ResourceScheduler, SaveFile, and Downloads still use the RVID.
BUG=472869
CQ_INCLUDE_TRYBOTS=tryserver.chromium.linux:linux_site_isolation
Committed: https://crrev.com/a2280cd27bd434f6033d3ab0c70886c06e3882b0
Cr-Commit-Position: refs/heads/master@{#373380}
Patch Set 1 #Patch Set 2 : fix unit tests #Patch Set 3 : Add another call to RenderFrameHost::Init() #Patch Set 4 : Add WebContentsObserver to notify frame deletion #Patch Set 5 : fix tests #Patch Set 6 : Fix cross site test (detached frame) for non-started request #Patch Set 7 : ForEachFrame Notifier interface #Patch Set 8 : just comments / minor restructuring (trybots previous) #
Total comments: 22
Patch Set 9 : Addressed Randy's comments #Patch Set 10 : Better type safety (wrap those ints) #Patch Set 11 : cleanup #
Total comments: 42
Patch Set 12 : Responded to nasko/rdsmith and added dependent patch set #Patch Set 13 : cleanup #Patch Set 14 : fix lambda return value #
Total comments: 22
Patch Set 15 : rebased on #369795 #Patch Set 16 : merged onto #370424 #Patch Set 17 : Replace FrameTree::ForEach with a for loop #
Total comments: 20
Patch Set 18 : Addressed comments (no architectural change) #Patch Set 19 : break statements in switch #Patch Set 20 : New, simpler API (default recurses frame tree) #
Total comments: 14
Patch Set 21 : Randy review #Patch Set 22 : fix browsertest #
Total comments: 2
Patch Set 23 : Nasko review (name change + comments) #
Total comments: 3
Patch Set 24 : nasko nit #
Total comments: 1
Messages
Total messages: 53 (8 generated)
Description was changed from ========== Refactored blocked_loaders_map_ to key by render frame route id This change is a necessary step to completely refactor out render view ids from the ResourceDispatcherHostImpl. While rvids still go through the RDHI, interfaces modifying the main data structure of the class all use the frame id now. BUG=472869 ========== to ========== Refactored blocked_loaders_map_ to key by render frame route id This change is a necessary step to completely refactor out render view ids from the ResourceDispatcherHostImpl. While rvids still go through the RDHI, interfaces modifying the main data structure of the class all use the frame id now. BUG=472869 ==========
Description was changed from ========== Refactored blocked_loaders_map_ to key by render frame route id This change is a necessary step to completely refactor out render view ids from the ResourceDispatcherHostImpl. While rvids still go through the RDHI, interfaces modifying the main data structure of the class all use the frame id now. BUG=472869 ========== to ========== Refactored blocked_loaders_map_ to key by render frame route id This change is a necessary step to completely refactor out render view ids from the ResourceDispatcherHostImpl. This means that the interface to block, resume, or cancel requests now require passing in the frame routing id and the child id. The ResourceScheduler, SaveFile, and Downloads still use the RVID. BUG=472869 ==========
csharrison@chromium.org changed reviewers: + davidben@chromium.org, nasko@chromium.org, ncarter@chromium.org, rdsmith@chromium.org
I'd love some high level comments on this change. Some comments of my own: - I'm not sure of GlobalFrameRoutingID as a name. If it stays, I will change ID => Id as nasko@ mentioned in a previous CL. - I would like to put GlobalFrameRoutingId in content/public/ and change all the interfaces to RDH to use it rather than paired opaque ints. This would be nice with a new method on RFH GetGlobalRoutingId(). If that's the only place in the code we instantiate the struct, we get pretty nice type safety. - I'm willing to make more code go through the ui to io notifier. So far that's a bit of a shell class until we want to notify ResourceScheduler of more UI events. Many thread hops in this CL could go through static methods there. https://codereview.chromium.org/1542743002/diff/140001/content/public/test/mo... File content/public/test/mock_render_process_host.cc (right): https://codereview.chromium.org/1542743002/diff/140001/content/public/test/mo... content/public/test/mock_render_process_host.cc:260: void MockRenderProcessHost::ResumeRequestsForFrame(int route_id) {} Will fix {} in next patch.
On 2015/12/28 15:37:32, csharrison wrote: > I'd love some high level comments on this change. High level comments (here and inline): * You might want to take a look at https://codereview.chromium.org/1529363006. I haven't done the review yet (:-}), but I think Lukasz is implementing id type safety in a way we might want to emulate at this level. * It looks like you've added LoaderIOThreadNotifier without actually using it anywhere; that correct? I generally oppose adding infrastructure before first use. > Some comments of my own: > - I'm not sure of GlobalFrameRoutingID as a name. If it stays, I will change ID > => Id as nasko@ mentioned in a previous CL. No strong feelings on naming. > - I would like to put GlobalFrameRoutingId in content/public/ and change all the > interfaces to RDH to use it rather than paired opaque ints. This would be nice > with a new method on RFH GetGlobalRoutingId(). If that's the only place in the > code we instantiate the struct, we get pretty nice type safety. So this gets at my biggest worry looking at this change, which is that it strikes me that it would be pretty easy to be passing a RV route id as an RF route id without realizing it. If you can find some way to dynamically (or better yet, statically) assert that that hasn't happened, I'd be much more comfortable (== I'd feel like I don't need to do quite as thorough a review, which may not matter to you, but does to me ;-}). So I'd strongly support *something* like what you describe above, though I'm neutral as to what. > > - I'm willing to make more code go through the ui to io notifier. So far that's > a bit of a shell class until we want to notify ResourceScheduler of more UI > events. Many thread hops in this CL could go through static methods there. > > https://codereview.chromium.org/1542743002/diff/140001/content/public/test/mo... > File content/public/test/mock_render_process_host.cc (right): > > https://codereview.chromium.org/1542743002/diff/140001/content/public/test/mo... > content/public/test/mock_render_process_host.cc:260: void > MockRenderProcessHost::ResumeRequestsForFrame(int route_id) {} > Will fix {} in next patch.
Whoops, also had little comments as I read through. https://codereview.chromium.org/1542743002/diff/140001/content/browser/loader... File content/browser/loader/global_routing_id.h (right): https://codereview.chromium.org/1542743002/diff/140001/content/browser/loader... content/browser/loader/global_routing_id.h:45: : GlobalRoutingID(child_id, render_frame_route_id) {} Any way to assert that? Don't we know something about the run time value of the frame routing ids? https://codereview.chromium.org/1542743002/diff/140001/content/browser/loader... File content/browser/loader/loader_io_thread_notifier.cc (right): https://codereview.chromium.org/1542743002/diff/140001/content/browser/loader... content/browser/loader/loader_io_thread_notifier.cc:21: DCHECK_CURRENTLY_ON(BrowserThread::IO); I'd be more aggressive on scattering these through this file; they're very useful for documentation. https://codereview.chromium.org/1542743002/diff/140001/content/browser/loader... content/browser/loader/loader_io_thread_notifier.cc:70: base::Bind(&NotifyForEachFrameOnIOHelper, frame_callback, routing_ids)); nit, suggestion: This looks like a lot of copying; I'm tempted to suggest you allocate the set once, and pass a scoped_ptr<>. https://codereview.chromium.org/1542743002/diff/140001/content/browser/loader... File content/browser/loader/loader_io_thread_notifier.h (right): https://codereview.chromium.org/1542743002/diff/140001/content/browser/loader... content/browser/loader/loader_io_thread_notifier.h:22: class LoaderIOThreadNotifer : public WebContentsObserver { A comment specifying the thread behavior of the class/the static method within it? I'm guessing it's pretty simple, but it's also pretty core to how the class behaves, so I think it would be a plus. https://codereview.chromium.org/1542743002/diff/140001/content/browser/loader... File content/browser/loader/resource_request_info_impl.cc (right): https://codereview.chromium.org/1542743002/diff/140001/content/browser/loader... content/browser/loader/resource_request_info_impl.cc:333: int render_frame_id, Good catch. (== Ooops, I should have caught this when I did the CL to make RRII always have good frame ids.) https://codereview.chromium.org/1542743002/diff/140001/content/browser/render... File content/browser/renderer_host/render_process_host_impl.cc (right): https://codereview.chromium.org/1542743002/diff/140001/content/browser/render... content/browser/renderer_host/render_process_host_impl.cc:1920: void RenderProcessHostImpl::ResumeRequestsForFrame(int route_id) { I hope you were really careful about making sure this transformation propagated up and down the callstack from here, since the compiler wouldn't have said a word :-}. https://codereview.chromium.org/1542743002/diff/140001/content/browser/render... File content/browser/renderer_host/render_widget_host_impl.cc (left): https://codereview.chromium.org/1542743002/diff/140001/content/browser/render... content/browser/renderer_host/render_widget_host_impl.cc:401: Why? https://codereview.chromium.org/1542743002/diff/140001/content/browser/web_co... File content/browser/web_contents/web_contents_impl.cc (right): https://codereview.chromium.org/1542743002/diff/140001/content/browser/web_co... content/browser/web_contents/web_contents_impl.cc:412: loader_io_thread_notifier_.reset(new LoaderIOThreadNotifer(this)); I'm confused; naively, it looks like you're never using this object after you construct it.
Addressed some inline comments. I think in a later patch I'll put the routing type in public/ Eventually, I think we'll use Lukasz's id type for routing ids, but for now I think it's best to encapsulate it in GlobalFrameRoutingID. Will defer to content owners on that though. https://codereview.chromium.org/1542743002/diff/140001/content/browser/loader... File content/browser/loader/global_routing_id.h (right): https://codereview.chromium.org/1542743002/diff/140001/content/browser/loader... content/browser/loader/global_routing_id.h:45: : GlobalRoutingID(child_id, render_frame_route_id) {} On 2015/12/29 23:11:36, Randy Smith - OOO until M 1-4 wrote: > Any way to assert that? Don't we know something about the run time value of the > frame routing ids? Hm I'm not quite sure. There was discussion on the site-isolation dev list about making them distinct from RVIDs at runtime. I think that idea was superseded by the ID type work. https://codereview.chromium.org/1542743002/diff/140001/content/browser/loader... File content/browser/loader/loader_io_thread_notifier.cc (right): https://codereview.chromium.org/1542743002/diff/140001/content/browser/loader... content/browser/loader/loader_io_thread_notifier.cc:21: DCHECK_CURRENTLY_ON(BrowserThread::IO); On 2015/12/29 23:11:37, Randy Smith - OOO until M 1-4 wrote: > I'd be more aggressive on scattering these through this file; they're very > useful for documentation. Done. https://codereview.chromium.org/1542743002/diff/140001/content/browser/loader... content/browser/loader/loader_io_thread_notifier.cc:70: base::Bind(&NotifyForEachFrameOnIOHelper, frame_callback, routing_ids)); On 2015/12/29 23:11:37, Randy Smith - OOO until M 1-4 wrote: > nit, suggestion: This looks like a lot of copying; I'm tempted to suggest you > allocate the set once, and pass a scoped_ptr<>. Done. https://codereview.chromium.org/1542743002/diff/140001/content/browser/loader... File content/browser/loader/loader_io_thread_notifier.h (right): https://codereview.chromium.org/1542743002/diff/140001/content/browser/loader... content/browser/loader/loader_io_thread_notifier.h:22: class LoaderIOThreadNotifer : public WebContentsObserver { On 2015/12/29 23:11:37, Randy Smith - OOO until M 1-4 wrote: > A comment specifying the thread behavior of the class/the static method within > it? I'm guessing it's pretty simple, but it's also pretty core to how the class > behaves, so I think it would be a plus. Done. https://codereview.chromium.org/1542743002/diff/140001/content/browser/loader... File content/browser/loader/resource_request_info_impl.cc (right): https://codereview.chromium.org/1542743002/diff/140001/content/browser/loader... content/browser/loader/resource_request_info_impl.cc:333: int render_frame_id, On 2015/12/29 23:11:37, Randy Smith - OOO until M 1-4 wrote: > Good catch. (== Ooops, I should have caught this when I did the CL to make RRII > always have good frame ids.) No prob! https://codereview.chromium.org/1542743002/diff/140001/content/browser/render... File content/browser/renderer_host/render_process_host_impl.cc (right): https://codereview.chromium.org/1542743002/diff/140001/content/browser/render... content/browser/renderer_host/render_process_host_impl.cc:1920: void RenderProcessHostImpl::ResumeRequestsForFrame(int route_id) { On 2015/12/29 23:11:37, Randy Smith - OOO until M 1-4 wrote: > I hope you were really careful about making sure this transformation propagated > up and down the callstack from here, since the compiler wouldn't have said a > word :-}. The approach I did here (and other places) was to change "ForRoute" or "ForView" to "ForFrame", forcing all callers to change. I hoped that would catch all cases, but your comment that the "compiler wouldn't have said a word" makes me worried. https://codereview.chromium.org/1542743002/diff/140001/content/browser/render... File content/browser/renderer_host/render_widget_host_impl.cc (left): https://codereview.chromium.org/1542743002/diff/140001/content/browser/render... content/browser/renderer_host/render_widget_host_impl.cc:401: On 2015/12/29 23:11:37, Randy Smith - OOO until M 1-4 wrote: > Why? I moved this logic to RenderFrameHost::Init(). I could have had this method resume requests for the main frame of the widget, though. https://codereview.chromium.org/1542743002/diff/140001/content/browser/web_co... File content/browser/web_contents/web_contents_impl.cc (right): https://codereview.chromium.org/1542743002/diff/140001/content/browser/web_co... content/browser/web_contents/web_contents_impl.cc:412: loader_io_thread_notifier_.reset(new LoaderIOThreadNotifer(this)); On 2015/12/29 23:11:37, Randy Smith - OOO until M 1-4 wrote: > I'm confused; naively, it looks like you're never using this object after you > construct it. The only way this gets used is as a WebContentsObserver (passing |this| starts observing). I included it as a scoped pointer here for lifetime reasons. I wasn't sure if there was a better way to do this. It also might be useful later if WCO methods need to call methods directly (too specialized for WCO callbacks). https://codereview.chromium.org/1542743002/diff/140001/content/public/test/mo... File content/public/test/mock_render_process_host.cc (right): https://codereview.chromium.org/1542743002/diff/140001/content/public/test/mo... content/public/test/mock_render_process_host.cc:260: void MockRenderProcessHost::ResumeRequestsForFrame(int route_id) {} On 2015/12/28 15:37:32, csharrison wrote: > Will fix {} in next patch. Done.
Responses to comments inline. Given that you asked for high level comments, I'm assuming that you're good with what I've given you for now--let me know if you want another round of review. https://codereview.chromium.org/1542743002/diff/140001/content/browser/loader... File content/browser/loader/global_routing_id.h (right): https://codereview.chromium.org/1542743002/diff/140001/content/browser/loader... content/browser/loader/global_routing_id.h:45: : GlobalRoutingID(child_id, render_frame_route_id) {} On 2015/12/30 20:51:49, csharrison wrote: > On 2015/12/29 23:11:36, Randy Smith - OOO until M 1-4 wrote: > > Any way to assert that? Don't we know something about the run time value of > the > > frame routing ids? > > Hm I'm not quite sure. There was discussion on the site-isolation dev list about > making them distinct from RVIDs at runtime. I think that idea was superseded by > the ID type work. Drat; I thought I remembered someone telling me that there were run-time differences between frame and view ids (even vs. odd) but scanning the code that doesn't seem to be the case; they both seem to be allocated off RenderProcessHostImpl::GetNextRoutingId(). So I guess we don't have a good way to do the assertion :-J. https://codereview.chromium.org/1542743002/diff/140001/content/browser/render... File content/browser/renderer_host/render_process_host_impl.cc (right): https://codereview.chromium.org/1542743002/diff/140001/content/browser/render... content/browser/renderer_host/render_process_host_impl.cc:1920: void RenderProcessHostImpl::ResumeRequestsForFrame(int route_id) { On 2015/12/30 20:51:49, csharrison wrote: > On 2015/12/29 23:11:37, Randy Smith - OOO until M 1-4 wrote: > > I hope you were really careful about making sure this transformation > propagated > > up and down the callstack from here, since the compiler wouldn't have said a > > word :-}. > > The approach I did here (and other places) was to change "ForRoute" or "ForView" > to "ForFrame", forcing all callers to change. I hoped that would catch all > cases, but your comment that the "compiler wouldn't have said a word" makes me > worried. No, actually, that sounds like a good approach. Sorry to make you worried; thanks for sketching out your method. https://codereview.chromium.org/1542743002/diff/140001/content/browser/web_co... File content/browser/web_contents/web_contents_impl.cc (right): https://codereview.chromium.org/1542743002/diff/140001/content/browser/web_co... content/browser/web_contents/web_contents_impl.cc:412: loader_io_thread_notifier_.reset(new LoaderIOThreadNotifer(this)); On 2015/12/30 20:51:49, csharrison wrote: > On 2015/12/29 23:11:37, Randy Smith - OOO until M 1-4 wrote: > > I'm confused; naively, it looks like you're never using this object after you > > construct it. > > The only way this gets used is as a WebContentsObserver (passing |this| starts > observing). I included it as a scoped pointer here for lifetime reasons. I > wasn't sure if there was a better way to do this. It also might be useful later > if WCO methods need to call methods directly (too specialized for WCO > callbacks). Right, whoops, sorry I missed that. I'm good with this.
So I ended up refactoring this a bit. Some changes: 1. RDHI interface now takes in GlobalFrameRoutingId. This gives us a bit more type safety and better method signatures for API consumers. 2. Most places construct a GlobalFrameRoutingId from a RenderFrameHostImpl. Those that don't do not have access to one (and only have the routes / proc ids). 3. All RDHI tasks posted to the IO thread now go through the LoaderIOThreadNotifier(Impl). I decided to do this because I'm nervous about some cases where people have been calling ResourceDispatcherHostImpl::Get() before the thread hop (possible race condition). PTAL. https://codereview.chromium.org/1542743002/diff/140001/content/browser/loader... File content/browser/loader/global_routing_id.h (right): https://codereview.chromium.org/1542743002/diff/140001/content/browser/loader... content/browser/loader/global_routing_id.h:45: : GlobalRoutingID(child_id, render_frame_route_id) {} On 2016/01/04 at 21:24:48, Randy Smith - OOO until M 1-4 wrote: > On 2015/12/30 20:51:49, csharrison wrote: > > On 2015/12/29 23:11:36, Randy Smith - OOO until M 1-4 wrote: > > > Any way to assert that? Don't we know something about the run time value of > > the > > > frame routing ids? > > > > Hm I'm not quite sure. There was discussion on the site-isolation dev list about > > making them distinct from RVIDs at runtime. I think that idea was superseded by > > the ID type work. > > Drat; I thought I remembered someone telling me that there were run-time differences between frame and view ids (even vs. odd) but scanning the code that doesn't seem to be the case; they both seem to be allocated off RenderProcessHostImpl::GetNextRoutingId(). So I guess we don't have a good way to do the assertion :-J. I think this was done as a local hack a few times, but I don't think it was ever landed. https://codereview.chromium.org/1542743002/diff/200001/content/browser/loader... File content/browser/loader/resource_dispatcher_host_impl.h (right): https://codereview.chromium.org/1542743002/diff/200001/content/browser/loader... content/browser/loader/resource_dispatcher_host_impl.h:216: // Causes all new requests for the route identified by |child_id| and Will fix this comment in next patch. https://codereview.chromium.org/1542743002/diff/200001/content/browser/loader... content/browser/loader/resource_dispatcher_host_impl.h:391: // acts like CancelRequestsForProcess when route_id is -1. Will fix this comment in the next patch.
So my primary focus in this review is on the architecture of LoaderIOThreadNotifier, and I have a couple of discomforts in that space: * The base class isn't an interface (== abstract base class), but has no state and no non-static methods. That effectively makes it a container for functions. I really don't think that it's worthwhile adding something to the content/ interface for that purpose; I'd just put those functions on RDH as static methods. * I have the same thought (though not as strongly; there isn't a class being created for it) about LoadIOThreadNotifierImpl's static methods; I think they'd be better off as static methods (with appropriate commenting about thread homes) on RDHI. This narrows its functionality down to what I think of as its main purpose in life: Forwarding WebContentsObserver notifications from UI to IO threads. * Given that LoadIOThreadNotifierImpl is tightly tied to the RDHI, I'm inclined to suggest it be in the RDHI header file (optional: As a nested class of RDHI). * I'm uncomfortable (as I think I mentioned in some of the detailed comments below) about the reliance on ResourceDispatcherHostImpl::Get(); I'd rather see the class initialized with that value so that we're just dependent on the global in one place rather than every time we call. I don't think this brings in any lifetime issues, as I think if this functionality can be used after RDHI is destroyed we're in trouble anyway. Having said that, use of RDHI::Get() is all around in the code, so this is a suggestion. * The methods currently on LIOTNI seem like a bit of a grab bag, presumably because you've just included the ones that are currently needed in the code. One way to deal with this is to flesh out in comments the expansion pathway for this class and what interfaces would be appropriate on it and what not as it grows (there's a detailed comment below that's a specialization of this general thought). Another alternative that I'm not sure it worthwhile, but I'll sketch out for you to decide what you think: make it a bit more general by allowing it to forward any WebContentsObserver notifications to a WebContentsObserver (or maybe a derived WebContentsObserverIO) which happens to live on the IO thread. There are a couple of issues with this approach: a) You'd have to take my above suggestion around the RDHI being passed to the constructor, and would need RDHI to inherit from a base WebContentsObserverIO class, b) It brings the lifetime issues front-and-center, and probably the only way to deal with them generally is weak pointers (either using base::WeakPtr<> or just having WebContentsObserverIO having a stub class that's owned across both threads and does forwarding to the actual WCOIO, though thinking that implementation through I think a straight weak pointer is better), and c) if you didn't put some cleverness in that I don't have a blinding insight for off the top of my head you'd be forwarding a lot of notifications you don't care about, which is a performance minus. But doing it would provide a cleaner, more modular interface. I'm just not sure it's worth it, so I'll raise the thought and let you decide whether you like it or not :-}. https://codereview.chromium.org/1542743002/diff/200001/content/browser/frame_... File content/browser/frame_host/interstitial_page_impl.cc (right): https://codereview.chromium.org/1542743002/diff/200001/content/browser/frame_... content/browser/frame_host/interstitial_page_impl.cc:842: // LoaderIOThreadNotifier tests if there is a ResourceDispatcherHostImpl, as This comment seems wrong to me--LIOTN isn't testing and the test is being done here. Unupdated comment? https://codereview.chromium.org/1542743002/diff/200001/content/browser/loader... File content/browser/loader/loader_io_thread_notifier_impl.cc (right): https://codereview.chromium.org/1542743002/diff/200001/content/browser/loader... content/browser/loader/loader_io_thread_notifier_impl.cc:20: bool CollectRenderFrameRoutingIds(std::set<GlobalFrameRoutingId>* route_ids, I'd value a quick comment explaining the goal of this call. When I started reading it I assumed it was to collect all frame routing ids for an entire tree, but that doesn't look like it's goal based on the implementation. Putting it near the function that it's a helper for would also be useful. I don't think the style guide prohibits putting static functions anywhere in a file. https://codereview.chromium.org/1542743002/diff/200001/content/browser/loader... content/browser/loader/loader_io_thread_notifier_impl.cc:21: FrameTreeNode* tree_node) { Style guide says parameter order is inputs, then outputs: https://google.github.io/styleguide/cppguide.html#Function_Parameter_Ordering https://codereview.chromium.org/1542743002/diff/200001/content/browser/loader... content/browser/loader/loader_io_thread_notifier_impl.cc:22: RenderFrameHostImpl* frame_host = tree_node->current_frame_host(); DCHECK for thread? I think it's useful being a-r about that in this file. https://codereview.chromium.org/1542743002/diff/200001/content/browser/loader... content/browser/loader/loader_io_thread_notifier_impl.cc:39: ResourceDispatcherHostImpl* rdh = ResourceDispatcherHostImpl::Get(); What are the lifetime implications here? Are you sure that there's no way for the RDHI to be torn down in a race with this message, and if so, why? (Probably worthwhile documenting the rationale somewhere.) https://codereview.chromium.org/1542743002/diff/200001/content/browser/loader... content/browser/loader/loader_io_thread_notifier_impl.cc:49: const GlobalFrameRoutingId& routing_id) { idea (up to you): I find myself wondering about whether implementing the above function in terms of this function might be reasonable for code re-use. It's right at the edge for me (which is why I'm not pushing it). https://codereview.chromium.org/1542743002/diff/200001/content/browser/loader... File content/browser/loader/loader_io_thread_notifier_impl.h (right): https://codereview.chromium.org/1542743002/diff/200001/content/browser/loader... content/browser/loader/loader_io_thread_notifier_impl.h:24: // thread. nit: Remove unneeded newline? https://codereview.chromium.org/1542743002/diff/200001/content/browser/loader... content/browser/loader/loader_io_thread_notifier_impl.h:36: // explicitly take a RenderFrameHost*. Hmmm. I find this comment a little confusing. The only other method here that takes an RFH is RenderFrameDeleted. Are you saying "Create new methods that take a RFH in preference to using this if the RFH is available?" https://codereview.chromium.org/1542743002/diff/200001/content/browser/render... File content/browser/renderer_host/render_widget_helper.cc (left): https://codereview.chromium.org/1542743002/diff/200001/content/browser/render... content/browser/renderer_host/render_widget_helper.cc:156: When are the requests blocked above resumed? https://codereview.chromium.org/1542743002/diff/200001/content/browser/render... File content/browser/renderer_host/render_widget_helper.cc (right): https://codereview.chromium.org/1542743002/diff/200001/content/browser/render... content/browser/renderer_host/render_widget_helper.cc:117: GlobalFrameRoutingId(render_process_id_, *main_frame_route_id)); This is safe because at this point there will only be one frame in the window? If so, maybe a comment to that effect? https://codereview.chromium.org/1542743002/diff/200001/content/browser/web_co... File content/browser/web_contents/web_contents_impl.cc (right): https://codereview.chromium.org/1542743002/diff/200001/content/browser/web_co... content/browser/web_contents/web_contents_impl.cc:1821: LoaderIOThreadNotifierImpl::ResumeBlockedRequestsForFrameInternal( Help me understand the context in which this code path is taken? The existence of this interface is a wart (IMO) and I'd love to find some way around needing it. https://codereview.chromium.org/1542743002/diff/200001/content/browser/web_co... content/browser/web_contents/web_contents_impl.cc:1821: LoaderIOThreadNotifierImpl::ResumeBlockedRequestsForFrameInternal( I presume that it's safe to just target the frame rather than the view here because this view won't have had a chance to create more frames at this point in the code? Worth documenting that if so.
Some preliminary comments, still going through the CL and only reviewed half of it. https://codereview.chromium.org/1542743002/diff/200001/content/browser/loader... File content/browser/loader/global_routing_id.h (right): https://codereview.chromium.org/1542743002/diff/200001/content/browser/loader... content/browser/loader/global_routing_id.h:43: struct GlobalFrameRoutingId : public GlobalRoutingID { Is it possible to avoid the inheritance? It will allow us to use the compiler to enforce type safety and as it is, this looks dangerous. https://codereview.chromium.org/1542743002/diff/200001/content/browser/web_co... File content/browser/web_contents/web_contents_impl.cc (right): https://codereview.chromium.org/1542743002/diff/200001/content/browser/web_co... content/browser/web_contents/web_contents_impl.cc:1822: GlobalFrameRoutingId(GetRenderViewHost()->GetProcess()->GetID(), Why are you getting the process id from the RenderViewHost? It is the RenderFrameHost one, right? https://codereview.chromium.org/1542743002/diff/200001/extensions/browser/app... File extensions/browser/app_window/app_window_contents.cc (right): https://codereview.chromium.org/1542743002/diff/200001/extensions/browser/app... extensions/browser/app_window/app_window_contents.cc:134: content::LoaderIOThreadNotifier::BlockRequestsForFrame(rfh); Can we stick those methods on an existing class that is a bit easier to understand? Looking from outside of content, I have very little idea what the loader notifier is and shouldn't really care much that there is IO thread involved in this. Leaving the method on RDH seems better to me or even putting it on RenderFrameHost itself.
Few more comments. https://codereview.chromium.org/1542743002/diff/200001/content/browser/browse... File content/browser/browser_plugin/browser_plugin_guest.cc (right): https://codereview.chromium.org/1542743002/diff/200001/content/browser/browse... content/browser/browser_plugin/browser_plugin_guest.cc:794: GetWebContents()->GetMainFrame()->Init(); Uh, this is unfortunate. Can we avoid calling this explicitly? https://codereview.chromium.org/1542743002/diff/200001/content/browser/loader... File content/browser/loader/loader_io_thread_notifier_impl.cc (right): https://codereview.chromium.org/1542743002/diff/200001/content/browser/loader... content/browser/loader/loader_io_thread_notifier_impl.cc:103: base::Bind(&ResourceDispatcherHostImpl::OnRenderFrameHostDeleted), This isn't quite correct. RenderFrame is the renderer side object and this notification tells you that this one was deleted. RenderFrameHost can persist around, so technically it isn't deleted. Let's try to be precise. https://codereview.chromium.org/1542743002/diff/200001/content/browser/loader... File content/browser/loader/resource_dispatcher_host_impl.cc (right): https://codereview.chromium.org/1542743002/diff/200001/content/browser/loader... content/browser/loader/resource_dispatcher_host_impl.cc:1861: CancelRequestsForFrame(GlobalFrameRoutingId(child_id, -1 /* cancel all */)); -1 is not a valid routing id. MSG_ROUTING_NONE? https://codereview.chromium.org/1542743002/diff/200001/content/browser/loader... File content/browser/loader/resource_request_info_impl.cc (right): https://codereview.chromium.org/1542743002/diff/200001/content/browser/loader... content/browser/loader/resource_request_info_impl.cc:340: render_frame_id_ = render_frame_id; It looks like the changes in this file can be split out in a separate, much simpler CL.
Thank you both for the reviews. I ended up putting the static methods in ResourceDispatcherHost/Impl, along with the LoaderIOThreadNotifier. I also reparented this CL on top of one that just updates ResourceRequestInfo::UpdateForTransfer. Randy: I don't think I want to write an IOWebContentsObserver. I don't think it's necessary. If the notifier class ends up needing more structure we can come back to this general idea. Nasko: Still trying to figure out a way to remove that added call to RenderFrameHost::Init(). https://codereview.chromium.org/1542743002/diff/200001/content/browser/browse... File content/browser/browser_plugin/browser_plugin_guest.cc (right): https://codereview.chromium.org/1542743002/diff/200001/content/browser/browse... content/browser/browser_plugin/browser_plugin_guest.cc:794: GetWebContents()->GetMainFrame()->Init(); On 2016/01/07 19:58:39, nasko wrote: > Uh, this is unfortunate. Can we avoid calling this explicitly? Yeah this is extremely ugly. All the original code has resuming done in the RenderWidgetHostImpl::Init() Having that method resume for the main frame seems ugly too, though. What do you thing the best approach is? https://codereview.chromium.org/1542743002/diff/200001/content/browser/frame_... File content/browser/frame_host/interstitial_page_impl.cc (right): https://codereview.chromium.org/1542743002/diff/200001/content/browser/frame_... content/browser/frame_host/interstitial_page_impl.cc:842: // LoaderIOThreadNotifier tests if there is a ResourceDispatcherHostImpl, as On 2016/01/06 at 21:56:29, Randy Smith - Not in Fridays wrote: > This comment seems wrong to me--LIOTN isn't testing and the test is being done here. Unupdated comment? This code tests that we have a rvh. The LIOTN tests for RDH. https://codereview.chromium.org/1542743002/diff/200001/content/browser/loader... File content/browser/loader/global_routing_id.h (right): https://codereview.chromium.org/1542743002/diff/200001/content/browser/loader... content/browser/loader/global_routing_id.h:43: struct GlobalFrameRoutingId : public GlobalRoutingID { On 2016/01/07 at 00:43:09, nasko wrote: > Is it possible to avoid the inheritance? It will allow us to use the compiler to enforce type safety and as it is, this looks dangerous. Yeah it's possible, we just need to copy the boilerplate. Done. https://codereview.chromium.org/1542743002/diff/200001/content/browser/loader... File content/browser/loader/loader_io_thread_notifier_impl.cc (right): https://codereview.chromium.org/1542743002/diff/200001/content/browser/loader... content/browser/loader/loader_io_thread_notifier_impl.cc:20: bool CollectRenderFrameRoutingIds(std::set<GlobalFrameRoutingId>* route_ids, On 2016/01/06 at 21:56:29, Randy Smith - Not in Fridays wrote: > I'd value a quick comment explaining the goal of this call. When I started reading it I assumed it was to collect all frame routing ids for an entire tree, but that doesn't look like it's goal based on the implementation. > > Putting it near the function that it's a helper for would also be useful. I don't think the style guide prohibits putting static functions anywhere in a file. That is the goal, we just don't want to miss any (including pending / speculative ones). Will comment this. https://codereview.chromium.org/1542743002/diff/200001/content/browser/loader... content/browser/loader/loader_io_thread_notifier_impl.cc:21: FrameTreeNode* tree_node) { On 2016/01/06 at 21:56:29, Randy Smith - Not in Fridays wrote: > Style guide says parameter order is inputs, then outputs: https://google.github.io/styleguide/cppguide.html#Function_Parameter_Ordering I'm not sure the best way to reconcile this. FrameTree:ForEach requires a Callback<bool(FrameTreeNode*)>. The currying rules wrt Bind require you to curry in one direction (i.e. I have to specify route_ids first cause that's the arg I'm currying away). LMK if you see a simple solution to this (ideally we'd use an inline lambda and close over route_ids but I don't think they play nice with Bind). https://codereview.chromium.org/1542743002/diff/200001/content/browser/loader... content/browser/loader/loader_io_thread_notifier_impl.cc:22: RenderFrameHostImpl* frame_host = tree_node->current_frame_host(); On 2016/01/06 at 21:56:30, Randy Smith - Not in Fridays wrote: > DCHECK for thread? I think it's useful being a-r about that in this file. Done. https://codereview.chromium.org/1542743002/diff/200001/content/browser/loader... content/browser/loader/loader_io_thread_notifier_impl.cc:39: ResourceDispatcherHostImpl* rdh = ResourceDispatcherHostImpl::Get(); On 2016/01/06 21:56:29, Randy Smith - Not in Fridays wrote: > What are the lifetime implications here? Are you sure that there's no way for > the RDHI to be torn down in a race with this message, and if so, why? (Probably > worthwhile documenting the rationale somewhere.) Well if RDHI is torn down then won't Get() return nullptr? In that case this function will be a no op. The other way some consumers did it was to call Get() before the hop, so use-after-frees were possible. https://codereview.chromium.org/1542743002/diff/200001/content/browser/loader... content/browser/loader/loader_io_thread_notifier_impl.cc:49: const GlobalFrameRoutingId& routing_id) { On 2016/01/06 at 21:56:29, Randy Smith - Not in Fridays wrote: > idea (up to you): I find myself wondering about whether implementing the above function in terms of this function might be reasonable for code re-use. It's right at the edge for me (which is why I'm not pushing it). Yeah sgtm. https://codereview.chromium.org/1542743002/diff/200001/content/browser/loader... content/browser/loader/loader_io_thread_notifier_impl.cc:103: base::Bind(&ResourceDispatcherHostImpl::OnRenderFrameHostDeleted), On 2016/01/07 19:58:39, nasko wrote: > This isn't quite correct. RenderFrame is the renderer side object and this > notification tells you that this one was deleted. RenderFrameHost can persist > around, so technically it isn't deleted. Let's try to be precise. Fixed the name to refer to the RenderFrame. https://codereview.chromium.org/1542743002/diff/200001/content/browser/loader... File content/browser/loader/loader_io_thread_notifier_impl.h (right): https://codereview.chromium.org/1542743002/diff/200001/content/browser/loader... content/browser/loader/loader_io_thread_notifier_impl.h:24: // thread. On 2016/01/06 at 21:56:30, Randy Smith - Not in Fridays wrote: > nit: Remove unneeded newline? Done. https://codereview.chromium.org/1542743002/diff/200001/content/browser/loader... content/browser/loader/loader_io_thread_notifier_impl.h:36: // explicitly take a RenderFrameHost*. On 2016/01/06 at 21:56:30, Randy Smith - Not in Fridays wrote: > Hmmm. I find this comment a little confusing. The only other method here that takes an RFH is RenderFrameDeleted. Are you saying "Create new methods that take a RFH in preference to using this if the RFH is available?" I was referring to the non-impl static methods. I'll fix this. https://codereview.chromium.org/1542743002/diff/200001/content/browser/loader... File content/browser/loader/resource_dispatcher_host_impl.cc (right): https://codereview.chromium.org/1542743002/diff/200001/content/browser/loader... content/browser/loader/resource_dispatcher_host_impl.cc:1861: CancelRequestsForFrame(GlobalFrameRoutingId(child_id, -1 /* cancel all */)); On 2016/01/07 19:58:39, nasko wrote: > -1 is not a valid routing id. MSG_ROUTING_NONE? Done. https://codereview.chromium.org/1542743002/diff/200001/content/browser/loader... File content/browser/loader/resource_dispatcher_host_impl.h (right): https://codereview.chromium.org/1542743002/diff/200001/content/browser/loader... content/browser/loader/resource_dispatcher_host_impl.h:216: // Causes all new requests for the route identified by |child_id| and On 2016/01/04 at 22:07:43, csharrison wrote: > Will fix this comment in next patch. Done. https://codereview.chromium.org/1542743002/diff/200001/content/browser/loader... content/browser/loader/resource_dispatcher_host_impl.h:391: // acts like CancelRequestsForProcess when route_id is -1. On 2016/01/04 at 22:07:43, csharrison wrote: > Will fix this comment in the next patch. Done. https://codereview.chromium.org/1542743002/diff/200001/content/browser/loader... File content/browser/loader/resource_request_info_impl.cc (right): https://codereview.chromium.org/1542743002/diff/200001/content/browser/loader... content/browser/loader/resource_request_info_impl.cc:340: render_frame_id_ = render_frame_id; On 2016/01/07 19:58:39, nasko wrote: > It looks like the changes in this file can be split out in a separate, much > simpler CL. Yep it can. I'll do that. https://codereview.chromium.org/1542743002/diff/200001/content/browser/render... File content/browser/renderer_host/render_widget_helper.cc (left): https://codereview.chromium.org/1542743002/diff/200001/content/browser/render... content/browser/renderer_host/render_widget_helper.cc:156: On 2016/01/06 21:56:30, Randy Smith - Not in Fridays wrote: > When are the requests blocked above resumed? Supplemented the comment above with this info. https://codereview.chromium.org/1542743002/diff/200001/content/browser/render... File content/browser/renderer_host/render_widget_helper.cc (right): https://codereview.chromium.org/1542743002/diff/200001/content/browser/render... content/browser/renderer_host/render_widget_helper.cc:117: GlobalFrameRoutingId(render_process_id_, *main_frame_route_id)); On 2016/01/06 21:56:30, Randy Smith - Not in Fridays wrote: > This is safe because at this point there will only be one frame in the window? > If so, maybe a comment to that effect? Done. https://codereview.chromium.org/1542743002/diff/200001/content/browser/web_co... File content/browser/web_contents/web_contents_impl.cc (right): https://codereview.chromium.org/1542743002/diff/200001/content/browser/web_co... content/browser/web_contents/web_contents_impl.cc:1821: LoaderIOThreadNotifierImpl::ResumeBlockedRequestsForFrameInternal( On 2016/01/06 21:56:30, Randy Smith - Not in Fridays wrote: > I presume that it's safe to just target the frame rather than the view here > because this view won't have had a chance to create more frames at this point in > the code? Worth documenting that if so. Done. https://codereview.chromium.org/1542743002/diff/200001/content/browser/web_co... content/browser/web_contents/web_contents_impl.cc:1821: LoaderIOThreadNotifierImpl::ResumeBlockedRequestsForFrameInternal( On 2016/01/06 at 21:56:30, Randy Smith - Not in Fridays wrote: > Help me understand the context in which this code path is taken? The existence of this interface is a wart (IMO) and I'd love to find some way around needing it. It's rather confusing :/ but I believe what is happening is that we need to block requests that'll end up in new windows until the frame is ready and initialized. This bit of code gets run when the WebContents decides it doesn't want to be responsible for the new window (and creating a new WebContents). Thus, it resumes requests and lets its delegate decide what to do (this happens in ShouldCreateWebContents). This is my thinking of what can happen: 1. The delegate will create one with the given IDs. This should go through a similar path wrt creating a new WebContents (same process / route). 2. The delegate will do some other logic (like nothing, or open a new tab, etc.). In these cases, it seems like the requests should not be blocked, but cancelled. Because the view is never created, my thinking is that these requests just sit in the RDHI blocked_loaders_map_. This is arguably better than servicing the requests, but still seems wrong. Some preliminary investigation for whether we can remove this now that NPAPI is gone started out promising, but I tested a CL that does it here: https://codereview.chromium.org/1567903002 and it looks like WebView depends on it. I'm going to keep it in the meantime until that gets sorted out. https://codereview.chromium.org/1542743002/diff/200001/content/browser/web_co... content/browser/web_contents/web_contents_impl.cc:1822: GlobalFrameRoutingId(GetRenderViewHost()->GetProcess()->GetID(), On 2016/01/07 at 00:43:09, nasko wrote: > Why are you getting the process id from the RenderViewHost? It is the RenderFrameHost one, right? Good catch. Actually, I think we should be grabbing the process from source_site_instance (if we're opening in same process). So to fix these problems, I think the new code should be if (site_instance == source_site_instance) { ResumeBlockedRequestsForFrameInternal(GlobalFrameRoutingId(render_process_id, main_frame_id)); } https://codereview.chromium.org/1542743002/diff/200001/extensions/browser/app... File extensions/browser/app_window/app_window_contents.cc (right): https://codereview.chromium.org/1542743002/diff/200001/extensions/browser/app... extensions/browser/app_window/app_window_contents.cc:134: content::LoaderIOThreadNotifier::BlockRequestsForFrame(rfh); On 2016/01/07 00:43:09, nasko wrote: > Can we stick those methods on an existing class that is a bit easier to > understand? Looking from outside of content, I have very little idea what the > loader notifier is and shouldn't really care much that there is IO thread > involved in this. > > Leaving the method on RDH seems better to me or even putting it on > RenderFrameHost itself. Yeah, I think I'll merge the LoaderIOThreadNotifier into RDHI.
Sending the comments I have since I looked at patch set 14 earlier this week. I will continue on PS15, so that will be a separate set of comments. https://codereview.chromium.org/1542743002/diff/260001/content/browser/loader... File content/browser/loader/global_routing_id.h (right): https://codereview.chromium.org/1542743002/diff/260001/content/browser/loader... content/browser/loader/global_routing_id.h:44: GlobalFrameRoutingId() : child_id(-1), route_id(-1) { route_id should be MSG_ROUTING_NONE https://codereview.chromium.org/1542743002/diff/260001/content/browser/loader... content/browser/loader/global_routing_id.h:56: int route_id; Let's be consistent since this is new code and call it "frame_routing_id", so it is clear that it is the RenderFrameHost one. https://codereview.chromium.org/1542743002/diff/260001/content/browser/loader... File content/browser/loader/resource_dispatcher_host_impl.h (right): https://codereview.chromium.org/1542743002/diff/260001/content/browser/loader... content/browser/loader/resource_dispatcher_host_impl.h:88: // thread. This can fit with the previous line :). https://codereview.chromium.org/1542743002/diff/260001/content/browser/loader... content/browser/loader/resource_dispatcher_host_impl.h:424: // |routing_id| is -1. MSG_ROUTING_NONE https://codereview.chromium.org/1542743002/diff/260001/content/public/browser... File content/public/browser/resource_dispatcher_host.h (right): https://codereview.chromium.org/1542743002/diff/260001/content/public/browser... content/public/browser/resource_dispatcher_host.h:35: // Causes all new requests for the route identified by the RenderFrameHost to Does the "for the route identified by" bring any new meaning to this comment? Callers care that the RFH is blocked from making requests and they are resumed later.
Yay, done reviewing this one! https://codereview.chromium.org/1542743002/diff/320001/content/browser/loader... File content/browser/loader/global_routing_id.h (right): https://codereview.chromium.org/1542743002/diff/320001/content/browser/loader... content/browser/loader/global_routing_id.h:41: // Same as GlobalRoutingID except the route_id must be a render frame routing s/render frame/RenderFrameHost/ https://codereview.chromium.org/1542743002/diff/320001/content/browser/loader... content/browser/loader/global_routing_id.h:44: GlobalFrameRoutingId() : child_id(-1), route_id(-1) { s/-1/0/ for child_id. s/-1/MSG_ROUTING_NONE/ for route_id. https://codereview.chromium.org/1542743002/diff/320001/content/browser/loader... File content/browser/loader/resource_dispatcher_host_impl.cc (right): https://codereview.chromium.org/1542743002/diff/320001/content/browser/loader... content/browser/loader/resource_dispatcher_host_impl.cc:475: DCHECK_CURRENTLY_ON(BrowserThread::IO); You can't walk the frame tree on the IO thread. It is UI thread only class. The comment above seems wrong? https://codereview.chromium.org/1542743002/diff/320001/content/browser/loader... content/browser/loader/resource_dispatcher_host_impl.cc:1854: void ResourceDispatcherHostImpl::OnRenderViewHostDeleted(int child_id, Hmm, this doesn't seem style guide compatible. Did "git cl format" produce this? https://codereview.chromium.org/1542743002/diff/320001/content/browser/loader... content/browser/loader/resource_dispatcher_host_impl.cc:1980: bool cancel_all_routes = route_id == MSG_ROUTING_NONE; (route_id == MSG_ROUTING_NONE) < a bit more readable. https://codereview.chromium.org/1542743002/diff/320001/content/browser/loader... File content/browser/loader/resource_dispatcher_host_impl.h (right): https://codereview.chromium.org/1542743002/diff/320001/content/browser/loader... content/browser/loader/resource_dispatcher_host_impl.h:119: // should use the public ResourceDispatcherHost static methods if the nit: Well, this *is* a public static method : ). Let's say "content/public" or something else to emphasize that it is the content/ public interface methods. https://codereview.chromium.org/1542743002/diff/320001/content/browser/loader... content/browser/loader/resource_dispatcher_host_impl.h:425: void CancelRequestsForRoute(const GlobalFrameRoutingId& routing_id); nit: global_routing_id? Otherwise it reads as any other routing id of RFH or RVH. https://codereview.chromium.org/1542743002/diff/320001/content/browser/web_co... File content/browser/web_contents/web_contents_impl.cc (right): https://codereview.chromium.org/1542743002/diff/320001/content/browser/web_co... content/browser/web_contents/web_contents_impl.cc:1831: // It's safe to only target the frame because the view will not have a nit: Let's strive to avoid using "view", as the "view" as an object will disappear soon. Having to hunt for stale comments with such a generic word is going to be painful. https://codereview.chromium.org/1542743002/diff/320001/content/public/browser... File content/public/browser/resource_dispatcher_host.h (right): https://codereview.chromium.org/1542743002/diff/320001/content/public/browser... content/public/browser/resource_dispatcher_host.h:35: // Causes all new requests for the route identified by the RenderFrameHost to s/for the route identified by the RenderFrameHost/for the RenderFrameHost/.
I'm still chewing on the architecture of RDH/LIOTN. On the bright side, once we nail that down, I doubt I'll have much more to say on this CL :-}. Preface for context: I have the sense that you're making the choice to have all the UI thread interfaces be static and all of the non-UI thread interfaces be regular methods. In the abstract I think that's a good choice--it makes it very clear what thread the data members live on, while keeping related functionality together on the class. But it has some implications that I've poked at in the following. * Given the static<->UI thread choice, I think that the NotifyFor* interfaces are a bit of a cheat, since they actually target/require knowledge of IO thread interfaces on the UI thread, even though those interfaces aren't actually called on the UI thread. I'm of the opinion that the overall interface would be cleaner if we instead had UI thread interfaces {Block, {Resume,Cancel}Blocked}RequestsForFrameTree. I think the set of interfaces that would result in having on RDHI would be more coherent and easier for new users of the class to grok; the Notify* interfaces force people into using function pointers (and class method function pointers, which are even a bit more confusing), but don't really provide a lot of extra power for that--there are only a couple of options. Let's just give the consumer those options. As an API simplification (up to you), I could imagine those interfaces being "ForFrame" with a boolean indicating whether recursion from that frame was desired, or we could simply make them always recurse (presuming you can get the descendants of a frame from a frame, and presuming that the times when we're targeting a single frame that frame is known to have no children) so that we don't need separate interfaces/boolean argument to distinguish ForFrame and ForFrameTree. * I'd suggest that if we're going to make the UI/IO "appropriate API" division, we restrict ourselves to using UI objects on the UI thread and routes on the IO thread just for simplification of the API. So this would mean that WebContentsImpl::CreateNewWindow would call ResumeBlockedRequestsForFrame (not *Route). LoaderIOThreadNotifer doesn't count; it's effectively an appendage class of ResourceDispatcherHostImpl. * (Suggestion) At this point, LoaderIOThreadNotifier isn't really doing much--it's just forwarding UI thread notifications to UI thread interfaces on the RDHI. I think I'd find the overall interface cleaner if that class was a private class for RDHI (declared and defined in the .cc file) and there was a (static) method on RDHI that was called when a WebContents was created that attached a class instance to the contents. That keeps the new header declarations visible to a minimum. (I wanted to find a way to make RDHI a WCO, but it's gotta observer a *lot* of WCOs, and the WCO interface isn't built for that. Which I think is a flaw in the interface, but hey, what so I know :-}, and I'm certainly not going to ask you to fix it.) * The UI Thread->static choice also results in the pattern of declaring static methods on the RDH abstract base class that are functionally equivalent to how interfaces on abstract base classes are used (to delegate to the derived class). In other words, it's *almost* something that people are very familiar with and used to, but not *quite*. And the implementation only works because of the use of the global accessor (RDHI::Get()). I dislike RDHI::Get(), but it's used all over the place, and it'd be real mission creep for this CL to push you to fix it, so I won't :-}. Having said that, I don't like perpetuating it, and writing an interface that requires it feels like a perpetuation to me. The combination of those two discomforts makes me want to push you to make these non-static pure virtual methods that are implemented in RDHI. But that violates the architectural invariant I think you're trying to setup, so I'm torn--I see why you're doing what you're doing, but every time I look at that pattern I wince. We may want to talk about this in person. (As an alternative path, if Matt is neutral to positive about your pattern, I would yield to his arch sense.) https://codereview.chromium.org/1542743002/diff/260001/content/browser/frame_... File content/browser/frame_host/interstitial_page_impl.cc (right): https://codereview.chromium.org/1542743002/diff/260001/content/browser/frame_... content/browser/frame_host/interstitial_page_impl.cc:821: // have one. I think this comment isn't needed anymore. https://codereview.chromium.org/1542743002/diff/260001/content/browser/frame_... content/browser/frame_host/interstitial_page_impl.cc:840: rvh->GetDelegate()->GetFrameTree(), frame_callback); Suggestion: IMO, this code would be simpler and more understandable if it just called NotifyForEachFrame with the constructed callback from each branch of the switch statement. https://codereview.chromium.org/1542743002/diff/260001/content/browser/loader... File content/browser/loader/resource_dispatcher_host_impl.cc (left): https://codereview.chromium.org/1542743002/diff/260001/content/browser/loader... content/browser/loader/resource_dispatcher_host_impl.cc:1744: scheduler_->OnClientDeleted(child_id, route_id); I thought this was going to be removed; planning to yank it in a different CL? https://codereview.chromium.org/1542743002/diff/260001/content/browser/loader... File content/browser/loader/resource_dispatcher_host_impl.cc (right): https://codereview.chromium.org/1542743002/diff/260001/content/browser/loader... content/browser/loader/resource_dispatcher_host_impl.cc:461: FrameTreeNode* tree_node) { It looks to me like tree_node is purely an input argument, so it could be const (even a const&), and I think by the style guide it should go before the output arguments. https://codereview.chromium.org/1542743002/diff/260001/content/browser/loader... File content/browser/loader/resource_dispatcher_host_impl.h (right): https://codereview.chromium.org/1542743002/diff/260001/content/browser/loader... content/browser/loader/resource_dispatcher_host_impl.h:41: #include "content/public/browser/render_view_host.h" Why? https://codereview.chromium.org/1542743002/diff/260001/content/browser/web_co... File content/browser/web_contents/web_contents_impl.cc (right): https://codereview.chromium.org/1542743002/diff/260001/content/browser/web_co... content/browser/web_contents/web_contents_impl.cc:1842: // source. The second sentence "feels" to me as if it's an implementation dependency of an implementation well removed from this code. Am I intuiting correctly? If so, I think it's an unwise thing to rely on (and hence shouldn't be in the comment).
On 2016/01/20 23:23:19, Randy Smith - Not in Fridays wrote: > I'm still chewing on the architecture of RDH/LIOTN. On the bright side, once we > nail that down, I doubt I'll have much more to say on this CL :-}. > > Preface for context: I have the sense that you're making the choice to have all > the UI thread interfaces be static and all of the non-UI thread interfaces be > regular methods. In the abstract I think that's a good choice--it makes it very > clear what thread the data members live on, while keeping related functionality > together on the class. But it has some implications that I've poked at in the > following. > > * Given the static<->UI thread choice, I think that the NotifyFor* interfaces > are a bit of a cheat, since they actually target/require knowledge of IO thread > interfaces on the UI thread, even though those interfaces aren't actually called > on the UI thread. I'm of the opinion that the overall interface would be > cleaner if we instead had UI thread interfaces {Block, > {Resume,Cancel}Blocked}RequestsForFrameTree. I think the set of interfaces that > would result in having on RDHI would be more coherent and easier for new users > of the class to grok; the Notify* interfaces force people into using function > pointers (and class method function pointers, which are even a bit more > confusing), but don't really provide a lot of extra power for that--there are > only a couple of options. Let's just give the consumer those options. > > As an API simplification (up to you), I could imagine those interfaces being > "ForFrame" with a boolean indicating whether recursion from that frame was > desired, or we could simply make them always recurse (presuming you can get the > descendants of a frame from a frame, and presuming that the times when we're > targeting a single frame that frame is known to have no children) so that we > don't need separate interfaces/boolean argument to distinguish ForFrame and > ForFrameTree. > > * I'd suggest that if we're going to make the UI/IO "appropriate API" division, > we restrict ourselves to using UI objects on the UI thread and routes on the IO > thread just for simplification of the API. So this would mean that > WebContentsImpl::CreateNewWindow would call ResumeBlockedRequestsForFrame (not > *Route). LoaderIOThreadNotifer doesn't count; it's effectively an appendage > class of ResourceDispatcherHostImpl. > > * (Suggestion) At this point, LoaderIOThreadNotifier isn't really doing > much--it's just forwarding UI thread notifications to UI thread interfaces on > the RDHI. I think I'd find the overall interface cleaner if that class was a > private class for RDHI (declared and defined in the .cc file) and there was a > (static) method on RDHI that was called when a WebContents was created that > attached a class instance to the contents. That keeps the new header > declarations visible to a minimum. > > (I wanted to find a way to make RDHI a WCO, but it's gotta observer a *lot* of > WCOs, and the WCO interface isn't built for that. Which I think is a flaw in > the interface, but hey, what so I know :-}, and I'm certainly not going to ask > you to fix it.) > > * The UI Thread->static choice also results in the pattern of declaring static > methods on the RDH abstract base class that are functionally equivalent to how > interfaces on abstract base classes are used (to delegate to the derived class). > In other words, it's *almost* something that people are very familiar with and > used to, but not *quite*. And the implementation only works because of the use > of the global accessor (RDHI::Get()). I dislike RDHI::Get(), but it's used all > over the place, and it'd be real mission creep for this CL to push you to fix > it, so I won't :-}. Having said that, I don't like perpetuating it, and writing > an interface that requires it feels like a perpetuation to me. The combination > of those two discomforts makes me want to push you to make these non-static pure > virtual methods that are implemented in RDHI. But that violates the > architectural invariant I think you're trying to setup, so I'm torn--I see why > you're doing what you're doing, but every time I look at that pattern I wince. > We may want to talk about this in person. (As an alternative path, if Matt is > neutral to positive about your pattern, I would yield to his arch sense.) > > https://codereview.chromium.org/1542743002/diff/260001/content/browser/frame_... > File content/browser/frame_host/interstitial_page_impl.cc (right): > > https://codereview.chromium.org/1542743002/diff/260001/content/browser/frame_... > content/browser/frame_host/interstitial_page_impl.cc:821: // have one. > I think this comment isn't needed anymore. > > https://codereview.chromium.org/1542743002/diff/260001/content/browser/frame_... > content/browser/frame_host/interstitial_page_impl.cc:840: > rvh->GetDelegate()->GetFrameTree(), frame_callback); > Suggestion: IMO, this code would be simpler and more understandable if it just > called NotifyForEachFrame with the constructed callback from each branch of the > switch statement. > > https://codereview.chromium.org/1542743002/diff/260001/content/browser/loader... > File content/browser/loader/resource_dispatcher_host_impl.cc (left): > > https://codereview.chromium.org/1542743002/diff/260001/content/browser/loader... > content/browser/loader/resource_dispatcher_host_impl.cc:1744: > scheduler_->OnClientDeleted(child_id, route_id); > I thought this was going to be removed; planning to yank it in a different CL? > > https://codereview.chromium.org/1542743002/diff/260001/content/browser/loader... > File content/browser/loader/resource_dispatcher_host_impl.cc (right): > > https://codereview.chromium.org/1542743002/diff/260001/content/browser/loader... > content/browser/loader/resource_dispatcher_host_impl.cc:461: FrameTreeNode* > tree_node) { > It looks to me like tree_node is purely an input argument, so it could be const > (even a const&), and I think by the style guide it should go before the output > arguments. > > https://codereview.chromium.org/1542743002/diff/260001/content/browser/loader... > File content/browser/loader/resource_dispatcher_host_impl.h (right): > > https://codereview.chromium.org/1542743002/diff/260001/content/browser/loader... > content/browser/loader/resource_dispatcher_host_impl.h:41: #include > "content/public/browser/render_view_host.h" > Why? > > https://codereview.chromium.org/1542743002/diff/260001/content/browser/web_co... > File content/browser/web_contents/web_contents_impl.cc (right): > > https://codereview.chromium.org/1542743002/diff/260001/content/browser/web_co... > content/browser/web_contents/web_contents_impl.cc:1842: // source. > The second sentence "feels" to me as if it's an implementation dependency of an > implementation well removed from this code. Am I intuiting correctly? If so, I > think it's an unwise thing to rely on (and hence shouldn't be in the comment). Thank you both for the reviews! Randy, let's meet tomorrow to flesh this out in a final pass. One thing: I would really like to iron out the API so that UI methods take UI objects, not routes. This is stymied by WebContentsImpl::CreateNewWindow, which doesn't have access to the frame at that point, the creation of the WebContents has been taken by the delegate. I need to investigate whether we can tell the delegate to do this, or how to extract the frame from the delegate. This is further complicated by the fact that often the delegate won't create a new WebContents.
On 2016/01/21 00:56:06, csharrison wrote: > On 2016/01/20 23:23:19, Randy Smith - Not in Fridays wrote: > > I'm still chewing on the architecture of RDH/LIOTN. On the bright side, once > we > > nail that down, I doubt I'll have much more to say on this CL :-}. > > > > Preface for context: I have the sense that you're making the choice to have > all > > the UI thread interfaces be static and all of the non-UI thread interfaces be > > regular methods. In the abstract I think that's a good choice--it makes it > very > > clear what thread the data members live on, while keeping related > functionality > > together on the class. But it has some implications that I've poked at in the > > following. > > > > * Given the static<->UI thread choice, I think that the NotifyFor* interfaces > > are a bit of a cheat, since they actually target/require knowledge of IO > thread > > interfaces on the UI thread, even though those interfaces aren't actually > called > > on the UI thread. I'm of the opinion that the overall interface would be > > cleaner if we instead had UI thread interfaces {Block, > > {Resume,Cancel}Blocked}RequestsForFrameTree. I think the set of interfaces > that > > would result in having on RDHI would be more coherent and easier for new users > > of the class to grok; the Notify* interfaces force people into using function > > pointers (and class method function pointers, which are even a bit more > > confusing), but don't really provide a lot of extra power for that--there are > > only a couple of options. Let's just give the consumer those options. > > > > As an API simplification (up to you), I could imagine those interfaces being > > "ForFrame" with a boolean indicating whether recursion from that frame was > > desired, or we could simply make them always recurse (presuming you can get > the > > descendants of a frame from a frame, and presuming that the times when we're > > targeting a single frame that frame is known to have no children) so that we > > don't need separate interfaces/boolean argument to distinguish ForFrame and > > ForFrameTree. > > > > * I'd suggest that if we're going to make the UI/IO "appropriate API" > division, > > we restrict ourselves to using UI objects on the UI thread and routes on the > IO > > thread just for simplification of the API. So this would mean that > > WebContentsImpl::CreateNewWindow would call ResumeBlockedRequestsForFrame (not > > *Route). LoaderIOThreadNotifer doesn't count; it's effectively an appendage > > class of ResourceDispatcherHostImpl. > > > > * (Suggestion) At this point, LoaderIOThreadNotifier isn't really doing > > much--it's just forwarding UI thread notifications to UI thread interfaces on > > the RDHI. I think I'd find the overall interface cleaner if that class was a > > private class for RDHI (declared and defined in the .cc file) and there was a > > (static) method on RDHI that was called when a WebContents was created that > > attached a class instance to the contents. That keeps the new header > > declarations visible to a minimum. > > > > (I wanted to find a way to make RDHI a WCO, but it's gotta observer a *lot* of > > WCOs, and the WCO interface isn't built for that. Which I think is a flaw in > > the interface, but hey, what so I know :-}, and I'm certainly not going to ask > > you to fix it.) > > > > * The UI Thread->static choice also results in the pattern of declaring static > > methods on the RDH abstract base class that are functionally equivalent to how > > interfaces on abstract base classes are used (to delegate to the derived > class). > > In other words, it's *almost* something that people are very familiar with > and > > used to, but not *quite*. And the implementation only works because of the > use > > of the global accessor (RDHI::Get()). I dislike RDHI::Get(), but it's used > all > > over the place, and it'd be real mission creep for this CL to push you to fix > > it, so I won't :-}. Having said that, I don't like perpetuating it, and > writing > > an interface that requires it feels like a perpetuation to me. The > combination > > of those two discomforts makes me want to push you to make these non-static > pure > > virtual methods that are implemented in RDHI. But that violates the > > architectural invariant I think you're trying to setup, so I'm torn--I see why > > you're doing what you're doing, but every time I look at that pattern I wince. > > > We may want to talk about this in person. (As an alternative path, if Matt is > > neutral to positive about your pattern, I would yield to his arch sense.) > > > > > https://codereview.chromium.org/1542743002/diff/260001/content/browser/frame_... > > File content/browser/frame_host/interstitial_page_impl.cc (right): > > > > > https://codereview.chromium.org/1542743002/diff/260001/content/browser/frame_... > > content/browser/frame_host/interstitial_page_impl.cc:821: // have one. > > I think this comment isn't needed anymore. > > > > > https://codereview.chromium.org/1542743002/diff/260001/content/browser/frame_... > > content/browser/frame_host/interstitial_page_impl.cc:840: > > rvh->GetDelegate()->GetFrameTree(), frame_callback); > > Suggestion: IMO, this code would be simpler and more understandable if it just > > called NotifyForEachFrame with the constructed callback from each branch of > the > > switch statement. > > > > > https://codereview.chromium.org/1542743002/diff/260001/content/browser/loader... > > File content/browser/loader/resource_dispatcher_host_impl.cc (left): > > > > > https://codereview.chromium.org/1542743002/diff/260001/content/browser/loader... > > content/browser/loader/resource_dispatcher_host_impl.cc:1744: > > scheduler_->OnClientDeleted(child_id, route_id); > > I thought this was going to be removed; planning to yank it in a different CL? > > > > > https://codereview.chromium.org/1542743002/diff/260001/content/browser/loader... > > File content/browser/loader/resource_dispatcher_host_impl.cc (right): > > > > > https://codereview.chromium.org/1542743002/diff/260001/content/browser/loader... > > content/browser/loader/resource_dispatcher_host_impl.cc:461: FrameTreeNode* > > tree_node) { > > It looks to me like tree_node is purely an input argument, so it could be > const > > (even a const&), and I think by the style guide it should go before the output > > arguments. > > > > > https://codereview.chromium.org/1542743002/diff/260001/content/browser/loader... > > File content/browser/loader/resource_dispatcher_host_impl.h (right): > > > > > https://codereview.chromium.org/1542743002/diff/260001/content/browser/loader... > > content/browser/loader/resource_dispatcher_host_impl.h:41: #include > > "content/public/browser/render_view_host.h" > > Why? > > > > > https://codereview.chromium.org/1542743002/diff/260001/content/browser/web_co... > > File content/browser/web_contents/web_contents_impl.cc (right): > > > > > https://codereview.chromium.org/1542743002/diff/260001/content/browser/web_co... > > content/browser/web_contents/web_contents_impl.cc:1842: // source. > > The second sentence "feels" to me as if it's an implementation dependency of > an > > implementation well removed from this code. Am I intuiting correctly? If so, > I > > think it's an unwise thing to rely on (and hence shouldn't be in the comment). > > Thank you both for the reviews! Randy, let's meet tomorrow to flesh this out in > a final pass. > > One thing: I would really like to iron out the API so that UI methods take UI > objects, not routes. This is stymied by WebContentsImpl::CreateNewWindow, which > doesn't have access to the frame at that point, the creation of the WebContents > has been taken by the delegate. > > I need to investigate whether we can tell the delegate to do this, or how to > extract the frame from the delegate. This is further complicated by the fact > that often the delegate won't create a new WebContents. After thinking about it a little more, the code snippet in WebContentsImpl can't use a frame, because a common use case is 1. Block requests for route id (on io thread) 2. Delegate decides to block the new window (not create a WebContents) 3. We never have a frame host in the browser process (similar to the snippet above it that fails to find a RenderViewHost) For this reason, I think the better API isn't feasible. I'm still open to class methods over static methods though to avoid a public RDH impl, I just want to be sure we aren't being racy,
Responded to comments without making architectural changes. Hopefully will decide w/ Randy tomorrow how to structure this and shoot up another CL by the weekend. We'll see. https://codereview.chromium.org/1542743002/diff/260001/content/browser/frame_... File content/browser/frame_host/interstitial_page_impl.cc (right): https://codereview.chromium.org/1542743002/diff/260001/content/browser/frame_... content/browser/frame_host/interstitial_page_impl.cc:821: // have one. On 2016/01/20 23:23:19, Randy Smith - Not in Fridays wrote: > I think this comment isn't needed anymore. Done. https://codereview.chromium.org/1542743002/diff/260001/content/browser/frame_... content/browser/frame_host/interstitial_page_impl.cc:840: rvh->GetDelegate()->GetFrameTree(), frame_callback); On 2016/01/20 23:23:19, Randy Smith - Not in Fridays wrote: > Suggestion: IMO, this code would be simpler and more understandable if it just > called NotifyForEachFrame with the constructed callback from each branch of the > switch statement. Done. https://codereview.chromium.org/1542743002/diff/260001/content/browser/loader... File content/browser/loader/global_routing_id.h (right): https://codereview.chromium.org/1542743002/diff/260001/content/browser/loader... content/browser/loader/global_routing_id.h:44: GlobalFrameRoutingId() : child_id(-1), route_id(-1) { On 2016/01/16 00:15:58, nasko wrote: > route_id should be MSG_ROUTING_NONE Done. https://codereview.chromium.org/1542743002/diff/260001/content/browser/loader... content/browser/loader/global_routing_id.h:56: int route_id; On 2016/01/16 00:15:58, nasko wrote: > Let's be consistent since this is new code and call it "frame_routing_id", so it > is clear that it is the RenderFrameHost one. Done. https://codereview.chromium.org/1542743002/diff/260001/content/browser/loader... File content/browser/loader/resource_dispatcher_host_impl.cc (left): https://codereview.chromium.org/1542743002/diff/260001/content/browser/loader... content/browser/loader/resource_dispatcher_host_impl.cc:1744: scheduler_->OnClientDeleted(child_id, route_id); On 2016/01/20 23:23:19, Randy Smith - Not in Fridays wrote: > I thought this was going to be removed; planning to yank it in a different CL? Yeah this CL doesn't affect ResourceScheduler at all. If it did, this would be a much bigger CL. https://codereview.chromium.org/1542743002/diff/260001/content/browser/loader... File content/browser/loader/resource_dispatcher_host_impl.cc (right): https://codereview.chromium.org/1542743002/diff/260001/content/browser/loader... content/browser/loader/resource_dispatcher_host_impl.cc:461: FrameTreeNode* tree_node) { On 2016/01/20 23:23:19, Randy Smith - Not in Fridays wrote: > It looks to me like tree_node is purely an input argument, so it could be const > (even a const&), and I think by the style guide it should go before the output > arguments. This'll be obsolete once range-for loops for FrameTrees exist. As is now, I responded to your similar complaint in a previous review. The inputs have to be ordered this way do to currying rules. Not touching this for now cause it will FrameTree::ForEach is going away. https://codereview.chromium.org/1542743002/diff/260001/content/browser/loader... File content/browser/loader/resource_dispatcher_host_impl.h (right): https://codereview.chromium.org/1542743002/diff/260001/content/browser/loader... content/browser/loader/resource_dispatcher_host_impl.h:41: #include "content/public/browser/render_view_host.h" On 2016/01/20 23:23:19, Randy Smith - Not in Fridays wrote: > Why? Removed. https://codereview.chromium.org/1542743002/diff/260001/content/browser/loader... content/browser/loader/resource_dispatcher_host_impl.h:88: // thread. On 2016/01/16 00:15:58, nasko wrote: > This can fit with the previous line :). Done. Oops :) https://codereview.chromium.org/1542743002/diff/260001/content/browser/loader... content/browser/loader/resource_dispatcher_host_impl.h:424: // |routing_id| is -1. On 2016/01/16 00:15:58, nasko wrote: > MSG_ROUTING_NONE Done. https://codereview.chromium.org/1542743002/diff/260001/content/browser/web_co... File content/browser/web_contents/web_contents_impl.cc (right): https://codereview.chromium.org/1542743002/diff/260001/content/browser/web_co... content/browser/web_contents/web_contents_impl.cc:1842: // source. On 2016/01/20 23:23:19, Randy Smith - Not in Fridays wrote: > The second sentence "feels" to me as if it's an implementation dependency of an > implementation well removed from this code. Am I intuiting correctly? If so, I > think it's an unwise thing to rely on (and hence shouldn't be in the comment). Yeah, it's not strictly necessary so I removed it. https://codereview.chromium.org/1542743002/diff/260001/content/public/browser... File content/public/browser/resource_dispatcher_host.h (right): https://codereview.chromium.org/1542743002/diff/260001/content/public/browser... content/public/browser/resource_dispatcher_host.h:35: // Causes all new requests for the route identified by the RenderFrameHost to On 2016/01/16 00:15:58, nasko wrote: > Does the "for the route identified by" bring any new meaning to this comment? > Callers care that the RFH is blocked from making requests and they are resumed > later. Simplified the comment. https://codereview.chromium.org/1542743002/diff/320001/content/browser/loader... File content/browser/loader/global_routing_id.h (right): https://codereview.chromium.org/1542743002/diff/320001/content/browser/loader... content/browser/loader/global_routing_id.h:41: // Same as GlobalRoutingID except the route_id must be a render frame routing On 2016/01/20 22:22:09, nasko wrote: > s/render frame/RenderFrameHost/ Done. https://codereview.chromium.org/1542743002/diff/320001/content/browser/loader... content/browser/loader/global_routing_id.h:44: GlobalFrameRoutingId() : child_id(-1), route_id(-1) { On 2016/01/20 22:22:09, nasko wrote: > s/-1/0/ for child_id. > s/-1/MSG_ROUTING_NONE/ for route_id. Done. https://codereview.chromium.org/1542743002/diff/320001/content/browser/loader... File content/browser/loader/resource_dispatcher_host_impl.cc (right): https://codereview.chromium.org/1542743002/diff/320001/content/browser/loader... content/browser/loader/resource_dispatcher_host_impl.cc:475: DCHECK_CURRENTLY_ON(BrowserThread::IO); On 2016/01/20 22:22:09, nasko wrote: > You can't walk the frame tree on the IO thread. It is UI thread only class. The > comment above seems wrong? Ah yes, this is a dead comment. Removing. https://codereview.chromium.org/1542743002/diff/320001/content/browser/loader... content/browser/loader/resource_dispatcher_host_impl.cc:475: DCHECK_CURRENTLY_ON(BrowserThread::IO); On 2016/01/20 22:22:09, nasko wrote: > You can't walk the frame tree on the IO thread. It is UI thread only class. The > comment above seems wrong? You're right, the comment is obsolete. Sorry about that. https://codereview.chromium.org/1542743002/diff/320001/content/browser/loader... content/browser/loader/resource_dispatcher_host_impl.cc:1854: void ResourceDispatcherHostImpl::OnRenderViewHostDeleted(int child_id, On 2016/01/20 22:22:09, nasko wrote: > Hmm, this doesn't seem style guide compatible. Did "git cl format" produce this? Yeah it did (or at least, it didn't change this). https://codereview.chromium.org/1542743002/diff/320001/content/browser/loader... content/browser/loader/resource_dispatcher_host_impl.cc:1980: bool cancel_all_routes = route_id == MSG_ROUTING_NONE; On 2016/01/20 22:22:09, nasko wrote: > (route_id == MSG_ROUTING_NONE) < a bit more readable. Done. https://codereview.chromium.org/1542743002/diff/320001/content/browser/loader... content/browser/loader/resource_dispatcher_host_impl.cc:1980: bool cancel_all_routes = route_id == MSG_ROUTING_NONE; On 2016/01/20 22:22:09, nasko wrote: > (route_id == MSG_ROUTING_NONE) < a bit more readable. Done. https://codereview.chromium.org/1542743002/diff/320001/content/browser/loader... File content/browser/loader/resource_dispatcher_host_impl.h (right): https://codereview.chromium.org/1542743002/diff/320001/content/browser/loader... content/browser/loader/resource_dispatcher_host_impl.h:119: // should use the public ResourceDispatcherHost static methods if the On 2016/01/20 22:22:09, nasko wrote: > nit: Well, this *is* a public static method : ). Let's say "content/public" or > something else to emphasize that it is the content/ public interface methods. Done. https://codereview.chromium.org/1542743002/diff/320001/content/browser/loader... content/browser/loader/resource_dispatcher_host_impl.h:425: void CancelRequestsForRoute(const GlobalFrameRoutingId& routing_id); On 2016/01/20 22:22:09, nasko wrote: > nit: global_routing_id? Otherwise it reads as any other routing id of RFH or > RVH. Valid point. For consistency, I'll have to change it everywhere in the file (I use routing_id to name GlobalFrameRoutingIds). I'll address this in a later patch (pending architectural changes). https://codereview.chromium.org/1542743002/diff/320001/content/browser/web_co... File content/browser/web_contents/web_contents_impl.cc (right): https://codereview.chromium.org/1542743002/diff/320001/content/browser/web_co... content/browser/web_contents/web_contents_impl.cc:1831: // It's safe to only target the frame because the view will not have a On 2016/01/20 22:22:09, nasko wrote: > nit: Let's strive to avoid using "view", as the "view" as an object will > disappear soon. Having to hunt for stale comments with such a generic word is > going to be painful. Done. https://codereview.chromium.org/1542743002/diff/320001/content/public/browser... File content/public/browser/resource_dispatcher_host.h (right): https://codereview.chromium.org/1542743002/diff/320001/content/public/browser... content/public/browser/resource_dispatcher_host.h:35: // Causes all new requests for the route identified by the RenderFrameHost to On 2016/01/20 22:22:09, nasko wrote: > s/for the route identified by the RenderFrameHost/for the RenderFrameHost/. Done.
On 2016/01/21 18:52:56, csharrison wrote: > Responded to comments without making architectural changes. Hopefully will > decide w/ Randy tomorrow how to structure this and shoot up another CL by the > weekend. We'll see. Just to make sure we're on the same page based on our conversation offline; I'm withdrawing my comments about the RDH static methods, but the rest of my architectural comments/suggestions stand, and you don't need another review from me until you've responded to those. Let me know if any of that doesn't match your perspective.
On 2016/01/22 17:38:59, Randy Smith - Not in Fridays wrote: > On 2016/01/21 18:52:56, csharrison wrote: > > Responded to comments without making architectural changes. Hopefully will > > decide w/ Randy tomorrow how to structure this and shoot up another CL by the > > weekend. We'll see. > > Just to make sure we're on the same page based on our conversation offline; I'm > withdrawing my comments about the RDH static methods, but the rest of my > architectural comments/suggestions stand, and you don't need another review from > me until you've responded to those. Let me know if any of that doesn't match > your perspective. Yep, on the same page. This is the best revamped API I can come up with: 1. Remove NotifyFor/NotifyForEach. This entails creating Cancel/Block/Resume for Frame / Route methods. 2. Add a boolean to Cancel/Block/ResumeForFrame method indicating that the method should work on the entire frame tree. This is a little kludgey, but we can assert that the node passed in is the main frame node and call it something like "should_recur_on_main_frame." This gives us the following new API content/public BlockRequestsForFrame(framehost, recur) ResumeRequestsForFrame(framehost, recur) content/ CancelBlockedRequestsForFrame(framehost, recur) BlockRequestsForRoute(route) ResumeBlockedRequestsForRoute(route) The ForRoute methods will be used by the WebContentsImpl NewWindow code path only (no framehost available on UI thread, other call is on IO thread). WDYT? I'll start implementing when you give signoff. The other problem with this API is that it gives content/public access to the FrameTree API, so we could also do the following: content/public BlockRequestsForFrame(framehost) ResumeRequestsForFrame(framehost) content/ BlockRequestsForFrame(framehost, recur) ResumeRequestsForFrame(framehost, recur) CancelBlockedRequestsForFrame(framehost, recur) BlockRequestsForRoute(route) ResumeBlockedRequestsForRoute(route) But that's worse than two APIs that take FrameHosts and FrameTrees, respectively.
On 2016/01/25 16:13:47, csharrison wrote: > On 2016/01/22 17:38:59, Randy Smith - Not in Fridays wrote: > > On 2016/01/21 18:52:56, csharrison wrote: > > > Responded to comments without making architectural changes. Hopefully will > > > decide w/ Randy tomorrow how to structure this and shoot up another CL by > the > > > weekend. We'll see. > > > > Just to make sure we're on the same page based on our conversation offline; > I'm > > withdrawing my comments about the RDH static methods, but the rest of my > > architectural comments/suggestions stand, and you don't need another review > from > > me until you've responded to those. Let me know if any of that doesn't match > > your perspective. > > Yep, on the same page. This is the best revamped API I can come up with: > > 1. Remove NotifyFor/NotifyForEach. This entails creating Cancel/Block/Resume for > Frame / Route methods. > > 2. Add a boolean to Cancel/Block/ResumeForFrame method indicating that the > method should work on the entire frame tree. This is a little kludgey, but we > can assert that the node passed in is the main frame node and call it something > like "should_recur_on_main_frame." > > > This gives us the following new API > > content/public > BlockRequestsForFrame(framehost, recur) > ResumeRequestsForFrame(framehost, recur) > > content/ > CancelBlockedRequestsForFrame(framehost, recur) > BlockRequestsForRoute(route) > ResumeBlockedRequestsForRoute(route) > > The ForRoute methods will be used by the WebContentsImpl NewWindow code path > only (no framehost available on UI thread, other call is on IO thread). > > WDYT? I'll start implementing when you give signoff. The other problem with this > API is that it gives content/public access to the FrameTree API, so we could > also do the following: So I like the above API quite a bit; thank you. Having said that, unless the API's going to be much worse without, I'd lean against adding stuff to the content/ interface (== content/public), and you should certainly run the change by a content/ OWNER before implementing, as that's exactly the area that they tend to be most conservative around. Having said *that*, I don't see why you need to add the FrameTree concept to the interface? It's just adding a boolean to the interface you sketch out below. (If what you mean is giving the *implementation* of methods in content/public access to the FrameTree API, I think that's ok, and also avoidable if it's not (just indirect directly into the same static on the RDHI) but you should probably check with a content/ OWNER just in case). > content/public > BlockRequestsForFrame(framehost) > ResumeRequestsForFrame(framehost) > > content/ > BlockRequestsForFrame(framehost, recur) > ResumeRequestsForFrame(framehost, recur) I think having the same name but different signatures on static methods of two classes that have an inheritance relationship is an awesome recipe for confusion and mistakes; I'd recommend against :-}. > CancelBlockedRequestsForFrame(framehost, recur) > BlockRequestsForRoute(route) > ResumeBlockedRequestsForRoute(route) > > But that's worse than two APIs that take FrameHosts and FrameTrees, > respectively.
On 2016/01/26 20:32:12, Randy Smith - Not in Fridays wrote: > On 2016/01/25 16:13:47, csharrison wrote: > > On 2016/01/22 17:38:59, Randy Smith - Not in Fridays wrote: > > > On 2016/01/21 18:52:56, csharrison wrote: > > > > Responded to comments without making architectural changes. Hopefully will > > > > decide w/ Randy tomorrow how to structure this and shoot up another CL by > > the > > > > weekend. We'll see. > > > > > > Just to make sure we're on the same page based on our conversation offline; > > I'm > > > withdrawing my comments about the RDH static methods, but the rest of my > > > architectural comments/suggestions stand, and you don't need another review > > from > > > me until you've responded to those. Let me know if any of that doesn't > match > > > your perspective. > > > > Yep, on the same page. This is the best revamped API I can come up with: > > > > 1. Remove NotifyFor/NotifyForEach. This entails creating Cancel/Block/Resume > for > > Frame / Route methods. > > > > 2. Add a boolean to Cancel/Block/ResumeForFrame method indicating that the > > method should work on the entire frame tree. This is a little kludgey, but we > > can assert that the node passed in is the main frame node and call it > something > > like "should_recur_on_main_frame." > > > > > > This gives us the following new API > > > > content/public > > BlockRequestsForFrame(framehost, recur) > > ResumeRequestsForFrame(framehost, recur) > > > > content/ > > CancelBlockedRequestsForFrame(framehost, recur) > > BlockRequestsForRoute(route) > > ResumeBlockedRequestsForRoute(route) > > > > The ForRoute methods will be used by the WebContentsImpl NewWindow code path > > only (no framehost available on UI thread, other call is on IO thread). > > > > WDYT? I'll start implementing when you give signoff. The other problem with > this > > API is that it gives content/public access to the FrameTree API, so we could > > also do the following: > > So I like the above API quite a bit; thank you. Having said that, unless the > API's going to be much worse without, I'd lean against adding stuff to the > content/ interface (== content/public), and you should certainly run the change > by a content/ OWNER before implementing, as that's exactly the area that they > tend to be most conservative around. Having said *that*, I don't see why you > need to add the FrameTree concept to the interface? It's just adding a boolean > to the interface you sketch out below. (If what you mean is giving the > *implementation* of methods in content/public access to the FrameTree API, I > think that's ok, and also avoidable if it's not (just indirect directly into the > same static on the RDHI) but you should probably check with a content/ OWNER > just in case). > > > content/public > > BlockRequestsForFrame(framehost) > > ResumeRequestsForFrame(framehost) > > > > content/ > > BlockRequestsForFrame(framehost, recur) > > ResumeRequestsForFrame(framehost, recur) > > I think having the same name but different signatures on static methods of two > classes that have an inheritance relationship is an awesome recipe for confusion > and mistakes; I'd recommend against :-}. > > > CancelBlockedRequestsForFrame(framehost, recur) > > BlockRequestsForRoute(route) > > ResumeBlockedRequestsForRoute(route) > > > > But that's worse than two APIs that take FrameHosts and FrameTrees, > > respectively. Yeah it would be the implementation (i.e. they just take a bool). Consumers won't need access to FrameTrees. If that's too much I guess the next best thing is content/public BlockRequestsForFrame(framehost) ResumeRequestsForFrame(framehost) content/ BlockRequestsForFrameTree(tree) ResumeRequestsForFrameTree(tree) CancelBlockedRequestsForFrameTree(tree) BlockRequestsForRoute(route) ResumeBlockedRequestsForRoute(route)
On 2016/01/26 20:48:10, csharrison wrote: > On 2016/01/26 20:32:12, Randy Smith - Not in Fridays wrote: > > On 2016/01/25 16:13:47, csharrison wrote: > > > On 2016/01/22 17:38:59, Randy Smith - Not in Fridays wrote: > > > > On 2016/01/21 18:52:56, csharrison wrote: > > > > > Responded to comments without making architectural changes. Hopefully > will > > > > > decide w/ Randy tomorrow how to structure this and shoot up another CL > by > > > the > > > > > weekend. We'll see. > > > > > > > > Just to make sure we're on the same page based on our conversation > offline; > > > I'm > > > > withdrawing my comments about the RDH static methods, but the rest of my > > > > architectural comments/suggestions stand, and you don't need another > review > > > from > > > > me until you've responded to those. Let me know if any of that doesn't > > match > > > > your perspective. > > > > > > Yep, on the same page. This is the best revamped API I can come up with: > > > > > > 1. Remove NotifyFor/NotifyForEach. This entails creating Cancel/Block/Resume > > for > > > Frame / Route methods. > > > > > > 2. Add a boolean to Cancel/Block/ResumeForFrame method indicating that the > > > method should work on the entire frame tree. This is a little kludgey, but > we > > > can assert that the node passed in is the main frame node and call it > > something > > > like "should_recur_on_main_frame." > > > > > > > > > This gives us the following new API > > > > > > content/public > > > BlockRequestsForFrame(framehost, recur) > > > ResumeRequestsForFrame(framehost, recur) > > > > > > content/ > > > CancelBlockedRequestsForFrame(framehost, recur) > > > BlockRequestsForRoute(route) > > > ResumeBlockedRequestsForRoute(route) > > > > > > The ForRoute methods will be used by the WebContentsImpl NewWindow code path > > > only (no framehost available on UI thread, other call is on IO thread). > > > > > > WDYT? I'll start implementing when you give signoff. The other problem with > > this > > > API is that it gives content/public access to the FrameTree API, so we could > > > also do the following: > > > > So I like the above API quite a bit; thank you. Having said that, unless the > > API's going to be much worse without, I'd lean against adding stuff to the > > content/ interface (== content/public), and you should certainly run the > change > > by a content/ OWNER before implementing, as that's exactly the area that they > > tend to be most conservative around. Having said *that*, I don't see why you > > need to add the FrameTree concept to the interface? It's just adding a > boolean > > to the interface you sketch out below. (If what you mean is giving the > > *implementation* of methods in content/public access to the FrameTree API, I > > think that's ok, and also avoidable if it's not (just indirect directly into > the > > same static on the RDHI) but you should probably check with a content/ OWNER > > just in case). > > > > > content/public > > > BlockRequestsForFrame(framehost) > > > ResumeRequestsForFrame(framehost) > > > > > > content/ > > > BlockRequestsForFrame(framehost, recur) > > > ResumeRequestsForFrame(framehost, recur) > > > > I think having the same name but different signatures on static methods of two > > classes that have an inheritance relationship is an awesome recipe for > confusion > > and mistakes; I'd recommend against :-}. > > > > > CancelBlockedRequestsForFrame(framehost, recur) > > > BlockRequestsForRoute(route) > > > ResumeBlockedRequestsForRoute(route) > > > > > > But that's worse than two APIs that take FrameHosts and FrameTrees, > > > respectively. > > Yeah it would be the implementation (i.e. they just take a bool). Consumers > won't need access to FrameTrees. If that's too much I guess the next best thing > is I think an implementation dependency is fine, actually. So +1 for your first API plan. > content/public > BlockRequestsForFrame(framehost) > ResumeRequestsForFrame(framehost) > > content/ > BlockRequestsForFrameTree(tree) > ResumeRequestsForFrameTree(tree) > CancelBlockedRequestsForFrameTree(tree) > BlockRequestsForRoute(route) > ResumeBlockedRequestsForRoute(route)
On 2016/01/26 20:49:51, Randy Smith - Not in Fridays wrote: > On 2016/01/26 20:48:10, csharrison wrote: > > On 2016/01/26 20:32:12, Randy Smith - Not in Fridays wrote: > > > On 2016/01/25 16:13:47, csharrison wrote: > > > > On 2016/01/22 17:38:59, Randy Smith - Not in Fridays wrote: > > > > > On 2016/01/21 18:52:56, csharrison wrote: > > > > > > Responded to comments without making architectural changes. Hopefully > > will > > > > > > decide w/ Randy tomorrow how to structure this and shoot up another CL > > by > > > > the > > > > > > weekend. We'll see. > > > > > > > > > > Just to make sure we're on the same page based on our conversation > > offline; > > > > I'm > > > > > withdrawing my comments about the RDH static methods, but the rest of my > > > > > architectural comments/suggestions stand, and you don't need another > > review > > > > from > > > > > me until you've responded to those. Let me know if any of that doesn't > > > match > > > > > your perspective. > > > > > > > > Yep, on the same page. This is the best revamped API I can come up with: > > > > > > > > 1. Remove NotifyFor/NotifyForEach. This entails creating > Cancel/Block/Resume > > > for > > > > Frame / Route methods. > > > > > > > > 2. Add a boolean to Cancel/Block/ResumeForFrame method indicating that the > > > > method should work on the entire frame tree. This is a little kludgey, but > > we > > > > can assert that the node passed in is the main frame node and call it > > > something > > > > like "should_recur_on_main_frame." > > > > > > > > > > > > This gives us the following new API > > > > > > > > content/public > > > > BlockRequestsForFrame(framehost, recur) > > > > ResumeRequestsForFrame(framehost, recur) > > > > > > > > content/ > > > > CancelBlockedRequestsForFrame(framehost, recur) > > > > BlockRequestsForRoute(route) > > > > ResumeBlockedRequestsForRoute(route) > > > > > > > > The ForRoute methods will be used by the WebContentsImpl NewWindow code > path > > > > only (no framehost available on UI thread, other call is on IO thread). > > > > > > > > WDYT? I'll start implementing when you give signoff. The other problem > with > > > this > > > > API is that it gives content/public access to the FrameTree API, so we > could > > > > also do the following: > > > > > > So I like the above API quite a bit; thank you. Having said that, unless > the > > > API's going to be much worse without, I'd lean against adding stuff to the > > > content/ interface (== content/public), and you should certainly run the > > change > > > by a content/ OWNER before implementing, as that's exactly the area that > they > > > tend to be most conservative around. Having said *that*, I don't see why > you > > > need to add the FrameTree concept to the interface? It's just adding a > > boolean > > > to the interface you sketch out below. (If what you mean is giving the > > > *implementation* of methods in content/public access to the FrameTree API, I > > > think that's ok, and also avoidable if it's not (just indirect directly into > > the > > > same static on the RDHI) but you should probably check with a content/ OWNER > > > just in case). > > > > > > > content/public > > > > BlockRequestsForFrame(framehost) > > > > ResumeRequestsForFrame(framehost) > > > > > > > > content/ > > > > BlockRequestsForFrame(framehost, recur) > > > > ResumeRequestsForFrame(framehost, recur) > > > > > > I think having the same name but different signatures on static methods of > two > > > classes that have an inheritance relationship is an awesome recipe for > > confusion > > > and mistakes; I'd recommend against :-}. > > > > > > > CancelBlockedRequestsForFrame(framehost, recur) > > > > BlockRequestsForRoute(route) > > > > ResumeBlockedRequestsForRoute(route) > > > > > > > > But that's worse than two APIs that take FrameHosts and FrameTrees, > > > > respectively. > > > > Yeah it would be the implementation (i.e. they just take a bool). Consumers > > won't need access to FrameTrees. If that's too much I guess the next best > thing > > is > > I think an implementation dependency is fine, actually. So +1 for your first > API plan. Just to be explicit, can you list which is the last standing proposal? In general, we don't want to expose FrameTree outside of content/. > > content/public > > BlockRequestsForFrame(framehost) > > ResumeRequestsForFrame(framehost) > > > > content/ > > BlockRequestsForFrameTree(tree) > > ResumeRequestsForFrameTree(tree) > > CancelBlockedRequestsForFrameTree(tree) > > BlockRequestsForRoute(route) > > ResumeBlockedRequestsForRoute(route)
On 2016/01/27 18:31:39, nasko wrote: > On 2016/01/26 20:49:51, Randy Smith - Not in Fridays wrote: > > On 2016/01/26 20:48:10, csharrison wrote: > > > On 2016/01/26 20:32:12, Randy Smith - Not in Fridays wrote: > > > > On 2016/01/25 16:13:47, csharrison wrote: > > > > > On 2016/01/22 17:38:59, Randy Smith - Not in Fridays wrote: > > > > > > On 2016/01/21 18:52:56, csharrison wrote: > > > > > > > Responded to comments without making architectural changes. > Hopefully > > > will > > > > > > > decide w/ Randy tomorrow how to structure this and shoot up another > CL > > > by > > > > > the > > > > > > > weekend. We'll see. > > > > > > > > > > > > Just to make sure we're on the same page based on our conversation > > > offline; > > > > > I'm > > > > > > withdrawing my comments about the RDH static methods, but the rest of > my > > > > > > architectural comments/suggestions stand, and you don't need another > > > review > > > > > from > > > > > > me until you've responded to those. Let me know if any of that > doesn't > > > > match > > > > > > your perspective. > > > > > > > > > > Yep, on the same page. This is the best revamped API I can come up with: > > > > > > > > > > 1. Remove NotifyFor/NotifyForEach. This entails creating > > Cancel/Block/Resume > > > > for > > > > > Frame / Route methods. > > > > > > > > > > 2. Add a boolean to Cancel/Block/ResumeForFrame method indicating that > the > > > > > method should work on the entire frame tree. This is a little kludgey, > but > > > we > > > > > can assert that the node passed in is the main frame node and call it > > > > something > > > > > like "should_recur_on_main_frame." > > > > > > > > > > > > > > > This gives us the following new API > > > > > > > > > > content/public > > > > > BlockRequestsForFrame(framehost, recur) > > > > > ResumeRequestsForFrame(framehost, recur) > > > > > > > > > > content/ > > > > > CancelBlockedRequestsForFrame(framehost, recur) > > > > > BlockRequestsForRoute(route) > > > > > ResumeBlockedRequestsForRoute(route) > > > > > > > > > > The ForRoute methods will be used by the WebContentsImpl NewWindow code > > path > > > > > only (no framehost available on UI thread, other call is on IO thread). > > > > > > > > > > WDYT? I'll start implementing when you give signoff. The other problem > > with > > > > this > > > > > API is that it gives content/public access to the FrameTree API, so we > > could > > > > > also do the following: > > > > > > > > So I like the above API quite a bit; thank you. Having said that, unless > > the > > > > API's going to be much worse without, I'd lean against adding stuff to the > > > > content/ interface (== content/public), and you should certainly run the > > > change > > > > by a content/ OWNER before implementing, as that's exactly the area that > > they > > > > tend to be most conservative around. Having said *that*, I don't see why > > you > > > > need to add the FrameTree concept to the interface? It's just adding a > > > boolean > > > > to the interface you sketch out below. (If what you mean is giving the > > > > *implementation* of methods in content/public access to the FrameTree API, > I > > > > think that's ok, and also avoidable if it's not (just indirect directly > into > > > the > > > > same static on the RDHI) but you should probably check with a content/ > OWNER > > > > just in case). > > > > > > > > > content/public > > > > > BlockRequestsForFrame(framehost) > > > > > ResumeRequestsForFrame(framehost) > > > > > > > > > > content/ > > > > > BlockRequestsForFrame(framehost, recur) > > > > > ResumeRequestsForFrame(framehost, recur) > > > > > > > > I think having the same name but different signatures on static methods of > > two > > > > classes that have an inheritance relationship is an awesome recipe for > > > confusion > > > > and mistakes; I'd recommend against :-}. > > > > > > > > > CancelBlockedRequestsForFrame(framehost, recur) > > > > > BlockRequestsForRoute(route) > > > > > ResumeBlockedRequestsForRoute(route) > > > > > > > > > > But that's worse than two APIs that take FrameHosts and FrameTrees, > > > > > respectively. > > > > > > Yeah it would be the implementation (i.e. they just take a bool). Consumers > > > won't need access to FrameTrees. If that's too much I guess the next best > > thing > > > is > > > > I think an implementation dependency is fine, actually. So +1 for your first > > API plan. > > Just to be explicit, can you list which is the last standing proposal? I am in favor of the first API described in c#21. > In general, we don't want to expose FrameTree outside of content/. This exposes the tuple (RenderFrameHost, bool) outside of content/, which I presume is ok. It's conceptually exposing the frame tree (the bool indicates whether you'll recurse down it or not) but not exposing that type. I presume that's ok, since I presume the concept of frames having frames in them is sorta obvious, but I wanted a content/ OWNER's opinion (i.e. your opinion) on it as well. -- Randy > > > > content/public > > > BlockRequestsForFrame(framehost) > > > ResumeRequestsForFrame(framehost) > > > > > > content/ > > > BlockRequestsForFrameTree(tree) > > > ResumeRequestsForFrameTree(tree) > > > CancelBlockedRequestsForFrameTree(tree) > > > BlockRequestsForRoute(route) > > > ResumeBlockedRequestsForRoute(route)
On 2016/01/27 19:13:57, Randy Smith - Not in Fridays wrote: > On 2016/01/27 18:31:39, nasko wrote: > > On 2016/01/26 20:49:51, Randy Smith - Not in Fridays wrote: > > > On 2016/01/26 20:48:10, csharrison wrote: > > > > On 2016/01/26 20:32:12, Randy Smith - Not in Fridays wrote: > > > > > On 2016/01/25 16:13:47, csharrison wrote: > > > > > > On 2016/01/22 17:38:59, Randy Smith - Not in Fridays wrote: > > > > > > > On 2016/01/21 18:52:56, csharrison wrote: > > > > > > > > Responded to comments without making architectural changes. > > Hopefully > > > > will > > > > > > > > decide w/ Randy tomorrow how to structure this and shoot up > another > > CL > > > > by > > > > > > the > > > > > > > > weekend. We'll see. > > > > > > > > > > > > > > Just to make sure we're on the same page based on our conversation > > > > offline; > > > > > > I'm > > > > > > > withdrawing my comments about the RDH static methods, but the rest > of > > my > > > > > > > architectural comments/suggestions stand, and you don't need another > > > > review > > > > > > from > > > > > > > me until you've responded to those. Let me know if any of that > > doesn't > > > > > match > > > > > > > your perspective. > > > > > > > > > > > > Yep, on the same page. This is the best revamped API I can come up > with: > > > > > > > > > > > > 1. Remove NotifyFor/NotifyForEach. This entails creating > > > Cancel/Block/Resume > > > > > for > > > > > > Frame / Route methods. > > > > > > > > > > > > 2. Add a boolean to Cancel/Block/ResumeForFrame method indicating that > > the > > > > > > method should work on the entire frame tree. This is a little kludgey, > > but > > > > we > > > > > > can assert that the node passed in is the main frame node and call it > > > > > something > > > > > > like "should_recur_on_main_frame." > > > > > > > > > > > > > > > > > > This gives us the following new API > > > > > > > > > > > > content/public > > > > > > BlockRequestsForFrame(framehost, recur) > > > > > > ResumeRequestsForFrame(framehost, recur) > > > > > > > > > > > > content/ > > > > > > CancelBlockedRequestsForFrame(framehost, recur) > > > > > > BlockRequestsForRoute(route) > > > > > > ResumeBlockedRequestsForRoute(route) > > > > > > > > > > > > The ForRoute methods will be used by the WebContentsImpl NewWindow > code > > > path > > > > > > only (no framehost available on UI thread, other call is on IO > thread). > > > > > > > > > > > > WDYT? I'll start implementing when you give signoff. The other problem > > > with > > > > > this > > > > > > API is that it gives content/public access to the FrameTree API, so we > > > could > > > > > > also do the following: > > > > > > > > > > So I like the above API quite a bit; thank you. Having said that, > unless > > > the > > > > > API's going to be much worse without, I'd lean against adding stuff to > the > > > > > content/ interface (== content/public), and you should certainly run the > > > > change > > > > > by a content/ OWNER before implementing, as that's exactly the area that > > > they > > > > > tend to be most conservative around. Having said *that*, I don't see > why > > > you > > > > > need to add the FrameTree concept to the interface? It's just adding a > > > > boolean > > > > > to the interface you sketch out below. (If what you mean is giving the > > > > > *implementation* of methods in content/public access to the FrameTree > API, > > I > > > > > think that's ok, and also avoidable if it's not (just indirect directly > > into > > > > the > > > > > same static on the RDHI) but you should probably check with a content/ > > OWNER > > > > > just in case). > > > > > > > > > > > content/public > > > > > > BlockRequestsForFrame(framehost) > > > > > > ResumeRequestsForFrame(framehost) > > > > > > > > > > > > content/ > > > > > > BlockRequestsForFrame(framehost, recur) > > > > > > ResumeRequestsForFrame(framehost, recur) > > > > > > > > > > I think having the same name but different signatures on static methods > of > > > two > > > > > classes that have an inheritance relationship is an awesome recipe for > > > > confusion > > > > > and mistakes; I'd recommend against :-}. > > > > > > > > > > > CancelBlockedRequestsForFrame(framehost, recur) > > > > > > BlockRequestsForRoute(route) > > > > > > ResumeBlockedRequestsForRoute(route) > > > > > > > > > > > > But that's worse than two APIs that take FrameHosts and FrameTrees, > > > > > > respectively. > > > > > > > > Yeah it would be the implementation (i.e. they just take a bool). > Consumers > > > > won't need access to FrameTrees. If that's too much I guess the next best > > > thing > > > > is > > > > > > I think an implementation dependency is fine, actually. So +1 for your > first > > > API plan. > > > > Just to be explicit, can you list which is the last standing proposal? > > I am in favor of the first API described in c#21. > > > In general, we don't want to expose FrameTree outside of content/. > > This exposes the tuple (RenderFrameHost, bool) outside of content/, which I > presume is ok. It's conceptually exposing the frame tree (the bool indicates > whether you'll recurse down it or not) but not exposing that type. I presume > that's ok, since I presume the concept of frames having frames in them is sorta > obvious, but I wanted a content/ OWNER's opinion (i.e. your opinion) on it as > well. My only question is why do we need the recurse parameter? I have to look at all the call sites for the new API, but in general I think we use it when doing navigations, right? If that is the case, navigating any frame ends up destroying all of its subframes, so no need to recurse into them. Also, we use it when creating new WebContents, which by definition will only have one frame and will not have subframes until we have unblocked the loads so a document can be loaded. > -- Randy > > > > > > > content/public > > > > BlockRequestsForFrame(framehost) > > > > ResumeRequestsForFrame(framehost) > > > > > > > > content/ > > > > BlockRequestsForFrameTree(tree) > > > > ResumeRequestsForFrameTree(tree) > > > > CancelBlockedRequestsForFrameTree(tree) > > > > BlockRequestsForRoute(route) > > > > ResumeBlockedRequestsForRoute(route)
On 2016/01/27 19:28:37, nasko wrote: > On 2016/01/27 19:13:57, Randy Smith - Not in Fridays wrote: > > On 2016/01/27 18:31:39, nasko wrote: > > > On 2016/01/26 20:49:51, Randy Smith - Not in Fridays wrote: > > > > On 2016/01/26 20:48:10, csharrison wrote: > > > > > On 2016/01/26 20:32:12, Randy Smith - Not in Fridays wrote: > > > > > > On 2016/01/25 16:13:47, csharrison wrote: > > > > > > > On 2016/01/22 17:38:59, Randy Smith - Not in Fridays wrote: > > > > > > > > On 2016/01/21 18:52:56, csharrison wrote: > > > > > > > > > Responded to comments without making architectural changes. > > > Hopefully > > > > > will > > > > > > > > > decide w/ Randy tomorrow how to structure this and shoot up > > another > > > CL > > > > > by > > > > > > > the > > > > > > > > > weekend. We'll see. > > > > > > > > > > > > > > > > Just to make sure we're on the same page based on our conversation > > > > > offline; > > > > > > > I'm > > > > > > > > withdrawing my comments about the RDH static methods, but the rest > > of > > > my > > > > > > > > architectural comments/suggestions stand, and you don't need > another > > > > > review > > > > > > > from > > > > > > > > me until you've responded to those. Let me know if any of that > > > doesn't > > > > > > match > > > > > > > > your perspective. > > > > > > > > > > > > > > Yep, on the same page. This is the best revamped API I can come up > > with: > > > > > > > > > > > > > > 1. Remove NotifyFor/NotifyForEach. This entails creating > > > > Cancel/Block/Resume > > > > > > for > > > > > > > Frame / Route methods. > > > > > > > > > > > > > > 2. Add a boolean to Cancel/Block/ResumeForFrame method indicating > that > > > the > > > > > > > method should work on the entire frame tree. This is a little > kludgey, > > > but > > > > > we > > > > > > > can assert that the node passed in is the main frame node and call > it > > > > > > something > > > > > > > like "should_recur_on_main_frame." > > > > > > > > > > > > > > > > > > > > > This gives us the following new API > > > > > > > > > > > > > > content/public > > > > > > > BlockRequestsForFrame(framehost, recur) > > > > > > > ResumeRequestsForFrame(framehost, recur) > > > > > > > > > > > > > > content/ > > > > > > > CancelBlockedRequestsForFrame(framehost, recur) > > > > > > > BlockRequestsForRoute(route) > > > > > > > ResumeBlockedRequestsForRoute(route) > > > > > > > > > > > > > > The ForRoute methods will be used by the WebContentsImpl NewWindow > > code > > > > path > > > > > > > only (no framehost available on UI thread, other call is on IO > > thread). > > > > > > > > > > > > > > WDYT? I'll start implementing when you give signoff. The other > problem > > > > with > > > > > > this > > > > > > > API is that it gives content/public access to the FrameTree API, so > we > > > > could > > > > > > > also do the following: > > > > > > > > > > > > So I like the above API quite a bit; thank you. Having said that, > > unless > > > > the > > > > > > API's going to be much worse without, I'd lean against adding stuff to > > the > > > > > > content/ interface (== content/public), and you should certainly run > the > > > > > change > > > > > > by a content/ OWNER before implementing, as that's exactly the area > that > > > > they > > > > > > tend to be most conservative around. Having said *that*, I don't see > > why > > > > you > > > > > > need to add the FrameTree concept to the interface? It's just adding > a > > > > > boolean > > > > > > to the interface you sketch out below. (If what you mean is giving > the > > > > > > *implementation* of methods in content/public access to the FrameTree > > API, > > > I > > > > > > think that's ok, and also avoidable if it's not (just indirect > directly > > > into > > > > > the > > > > > > same static on the RDHI) but you should probably check with a content/ > > > OWNER > > > > > > just in case). > > > > > > > > > > > > > content/public > > > > > > > BlockRequestsForFrame(framehost) > > > > > > > ResumeRequestsForFrame(framehost) > > > > > > > > > > > > > > content/ > > > > > > > BlockRequestsForFrame(framehost, recur) > > > > > > > ResumeRequestsForFrame(framehost, recur) > > > > > > > > > > > > I think having the same name but different signatures on static > methods > > of > > > > two > > > > > > classes that have an inheritance relationship is an awesome recipe for > > > > > confusion > > > > > > and mistakes; I'd recommend against :-}. > > > > > > > > > > > > > CancelBlockedRequestsForFrame(framehost, recur) > > > > > > > BlockRequestsForRoute(route) > > > > > > > ResumeBlockedRequestsForRoute(route) > > > > > > > > > > > > > > But that's worse than two APIs that take FrameHosts and FrameTrees, > > > > > > > respectively. > > > > > > > > > > Yeah it would be the implementation (i.e. they just take a bool). > > Consumers > > > > > won't need access to FrameTrees. If that's too much I guess the next > best > > > > thing > > > > > is > > > > > > > > I think an implementation dependency is fine, actually. So +1 for your > > first > > > > API plan. > > > > > > Just to be explicit, can you list which is the last standing proposal? > > > > I am in favor of the first API described in c#21. > > > > > In general, we don't want to expose FrameTree outside of content/. > > > > This exposes the tuple (RenderFrameHost, bool) outside of content/, which I > > presume is ok. It's conceptually exposing the frame tree (the bool indicates > > whether you'll recurse down it or not) but not exposing that type. I presume > > that's ok, since I presume the concept of frames having frames in them is > sorta > > obvious, but I wanted a content/ OWNER's opinion (i.e. your opinion) on it as > > well. > > My only question is why do we need the recurse parameter? I have to look at all > the call sites for the new API, but in general I think we use it when doing > navigations, right? If that is the case, navigating any frame ends up destroying > all of its subframes, so no need to recurse into them. Also, we use it when > creating new WebContents, which by definition will only have one frame and will > not have subframes until we have unblocked the loads so a document can be > loaded. > > > -- Randy > > > > > > > > > > content/public > > > > > BlockRequestsForFrame(framehost) > > > > > ResumeRequestsForFrame(framehost) > > > > > > > > > > content/ > > > > > BlockRequestsForFrameTree(tree) > > > > > ResumeRequestsForFrameTree(tree) > > > > > CancelBlockedRequestsForFrameTree(tree) > > > > > BlockRequestsForRoute(route) > > > > > ResumeBlockedRequestsForRoute(route) The only time we need it is for interstitials blocking their underlying page. I'm fine with having a special (non content/public) interface for them if you think that's a cleaner solution.
On 2016/01/27 19:31:18, csharrison wrote: > On 2016/01/27 19:28:37, nasko wrote: > > On 2016/01/27 19:13:57, Randy Smith - Not in Fridays wrote: > > > On 2016/01/27 18:31:39, nasko wrote: > > > > On 2016/01/26 20:49:51, Randy Smith - Not in Fridays wrote: > > > > > On 2016/01/26 20:48:10, csharrison wrote: > > > > > > On 2016/01/26 20:32:12, Randy Smith - Not in Fridays wrote: > > > > > > > On 2016/01/25 16:13:47, csharrison wrote: > > > > > > > > On 2016/01/22 17:38:59, Randy Smith - Not in Fridays wrote: > > > > > > > > > On 2016/01/21 18:52:56, csharrison wrote: > > > > > > > > > > Responded to comments without making architectural changes. > > > > Hopefully > > > > > > will > > > > > > > > > > decide w/ Randy tomorrow how to structure this and shoot up > > > another > > > > CL > > > > > > by > > > > > > > > the > > > > > > > > > > weekend. We'll see. > > > > > > > > > > > > > > > > > > Just to make sure we're on the same page based on our > conversation > > > > > > offline; > > > > > > > > I'm > > > > > > > > > withdrawing my comments about the RDH static methods, but the > rest > > > of > > > > my > > > > > > > > > architectural comments/suggestions stand, and you don't need > > another > > > > > > review > > > > > > > > from > > > > > > > > > me until you've responded to those. Let me know if any of that > > > > doesn't > > > > > > > match > > > > > > > > > your perspective. > > > > > > > > > > > > > > > > Yep, on the same page. This is the best revamped API I can come up > > > with: > > > > > > > > > > > > > > > > 1. Remove NotifyFor/NotifyForEach. This entails creating > > > > > Cancel/Block/Resume > > > > > > > for > > > > > > > > Frame / Route methods. > > > > > > > > > > > > > > > > 2. Add a boolean to Cancel/Block/ResumeForFrame method indicating > > that > > > > the > > > > > > > > method should work on the entire frame tree. This is a little > > kludgey, > > > > but > > > > > > we > > > > > > > > can assert that the node passed in is the main frame node and call > > it > > > > > > > something > > > > > > > > like "should_recur_on_main_frame." > > > > > > > > > > > > > > > > > > > > > > > > This gives us the following new API > > > > > > > > > > > > > > > > content/public > > > > > > > > BlockRequestsForFrame(framehost, recur) > > > > > > > > ResumeRequestsForFrame(framehost, recur) > > > > > > > > > > > > > > > > content/ > > > > > > > > CancelBlockedRequestsForFrame(framehost, recur) > > > > > > > > BlockRequestsForRoute(route) > > > > > > > > ResumeBlockedRequestsForRoute(route) > > > > > > > > > > > > > > > > The ForRoute methods will be used by the WebContentsImpl NewWindow > > > code > > > > > path > > > > > > > > only (no framehost available on UI thread, other call is on IO > > > thread). > > > > > > > > > > > > > > > > WDYT? I'll start implementing when you give signoff. The other > > problem > > > > > with > > > > > > > this > > > > > > > > API is that it gives content/public access to the FrameTree API, > so > > we > > > > > could > > > > > > > > also do the following: > > > > > > > > > > > > > > So I like the above API quite a bit; thank you. Having said that, > > > unless > > > > > the > > > > > > > API's going to be much worse without, I'd lean against adding stuff > to > > > the > > > > > > > content/ interface (== content/public), and you should certainly run > > the > > > > > > change > > > > > > > by a content/ OWNER before implementing, as that's exactly the area > > that > > > > > they > > > > > > > tend to be most conservative around. Having said *that*, I don't > see > > > why > > > > > you > > > > > > > need to add the FrameTree concept to the interface? It's just > adding > > a > > > > > > boolean > > > > > > > to the interface you sketch out below. (If what you mean is giving > > the > > > > > > > *implementation* of methods in content/public access to the > FrameTree > > > API, > > > > I > > > > > > > think that's ok, and also avoidable if it's not (just indirect > > directly > > > > into > > > > > > the > > > > > > > same static on the RDHI) but you should probably check with a > content/ > > > > OWNER > > > > > > > just in case). > > > > > > > > > > > > > > > content/public > > > > > > > > BlockRequestsForFrame(framehost) > > > > > > > > ResumeRequestsForFrame(framehost) > > > > > > > > > > > > > > > > content/ > > > > > > > > BlockRequestsForFrame(framehost, recur) > > > > > > > > ResumeRequestsForFrame(framehost, recur) > > > > > > > > > > > > > > I think having the same name but different signatures on static > > methods > > > of > > > > > two > > > > > > > classes that have an inheritance relationship is an awesome recipe > for > > > > > > confusion > > > > > > > and mistakes; I'd recommend against :-}. > > > > > > > > > > > > > > > CancelBlockedRequestsForFrame(framehost, recur) > > > > > > > > BlockRequestsForRoute(route) > > > > > > > > ResumeBlockedRequestsForRoute(route) > > > > > > > > > > > > > > > > But that's worse than two APIs that take FrameHosts and > FrameTrees, > > > > > > > > respectively. > > > > > > > > > > > > Yeah it would be the implementation (i.e. they just take a bool). > > > Consumers > > > > > > won't need access to FrameTrees. If that's too much I guess the next > > best > > > > > thing > > > > > > is > > > > > > > > > > I think an implementation dependency is fine, actually. So +1 for your > > > first > > > > > API plan. > > > > > > > > Just to be explicit, can you list which is the last standing proposal? > > > > > > I am in favor of the first API described in c#21. > > > > > > > In general, we don't want to expose FrameTree outside of content/. > > > > > > This exposes the tuple (RenderFrameHost, bool) outside of content/, which I > > > presume is ok. It's conceptually exposing the frame tree (the bool > indicates > > > whether you'll recurse down it or not) but not exposing that type. I > presume > > > that's ok, since I presume the concept of frames having frames in them is > > sorta > > > obvious, but I wanted a content/ OWNER's opinion (i.e. your opinion) on it > as > > > well. > > > > My only question is why do we need the recurse parameter? I have to look at > all > > the call sites for the new API, but in general I think we use it when doing > > navigations, right? If that is the case, navigating any frame ends up > destroying > > all of its subframes, so no need to recurse into them. Also, we use it when > > creating new WebContents, which by definition will only have one frame and > will > > not have subframes until we have unblocked the loads so a document can be > > loaded. > > > > > -- Randy > > > > > > > > > > > > > content/public > > > > > > BlockRequestsForFrame(framehost) > > > > > > ResumeRequestsForFrame(framehost) > > > > > > > > > > > > content/ > > > > > > BlockRequestsForFrameTree(tree) > > > > > > ResumeRequestsForFrameTree(tree) > > > > > > CancelBlockedRequestsForFrameTree(tree) > > > > > > BlockRequestsForRoute(route) > > > > > > ResumeBlockedRequestsForRoute(route) > > The only time we need it is for interstitials blocking their underlying page. > I'm fine with having a special (non content/public) interface for them if you > think that's a cleaner solution. Now that Nasko's weighed in I find myself interested in this issue as well. When would we ever want to block requests on the top level frame and *not* on all its subframes? I.e. can't we just always take recurse as true?
On 2016/01/27 20:17:02, Randy Smith - Not in Fridays wrote: > On 2016/01/27 19:31:18, csharrison wrote: > > On 2016/01/27 19:28:37, nasko wrote: > > > On 2016/01/27 19:13:57, Randy Smith - Not in Fridays wrote: > > > > On 2016/01/27 18:31:39, nasko wrote: > > > > > On 2016/01/26 20:49:51, Randy Smith - Not in Fridays wrote: > > > > > > On 2016/01/26 20:48:10, csharrison wrote: > > > > > > > On 2016/01/26 20:32:12, Randy Smith - Not in Fridays wrote: > > > > > > > > On 2016/01/25 16:13:47, csharrison wrote: > > > > > > > > > On 2016/01/22 17:38:59, Randy Smith - Not in Fridays wrote: > > > > > > > > > > On 2016/01/21 18:52:56, csharrison wrote: > > > > > > > > > > > Responded to comments without making architectural changes. > > > > > Hopefully > > > > > > > will > > > > > > > > > > > decide w/ Randy tomorrow how to structure this and shoot up > > > > another > > > > > CL > > > > > > > by > > > > > > > > > the > > > > > > > > > > > weekend. We'll see. > > > > > > > > > > > > > > > > > > > > Just to make sure we're on the same page based on our > > conversation > > > > > > > offline; > > > > > > > > > I'm > > > > > > > > > > withdrawing my comments about the RDH static methods, but the > > rest > > > > of > > > > > my > > > > > > > > > > architectural comments/suggestions stand, and you don't need > > > another > > > > > > > review > > > > > > > > > from > > > > > > > > > > me until you've responded to those. Let me know if any of > that > > > > > doesn't > > > > > > > > match > > > > > > > > > > your perspective. > > > > > > > > > > > > > > > > > > Yep, on the same page. This is the best revamped API I can come > up > > > > with: > > > > > > > > > > > > > > > > > > 1. Remove NotifyFor/NotifyForEach. This entails creating > > > > > > Cancel/Block/Resume > > > > > > > > for > > > > > > > > > Frame / Route methods. > > > > > > > > > > > > > > > > > > 2. Add a boolean to Cancel/Block/ResumeForFrame method > indicating > > > that > > > > > the > > > > > > > > > method should work on the entire frame tree. This is a little > > > kludgey, > > > > > but > > > > > > > we > > > > > > > > > can assert that the node passed in is the main frame node and > call > > > it > > > > > > > > something > > > > > > > > > like "should_recur_on_main_frame." > > > > > > > > > > > > > > > > > > > > > > > > > > > This gives us the following new API > > > > > > > > > > > > > > > > > > content/public > > > > > > > > > BlockRequestsForFrame(framehost, recur) > > > > > > > > > ResumeRequestsForFrame(framehost, recur) > > > > > > > > > > > > > > > > > > content/ > > > > > > > > > CancelBlockedRequestsForFrame(framehost, recur) > > > > > > > > > BlockRequestsForRoute(route) > > > > > > > > > ResumeBlockedRequestsForRoute(route) > > > > > > > > > > > > > > > > > > The ForRoute methods will be used by the WebContentsImpl > NewWindow > > > > code > > > > > > path > > > > > > > > > only (no framehost available on UI thread, other call is on IO > > > > thread). > > > > > > > > > > > > > > > > > > WDYT? I'll start implementing when you give signoff. The other > > > problem > > > > > > with > > > > > > > > this > > > > > > > > > API is that it gives content/public access to the FrameTree API, > > so > > > we > > > > > > could > > > > > > > > > also do the following: > > > > > > > > > > > > > > > > So I like the above API quite a bit; thank you. Having said that, > > > > unless > > > > > > the > > > > > > > > API's going to be much worse without, I'd lean against adding > stuff > > to > > > > the > > > > > > > > content/ interface (== content/public), and you should certainly > run > > > the > > > > > > > change > > > > > > > > by a content/ OWNER before implementing, as that's exactly the > area > > > that > > > > > > they > > > > > > > > tend to be most conservative around. Having said *that*, I don't > > see > > > > why > > > > > > you > > > > > > > > need to add the FrameTree concept to the interface? It's just > > adding > > > a > > > > > > > boolean > > > > > > > > to the interface you sketch out below. (If what you mean is > giving > > > the > > > > > > > > *implementation* of methods in content/public access to the > > FrameTree > > > > API, > > > > > I > > > > > > > > think that's ok, and also avoidable if it's not (just indirect > > > directly > > > > > into > > > > > > > the > > > > > > > > same static on the RDHI) but you should probably check with a > > content/ > > > > > OWNER > > > > > > > > just in case). > > > > > > > > > > > > > > > > > content/public > > > > > > > > > BlockRequestsForFrame(framehost) > > > > > > > > > ResumeRequestsForFrame(framehost) > > > > > > > > > > > > > > > > > > content/ > > > > > > > > > BlockRequestsForFrame(framehost, recur) > > > > > > > > > ResumeRequestsForFrame(framehost, recur) > > > > > > > > > > > > > > > > I think having the same name but different signatures on static > > > methods > > > > of > > > > > > two > > > > > > > > classes that have an inheritance relationship is an awesome recipe > > for > > > > > > > confusion > > > > > > > > and mistakes; I'd recommend against :-}. > > > > > > > > > > > > > > > > > CancelBlockedRequestsForFrame(framehost, recur) > > > > > > > > > BlockRequestsForRoute(route) > > > > > > > > > ResumeBlockedRequestsForRoute(route) > > > > > > > > > > > > > > > > > > But that's worse than two APIs that take FrameHosts and > > FrameTrees, > > > > > > > > > respectively. > > > > > > > > > > > > > > Yeah it would be the implementation (i.e. they just take a bool). > > > > Consumers > > > > > > > won't need access to FrameTrees. If that's too much I guess the next > > > best > > > > > > thing > > > > > > > is > > > > > > > > > > > > I think an implementation dependency is fine, actually. So +1 for > your > > > > first > > > > > > API plan. > > > > > > > > > > Just to be explicit, can you list which is the last standing proposal? > > > > > > > > I am in favor of the first API described in c#21. > > > > > > > > > In general, we don't want to expose FrameTree outside of content/. > > > > > > > > This exposes the tuple (RenderFrameHost, bool) outside of content/, which > I > > > > presume is ok. It's conceptually exposing the frame tree (the bool > > indicates > > > > whether you'll recurse down it or not) but not exposing that type. I > > presume > > > > that's ok, since I presume the concept of frames having frames in them is > > > sorta > > > > obvious, but I wanted a content/ OWNER's opinion (i.e. your opinion) on it > > as > > > > well. > > > > > > My only question is why do we need the recurse parameter? I have to look at > > all > > > the call sites for the new API, but in general I think we use it when doing > > > navigations, right? If that is the case, navigating any frame ends up > > destroying > > > all of its subframes, so no need to recurse into them. Also, we use it when > > > creating new WebContents, which by definition will only have one frame and > > will > > > not have subframes until we have unblocked the loads so a document can be > > > loaded. > > > > > > > -- Randy > > > > > > > > > > > > > > > > content/public > > > > > > > BlockRequestsForFrame(framehost) > > > > > > > ResumeRequestsForFrame(framehost) > > > > > > > > > > > > > > content/ > > > > > > > BlockRequestsForFrameTree(tree) > > > > > > > ResumeRequestsForFrameTree(tree) > > > > > > > CancelBlockedRequestsForFrameTree(tree) > > > > > > > BlockRequestsForRoute(route) > > > > > > > ResumeBlockedRequestsForRoute(route) > > > > The only time we need it is for interstitials blocking their underlying page. > > I'm fine with having a special (non content/public) interface for them if you > > think that's a cleaner solution. > > Now that Nasko's weighed in I find myself interested in this issue as well. > When would we ever want to block requests on the top level frame and *not* on > all its subframes? I.e. can't we just always take recurse as true? Good point. I think we can. I was opting not to for a kind of "principle of least power." I imagine that should work, and it ties cleaner with the old implementation keying off rvid.
On 2016/01/27 20:28:28, csharrison wrote: > On 2016/01/27 20:17:02, Randy Smith - Not in Fridays wrote: > > On 2016/01/27 19:31:18, csharrison wrote: > > > On 2016/01/27 19:28:37, nasko wrote: > > > > On 2016/01/27 19:13:57, Randy Smith - Not in Fridays wrote: > > > > > On 2016/01/27 18:31:39, nasko wrote: > > > > > > On 2016/01/26 20:49:51, Randy Smith - Not in Fridays wrote: > > > > > > > On 2016/01/26 20:48:10, csharrison wrote: > > > > > > > > On 2016/01/26 20:32:12, Randy Smith - Not in Fridays wrote: > > > > > > > > > On 2016/01/25 16:13:47, csharrison wrote: > > > > > > > > > > On 2016/01/22 17:38:59, Randy Smith - Not in Fridays wrote: > > > > > > > > > > > On 2016/01/21 18:52:56, csharrison wrote: > > > > > > > > > > > > Responded to comments without making architectural > changes. > > > > > > Hopefully > > > > > > > > will > > > > > > > > > > > > decide w/ Randy tomorrow how to structure this and shoot > up > > > > > another > > > > > > CL > > > > > > > > by > > > > > > > > > > the > > > > > > > > > > > > weekend. We'll see. > > > > > > > > > > > > > > > > > > > > > > Just to make sure we're on the same page based on our > > > conversation > > > > > > > > offline; > > > > > > > > > > I'm > > > > > > > > > > > withdrawing my comments about the RDH static methods, but > the > > > rest > > > > > of > > > > > > my > > > > > > > > > > > architectural comments/suggestions stand, and you don't need > > > > another > > > > > > > > review > > > > > > > > > > from > > > > > > > > > > > me until you've responded to those. Let me know if any of > > that > > > > > > doesn't > > > > > > > > > match > > > > > > > > > > > your perspective. > > > > > > > > > > > > > > > > > > > > Yep, on the same page. This is the best revamped API I can > come > > up > > > > > with: > > > > > > > > > > > > > > > > > > > > 1. Remove NotifyFor/NotifyForEach. This entails creating > > > > > > > Cancel/Block/Resume > > > > > > > > > for > > > > > > > > > > Frame / Route methods. > > > > > > > > > > > > > > > > > > > > 2. Add a boolean to Cancel/Block/ResumeForFrame method > > indicating > > > > that > > > > > > the > > > > > > > > > > method should work on the entire frame tree. This is a little > > > > kludgey, > > > > > > but > > > > > > > > we > > > > > > > > > > can assert that the node passed in is the main frame node and > > call > > > > it > > > > > > > > > something > > > > > > > > > > like "should_recur_on_main_frame." > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > This gives us the following new API > > > > > > > > > > > > > > > > > > > > content/public > > > > > > > > > > BlockRequestsForFrame(framehost, recur) > > > > > > > > > > ResumeRequestsForFrame(framehost, recur) > > > > > > > > > > > > > > > > > > > > content/ > > > > > > > > > > CancelBlockedRequestsForFrame(framehost, recur) > > > > > > > > > > BlockRequestsForRoute(route) > > > > > > > > > > ResumeBlockedRequestsForRoute(route) > > > > > > > > > > > > > > > > > > > > The ForRoute methods will be used by the WebContentsImpl > > NewWindow > > > > > code > > > > > > > path > > > > > > > > > > only (no framehost available on UI thread, other call is on IO > > > > > thread). > > > > > > > > > > > > > > > > > > > > WDYT? I'll start implementing when you give signoff. The other > > > > problem > > > > > > > with > > > > > > > > > this > > > > > > > > > > API is that it gives content/public access to the FrameTree > API, > > > so > > > > we > > > > > > > could > > > > > > > > > > also do the following: > > > > > > > > > > > > > > > > > > So I like the above API quite a bit; thank you. Having said > that, > > > > > unless > > > > > > > the > > > > > > > > > API's going to be much worse without, I'd lean against adding > > stuff > > > to > > > > > the > > > > > > > > > content/ interface (== content/public), and you should certainly > > run > > > > the > > > > > > > > change > > > > > > > > > by a content/ OWNER before implementing, as that's exactly the > > area > > > > that > > > > > > > they > > > > > > > > > tend to be most conservative around. Having said *that*, I > don't > > > see > > > > > why > > > > > > > you > > > > > > > > > need to add the FrameTree concept to the interface? It's just > > > adding > > > > a > > > > > > > > boolean > > > > > > > > > to the interface you sketch out below. (If what you mean is > > giving > > > > the > > > > > > > > > *implementation* of methods in content/public access to the > > > FrameTree > > > > > API, > > > > > > I > > > > > > > > > think that's ok, and also avoidable if it's not (just indirect > > > > directly > > > > > > into > > > > > > > > the > > > > > > > > > same static on the RDHI) but you should probably check with a > > > content/ > > > > > > OWNER > > > > > > > > > just in case). > > > > > > > > > > > > > > > > > > > content/public > > > > > > > > > > BlockRequestsForFrame(framehost) > > > > > > > > > > ResumeRequestsForFrame(framehost) > > > > > > > > > > > > > > > > > > > > content/ > > > > > > > > > > BlockRequestsForFrame(framehost, recur) > > > > > > > > > > ResumeRequestsForFrame(framehost, recur) > > > > > > > > > > > > > > > > > > I think having the same name but different signatures on static > > > > methods > > > > > of > > > > > > > two > > > > > > > > > classes that have an inheritance relationship is an awesome > recipe > > > for > > > > > > > > confusion > > > > > > > > > and mistakes; I'd recommend against :-}. > > > > > > > > > > > > > > > > > > > CancelBlockedRequestsForFrame(framehost, recur) > > > > > > > > > > BlockRequestsForRoute(route) > > > > > > > > > > ResumeBlockedRequestsForRoute(route) > > > > > > > > > > > > > > > > > > > > But that's worse than two APIs that take FrameHosts and > > > FrameTrees, > > > > > > > > > > respectively. > > > > > > > > > > > > > > > > Yeah it would be the implementation (i.e. they just take a bool). > > > > > Consumers > > > > > > > > won't need access to FrameTrees. If that's too much I guess the > next > > > > best > > > > > > > thing > > > > > > > > is > > > > > > > > > > > > > > I think an implementation dependency is fine, actually. So +1 for > > your > > > > > first > > > > > > > API plan. > > > > > > > > > > > > Just to be explicit, can you list which is the last standing proposal? > > > > > > > > > > I am in favor of the first API described in c#21. > > > > > > > > > > > In general, we don't want to expose FrameTree outside of content/. > > > > > > > > > > This exposes the tuple (RenderFrameHost, bool) outside of content/, > which > > I > > > > > presume is ok. It's conceptually exposing the frame tree (the bool > > > indicates > > > > > whether you'll recurse down it or not) but not exposing that type. I > > > presume > > > > > that's ok, since I presume the concept of frames having frames in them > is > > > > sorta > > > > > obvious, but I wanted a content/ OWNER's opinion (i.e. your opinion) on > it > > > as > > > > > well. > > > > > > > > My only question is why do we need the recurse parameter? I have to look > at > > > all > > > > the call sites for the new API, but in general I think we use it when > doing > > > > navigations, right? If that is the case, navigating any frame ends up > > > destroying > > > > all of its subframes, so no need to recurse into them. Also, we use it > when > > > > creating new WebContents, which by definition will only have one frame and > > > will > > > > not have subframes until we have unblocked the loads so a document can be > > > > loaded. > > > > > > > > > -- Randy > > > > > > > > > > > > > > > > > > > content/public > > > > > > > > BlockRequestsForFrame(framehost) > > > > > > > > ResumeRequestsForFrame(framehost) > > > > > > > > > > > > > > > > content/ > > > > > > > > BlockRequestsForFrameTree(tree) > > > > > > > > ResumeRequestsForFrameTree(tree) > > > > > > > > CancelBlockedRequestsForFrameTree(tree) > > > > > > > > BlockRequestsForRoute(route) > > > > > > > > ResumeBlockedRequestsForRoute(route) > > > > > > The only time we need it is for interstitials blocking their underlying > page. > > > I'm fine with having a special (non content/public) interface for them if > you > > > think that's a cleaner solution. > > > > Now that Nasko's weighed in I find myself interested in this issue as well. > > When would we ever want to block requests on the top level frame and *not* on > > all its subframes? I.e. can't we just always take recurse as true? > > Good point. I think we can. I was opting not to for a kind of "principle of > least power." I imagine that should work, and it ties cleaner with the old > implementation keying off rvid. I think the heuristic I'd advocate for in this space is "don't add complexity until it's needed". But which heuristic should trump is always a tricky judgement.
Description was changed from ========== Refactored blocked_loaders_map_ to key by render frame route id This change is a necessary step to completely refactor out render view ids from the ResourceDispatcherHostImpl. This means that the interface to block, resume, or cancel requests now require passing in the frame routing id and the child id. The ResourceScheduler, SaveFile, and Downloads still use the RVID. BUG=472869 ========== to ========== Refactored blocked_loaders_map_ to key by render frame route id This change is a necessary step to completely refactor out render view ids from the ResourceDispatcherHostImpl. This means that the interface to block, resume, or cancel requests now require passing in the frame routing id and the child id. The ResourceScheduler, SaveFile, and Downloads still use the RVID. BUG=472869 CQ_INCLUDE_TRYBOTS=tryserver.chromium.linux:linux_site_isolation ==========
On 2016/01/27 at 20:31:59, rdsmith wrote: > On 2016/01/27 20:28:28, csharrison wrote: > > On 2016/01/27 20:17:02, Randy Smith - Not in Fridays wrote: > > > On 2016/01/27 19:31:18, csharrison wrote: > > > > On 2016/01/27 19:28:37, nasko wrote: > > > > > On 2016/01/27 19:13:57, Randy Smith - Not in Fridays wrote: > > > > > > On 2016/01/27 18:31:39, nasko wrote: > > > > > > > On 2016/01/26 20:49:51, Randy Smith - Not in Fridays wrote: > > > > > > > > On 2016/01/26 20:48:10, csharrison wrote: > > > > > > > > > On 2016/01/26 20:32:12, Randy Smith - Not in Fridays wrote: > > > > > > > > > > On 2016/01/25 16:13:47, csharrison wrote: > > > > > > > > > > > On 2016/01/22 17:38:59, Randy Smith - Not in Fridays wrote: > > > > > > > > > > > > On 2016/01/21 18:52:56, csharrison wrote: > > > > > > > > > > > > > Responded to comments without making architectural > > changes. > > > > > > > Hopefully > > > > > > > > > will > > > > > > > > > > > > > decide w/ Randy tomorrow how to structure this and shoot > > up > > > > > > another > > > > > > > CL > > > > > > > > > by > > > > > > > > > > > the > > > > > > > > > > > > > weekend. We'll see. > > > > > > > > > > > > > > > > > > > > > > > > Just to make sure we're on the same page based on our > > > > conversation > > > > > > > > > offline; > > > > > > > > > > > I'm > > > > > > > > > > > > withdrawing my comments about the RDH static methods, but > > the > > > > rest > > > > > > of > > > > > > > my > > > > > > > > > > > > architectural comments/suggestions stand, and you don't need > > > > > another > > > > > > > > > review > > > > > > > > > > > from > > > > > > > > > > > > me until you've responded to those. Let me know if any of > > > that > > > > > > > doesn't > > > > > > > > > > match > > > > > > > > > > > > your perspective. > > > > > > > > > > > > > > > > > > > > > > Yep, on the same page. This is the best revamped API I can > > come > > > up > > > > > > with: > > > > > > > > > > > > > > > > > > > > > > 1. Remove NotifyFor/NotifyForEach. This entails creating > > > > > > > > Cancel/Block/Resume > > > > > > > > > > for > > > > > > > > > > > Frame / Route methods. > > > > > > > > > > > > > > > > > > > > > > 2. Add a boolean to Cancel/Block/ResumeForFrame method > > > indicating > > > > > that > > > > > > > the > > > > > > > > > > > method should work on the entire frame tree. This is a little > > > > > kludgey, > > > > > > > but > > > > > > > > > we > > > > > > > > > > > can assert that the node passed in is the main frame node and > > > call > > > > > it > > > > > > > > > > something > > > > > > > > > > > like "should_recur_on_main_frame." > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > This gives us the following new API > > > > > > > > > > > > > > > > > > > > > > content/public > > > > > > > > > > > BlockRequestsForFrame(framehost, recur) > > > > > > > > > > > ResumeRequestsForFrame(framehost, recur) > > > > > > > > > > > > > > > > > > > > > > content/ > > > > > > > > > > > CancelBlockedRequestsForFrame(framehost, recur) > > > > > > > > > > > BlockRequestsForRoute(route) > > > > > > > > > > > ResumeBlockedRequestsForRoute(route) > > > > > > > > > > > > > > > > > > > > > > The ForRoute methods will be used by the WebContentsImpl > > > NewWindow > > > > > > code > > > > > > > > path > > > > > > > > > > > only (no framehost available on UI thread, other call is on IO > > > > > > thread). > > > > > > > > > > > > > > > > > > > > > > WDYT? I'll start implementing when you give signoff. The other > > > > > problem > > > > > > > > with > > > > > > > > > > this > > > > > > > > > > > API is that it gives content/public access to the FrameTree > > API, > > > > so > > > > > we > > > > > > > > could > > > > > > > > > > > also do the following: > > > > > > > > > > > > > > > > > > > > So I like the above API quite a bit; thank you. Having said > > that, > > > > > > unless > > > > > > > > the > > > > > > > > > > API's going to be much worse without, I'd lean against adding > > > stuff > > > > to > > > > > > the > > > > > > > > > > content/ interface (== content/public), and you should certainly > > > run > > > > > the > > > > > > > > > change > > > > > > > > > > by a content/ OWNER before implementing, as that's exactly the > > > area > > > > > that > > > > > > > > they > > > > > > > > > > tend to be most conservative around. Having said *that*, I > > don't > > > > see > > > > > > why > > > > > > > > you > > > > > > > > > > need to add the FrameTree concept to the interface? It's just > > > > adding > > > > > a > > > > > > > > > boolean > > > > > > > > > > to the interface you sketch out below. (If what you mean is > > > giving > > > > > the > > > > > > > > > > *implementation* of methods in content/public access to the > > > > FrameTree > > > > > > API, > > > > > > > I > > > > > > > > > > think that's ok, and also avoidable if it's not (just indirect > > > > > directly > > > > > > > into > > > > > > > > > the > > > > > > > > > > same static on the RDHI) but you should probably check with a > > > > content/ > > > > > > > OWNER > > > > > > > > > > just in case). > > > > > > > > > > > > > > > > > > > > > content/public > > > > > > > > > > > BlockRequestsForFrame(framehost) > > > > > > > > > > > ResumeRequestsForFrame(framehost) > > > > > > > > > > > > > > > > > > > > > > content/ > > > > > > > > > > > BlockRequestsForFrame(framehost, recur) > > > > > > > > > > > ResumeRequestsForFrame(framehost, recur) > > > > > > > > > > > > > > > > > > > > I think having the same name but different signatures on static > > > > > methods > > > > > > of > > > > > > > > two > > > > > > > > > > classes that have an inheritance relationship is an awesome > > recipe > > > > for > > > > > > > > > confusion > > > > > > > > > > and mistakes; I'd recommend against :-}. > > > > > > > > > > > > > > > > > > > > > CancelBlockedRequestsForFrame(framehost, recur) > > > > > > > > > > > BlockRequestsForRoute(route) > > > > > > > > > > > ResumeBlockedRequestsForRoute(route) > > > > > > > > > > > > > > > > > > > > > > But that's worse than two APIs that take FrameHosts and > > > > FrameTrees, > > > > > > > > > > > respectively. > > > > > > > > > > > > > > > > > > Yeah it would be the implementation (i.e. they just take a bool). > > > > > > Consumers > > > > > > > > > won't need access to FrameTrees. If that's too much I guess the > > next > > > > > best > > > > > > > > thing > > > > > > > > > is > > > > > > > > > > > > > > > > I think an implementation dependency is fine, actually. So +1 for > > > your > > > > > > first > > > > > > > > API plan. > > > > > > > > > > > > > > Just to be explicit, can you list which is the last standing proposal? > > > > > > > > > > > > I am in favor of the first API described in c#21. > > > > > > > > > > > > > In general, we don't want to expose FrameTree outside of content/. > > > > > > > > > > > > This exposes the tuple (RenderFrameHost, bool) outside of content/, > > which > > > I > > > > > > presume is ok. It's conceptually exposing the frame tree (the bool > > > > indicates > > > > > > whether you'll recurse down it or not) but not exposing that type. I > > > > presume > > > > > > that's ok, since I presume the concept of frames having frames in them > > is > > > > > sorta > > > > > > obvious, but I wanted a content/ OWNER's opinion (i.e. your opinion) on > > it > > > > as > > > > > > well. > > > > > > > > > > My only question is why do we need the recurse parameter? I have to look > > at > > > > all > > > > > the call sites for the new API, but in general I think we use it when > > doing > > > > > navigations, right? If that is the case, navigating any frame ends up > > > > destroying > > > > > all of its subframes, so no need to recurse into them. Also, we use it > > when > > > > > creating new WebContents, which by definition will only have one frame and > > > > will > > > > > not have subframes until we have unblocked the loads so a document can be > > > > > loaded. > > > > > > > > > > > -- Randy > > > > > > > > > > > > > > > > > > > > > > content/public > > > > > > > > > BlockRequestsForFrame(framehost) > > > > > > > > > ResumeRequestsForFrame(framehost) > > > > > > > > > > > > > > > > > > content/ > > > > > > > > > BlockRequestsForFrameTree(tree) > > > > > > > > > ResumeRequestsForFrameTree(tree) > > > > > > > > > CancelBlockedRequestsForFrameTree(tree) > > > > > > > > > BlockRequestsForRoute(route) > > > > > > > > > ResumeBlockedRequestsForRoute(route) > > > > > > > > The only time we need it is for interstitials blocking their underlying > > page. > > > > I'm fine with having a special (non content/public) interface for them if > > you > > > > think that's a cleaner solution. > > > > > > Now that Nasko's weighed in I find myself interested in this issue as well. > > > When would we ever want to block requests on the top level frame and *not* on > > > all its subframes? I.e. can't we just always take recurse as true? > > > > Good point. I think we can. I was opting not to for a kind of "principle of > > least power." I imagine that should work, and it ties cleaner with the old > > implementation keying off rvid. > > I think the heuristic I'd advocate for in this space is "don't add complexity until it's needed". But which heuristic should trump is always a tricky judgement. PTAL. Looks like initial trybots are okay with the recursive-by-default API for UI thread blocking/resuming.
This looks good; thank you. Mostly nits below. https://codereview.chromium.org/1542743002/diff/380001/content/browser/loader... File content/browser/loader/resource_dispatcher_host_impl.cc (right): https://codereview.chromium.org/1542743002/diff/380001/content/browser/loader... content/browser/loader/resource_dispatcher_host_impl.cc:493: void NotifyForEachFrameOnIO( nitty nit, suggestion: The name of this function implies it's more different from NotifyForRouteOnIO than it is; basically it's the plural of NotifyForRouteOnIO and nothing more (they both take frame routing ids). So maybe NotifyForFrameListOnIO? But up to you; it's a really small point (and I'm a lot less concerned with the naming of routines that aren't part of the class interface). https://codereview.chromium.org/1542743002/diff/380001/content/browser/loader... content/browser/loader/resource_dispatcher_host_impl.cc:502: void NotifyForEachFrame( Same as above. https://codereview.chromium.org/1542743002/diff/380001/content/browser/loader... content/browser/loader/resource_dispatcher_host_impl.cc:540: base::Bind(&ResourceDispatcherHostImpl::OnRenderFrameDeleted)); nit, suggestion: I'm inclined to think it's a cleaner, more minimalist interface to mark LoaderIOThreadNotifier a friend of RDHI and make RDHI::OnRenderFrameDeleted private. Why invite other classes to call it? https://codereview.chromium.org/1542743002/diff/380001/content/browser/loader... content/browser/loader/resource_dispatcher_host_impl.cc:1874: CancelRequestsForRoute(global_routing_id); Alternatively to my other suggestion, just make LoaderIOThreadNotifier a friend and have it post to CancelRequestsForRoute directly. https://codereview.chromium.org/1542743002/diff/380001/content/browser/loader... File content/browser/loader/resource_dispatcher_host_impl.h (right): https://codereview.chromium.org/1542743002/diff/380001/content/browser/loader... content/browser/loader/resource_dispatcher_host_impl.h:114: static void ResumeBlockedRequestsForRouteOnUI( Nit: For consistency, I'd either name them all with the thread they need to be called on, or name none of them with that thread. ETA: Thinking about it after reading through the implementation, I'd name them all with the thread. I think I'd suggest (up to you) that it be *FromUI rather than *OnUI, just because what *OnUI means to me is that the routine is a delegate from some other thread running the operation named On the given thread, but it's secondary/implementation. *FromUI suggests that it's unusual, but (again to me) not done on behalf of some other entity. A lot of what's going on for me here is that there are a lot of interfaces on RDHI already which have similar names to many of these, and I want to minimize confusion going forward from callers as to what's ok to call from what thread.
Thanks for the review! https://codereview.chromium.org/1542743002/diff/380001/content/browser/loader... File content/browser/loader/resource_dispatcher_host_impl.cc (right): https://codereview.chromium.org/1542743002/diff/380001/content/browser/loader... content/browser/loader/resource_dispatcher_host_impl.cc:493: void NotifyForEachFrameOnIO( On 2016/02/01 21:19:20, Randy Smith - Not in Fridays wrote: > nitty nit, suggestion: The name of this function implies it's more different > from NotifyForRouteOnIO than it is; basically it's the plural of > NotifyForRouteOnIO and nothing more (they both take frame routing ids). So > maybe NotifyForFrameListOnIO? But up to you; it's a really small point (and I'm > a lot less concerned with the naming of routines that aren't part of the class > interface). Changed it to "NotifyForRouteSetOnIO", to better parallel NotifyForRoute. https://codereview.chromium.org/1542743002/diff/380001/content/browser/loader... content/browser/loader/resource_dispatcher_host_impl.cc:502: void NotifyForEachFrame( On 2016/02/01 21:19:20, Randy Smith - Not in Fridays wrote: > Same as above. I prefer to leave this one as is. I can't really think of anything better at the moment. https://codereview.chromium.org/1542743002/diff/380001/content/browser/loader... content/browser/loader/resource_dispatcher_host_impl.cc:540: base::Bind(&ResourceDispatcherHostImpl::OnRenderFrameDeleted)); On 2016/02/01 21:19:20, Randy Smith - Not in Fridays wrote: > nit, suggestion: I'm inclined to think it's a cleaner, more minimalist interface > to mark LoaderIOThreadNotifier a friend of RDHI and make > RDHI::OnRenderFrameDeleted private. Why invite other classes to call it? I implemented this suggestion. https://codereview.chromium.org/1542743002/diff/380001/content/browser/loader... content/browser/loader/resource_dispatcher_host_impl.cc:1874: CancelRequestsForRoute(global_routing_id); On 2016/02/01 21:19:20, Randy Smith - Not in Fridays wrote: > Alternatively to my other suggestion, just make LoaderIOThreadNotifier a friend > and have it post to CancelRequestsForRoute directly. I implemented your previous suggestion.
LGTM (you can do what you like with the comment below). https://codereview.chromium.org/1542743002/diff/380001/content/browser/loader... File content/browser/loader/resource_dispatcher_host_impl.cc (right): https://codereview.chromium.org/1542743002/diff/380001/content/browser/loader... content/browser/loader/resource_dispatcher_host_impl.cc:502: void NotifyForEachFrame( On 2016/02/01 23:05:39, csharrison wrote: > On 2016/02/01 21:19:20, Randy Smith - Not in Fridays wrote: > > Same as above. > > I prefer to leave this one as is. I can't really think of anything better at the > moment. Yeah, looking at it more closely, this is fine. Ooops. https://codereview.chromium.org/1542743002/diff/420001/content/browser/web_co... File content/browser/web_contents/web_contents_impl.cc (right): https://codereview.chromium.org/1542743002/diff/420001/content/browser/web_co... content/browser/web_contents/web_contents_impl.cc:1853: // have a chance to create more frames at this point. Is this comment still accurate, given that we're recursing by default? To me it implies we're only targeting the main frame.
Thanks :) https://codereview.chromium.org/1542743002/diff/420001/content/browser/web_co... File content/browser/web_contents/web_contents_impl.cc (right): https://codereview.chromium.org/1542743002/diff/420001/content/browser/web_co... content/browser/web_contents/web_contents_impl.cc:1853: // have a chance to create more frames at this point. On 2016/02/02 20:47:06, Randy Smith - Not in Fridays wrote: > Is this comment still accurate, given that we're recursing by default? To me it > implies we're only targeting the main frame. This code path (and the path that blocks it) still target a single frame (route), because it's a new window code path and there isn't a frame tree yet.
Uhh, I realized I didn't send my comments : (. https://codereview.chromium.org/1542743002/diff/380001/content/browser/loader... File content/browser/loader/resource_dispatcher_host_impl.h (right): https://codereview.chromium.org/1542743002/diff/380001/content/browser/loader... content/browser/loader/resource_dispatcher_host_impl.h:117: // Blocks (and does not start) all requests for the frame tree identified by nit: Change "frame tree" with "frame and its subframes". Same in the comment below. https://codereview.chromium.org/1542743002/diff/380001/content/public/browser... File content/public/browser/resource_dispatcher_host.h (right): https://codereview.chromium.org/1542743002/diff/380001/content/public/browser... content/public/browser/resource_dispatcher_host.h:37: static void BlockRequestsForFrames(RenderFrameHost* root_frame_host); nit: I find the usage of plural "Frames" a bit confusing when the parameter is only one object. The comment already states that it recurses into its tree of subframes, so maybe just drop the plural?
Thanks, Nasko! https://codereview.chromium.org/1542743002/diff/380001/content/browser/loader... File content/browser/loader/resource_dispatcher_host_impl.h (right): https://codereview.chromium.org/1542743002/diff/380001/content/browser/loader... content/browser/loader/resource_dispatcher_host_impl.h:117: // Blocks (and does not start) all requests for the frame tree identified by On 2016/02/02 21:26:29, nasko wrote: > nit: Change "frame tree" with "frame and its subframes". Same in the comment > below. Done. https://codereview.chromium.org/1542743002/diff/380001/content/public/browser... File content/public/browser/resource_dispatcher_host.h (right): https://codereview.chromium.org/1542743002/diff/380001/content/public/browser... content/public/browser/resource_dispatcher_host.h:37: static void BlockRequestsForFrames(RenderFrameHost* root_frame_host); On 2016/02/02 21:26:30, nasko wrote: > nit: I find the usage of plural "Frames" a bit confusing when the parameter is > only one object. The comment already states that it recurses into its tree of > subframes, so maybe just drop the plural? Sounds good to me. Done (in all places).
LGTM with last couple of nits. https://codereview.chromium.org/1542743002/diff/440001/content/public/browser... File content/public/browser/resource_dispatcher_host.h (right): https://codereview.chromium.org/1542743002/diff/440001/content/public/browser... content/public/browser/resource_dispatcher_host.h:36: // blocked (not being started) until ResumeBlockedRequestsForRoute is called. Shouldn't this be ResumeBlockedRequestsForFrameFromUI? The Route based method is not public, is it? https://codereview.chromium.org/1542743002/diff/440001/content/public/browser... content/public/browser/resource_dispatcher_host.h:37: static void BlockRequestsForFrameFromUI(RenderFrameHost* root_frame_host); Not a huge fan of the extra "FromUI" suffixes as it makes the method less readable, but if you and Randy feel it should be there, let's go with it. In general, documentation/comment and DCHECK enforcing the thread should be sufficient enough.
On 2016/02/03 18:44:00, nasko wrote: > LGTM with last couple of nits. > > https://codereview.chromium.org/1542743002/diff/440001/content/public/browser... > File content/public/browser/resource_dispatcher_host.h (right): > > https://codereview.chromium.org/1542743002/diff/440001/content/public/browser... > content/public/browser/resource_dispatcher_host.h:36: // blocked (not being > started) until ResumeBlockedRequestsForRoute is called. > Shouldn't this be ResumeBlockedRequestsForFrameFromUI? The Route based method is > not public, is it? > > https://codereview.chromium.org/1542743002/diff/440001/content/public/browser... > content/public/browser/resource_dispatcher_host.h:37: static void > BlockRequestsForFrameFromUI(RenderFrameHost* root_frame_host); > Not a huge fan of the extra "FromUI" suffixes as it makes the method less > readable, but if you and Randy feel it should be there, let's go with it. In > general, documentation/comment and DCHECK enforcing the thread should be > sufficient enough. Hmmm. My strongest feeling is that I don't want one routine in the public interface marked with the thread name and others not. Beyond that, I'd like the UI and IO methods relatively easily distinguishable in consumer code, but would be willing to accept not (as long as the distinction was documented clearly in the header file)--I think documentation in the name will save people time when doing copy&paste, but they'll trip over the problem failure quickly when they run anything. (In my ideal world, we'd make the distinction by the UI methods just targeting UI thread objects, but we tried that and weren't able to make it succeed :-{.)
My take on the FromUI naming choice: My plan was for all static methods to be called from the UI thread, and be called with ui thread objects (framehost). There was one place where this was impossible (WebContentsImpl). If I changed ResumeBlockedRequestsForRouteFromUI => ResumeBlockedRequestsForRoute we would have name interference with the non static version of the method. I wanted the name similarity, because they are the same operation (one is just called on the UI thread). Hence, the FromUI postfix originally. It had a different naming scheme because it was a special case. Given all that, and my reluctant agreement with Randy that a single public method that names the thread is pretty bad, I think I'm going to go with keeping all the FromUI suffixes. It's a bit ugly and unreadable, but hopefully that will convince people not to use this ugly API and we can get rid of it sooner. https://codereview.chromium.org/1542743002/diff/440001/content/public/browser... File content/public/browser/resource_dispatcher_host.h (right): https://codereview.chromium.org/1542743002/diff/440001/content/public/browser... content/public/browser/resource_dispatcher_host.h:36: // blocked (not being started) until ResumeBlockedRequestsForRoute is called. On 2016/02/03 18:44:00, nasko wrote: > Shouldn't this be ResumeBlockedRequestsForFrameFromUI? The Route based method is > not public, is it? Correct. Done.
csharrison@chromium.org changed reviewers: + rdevlin.cronin@chromium.org
+ rdevlin@ for app window stuff. Thanks!
extensions lgtm https://codereview.chromium.org/1542743002/diff/460001/extensions/browser/app... File extensions/browser/app_window/app_window_contents.cc (right): https://codereview.chromium.org/1542743002/diff/460001/extensions/browser/app... extensions/browser/app_window/app_window_contents.cc:92: content::ResourceDispatcherHost::ResumeBlockedRequestsForFrameFromUI( Yay type checking! I had a bug awhile back that this would have prevented. Thanks! :)
The CQ bit was checked by csharrison@chromium.org
The patchset sent to the CQ was uploaded after l-g-t-m from rdsmith@chromium.org, nasko@chromium.org Link to the patchset: https://codereview.chromium.org/1542743002/#ps460001 (title: "nasko nit")
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1542743002/460001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1542743002/460001
On 2016/02/03 19:20:21, csharrison wrote: > My take on the FromUI naming choice: > > My plan was for all static methods to be called from the UI thread, and be > called with ui thread objects (framehost). There was one place where this was > impossible (WebContentsImpl). I would be really really scared if we could call any method on WebContents from the IO thread :). > If I changed ResumeBlockedRequestsForRouteFromUI => > ResumeBlockedRequestsForRoute we would have name interference with the non > static version of the method. I wanted the name similarity, because they are the > same operation (one is just called on the UI thread). Hence, the FromUI postfix > originally. It had a different naming scheme because it was a special case. > > Given all that, and my reluctant agreement with Randy that a single public > method that names the thread is pretty bad, I think I'm going to go with keeping > all the FromUI suffixes. It's a bit ugly and unreadable, but hopefully that will > convince people not to use this ugly API and we can get rid of it sooner. Getting rid of these in the near future will be awesome! If that's the plan, I'm even happier.
On 2016/02/03 21:45:09, nasko wrote: > On 2016/02/03 19:20:21, csharrison wrote: > > My take on the FromUI naming choice: > > > > My plan was for all static methods to be called from the UI thread, and be > > called with ui thread objects (framehost). There was one place where this was > > impossible (WebContentsImpl). > > I would be really really scared if we could call any method on WebContents from > the IO thread :). > > > If I changed ResumeBlockedRequestsForRouteFromUI => > > ResumeBlockedRequestsForRoute we would have name interference with the non > > static version of the method. I wanted the name similarity, because they are > the > > same operation (one is just called on the UI thread). Hence, the FromUI > postfix > > originally. It had a different naming scheme because it was a special case. > > > > Given all that, and my reluctant agreement with Randy that a single public > > method that names the thread is pretty bad, I think I'm going to go with > keeping > > all the FromUI suffixes. It's a bit ugly and unreadable, but hopefully that > will > > convince people not to use this ugly API and we can get rid of it sooner. > > Getting rid of these in the near future will be awesome! If that's the plan, I'm > even happier. Yupp. crbug.com/581037 is me trying to figure out how to rip it out. The things we do in this CL are frankly terrifying. If we can't rip it out it might be replaced with a sort of "scoped blocker" so that code that blocks requests are forced to hold responsibility for resuming. Devlin, I'll shoot you an email about your specific case.
Message was sent while issue was closed.
Committed patchset #24 (id:460001)
Message was sent while issue was closed.
Description was changed from ========== Refactored blocked_loaders_map_ to key by render frame route id This change is a necessary step to completely refactor out render view ids from the ResourceDispatcherHostImpl. This means that the interface to block, resume, or cancel requests now require passing in the frame routing id and the child id. The ResourceScheduler, SaveFile, and Downloads still use the RVID. BUG=472869 CQ_INCLUDE_TRYBOTS=tryserver.chromium.linux:linux_site_isolation ========== to ========== Refactored blocked_loaders_map_ to key by render frame route id This change is a necessary step to completely refactor out render view ids from the ResourceDispatcherHostImpl. This means that the interface to block, resume, or cancel requests now require passing in the frame routing id and the child id. The ResourceScheduler, SaveFile, and Downloads still use the RVID. BUG=472869 CQ_INCLUDE_TRYBOTS=tryserver.chromium.linux:linux_site_isolation Committed: https://crrev.com/a2280cd27bd434f6033d3ab0c70886c06e3882b0 Cr-Commit-Position: refs/heads/master@{#373380} ==========
Message was sent while issue was closed.
Patchset 24 (id:??) landed as https://crrev.com/a2280cd27bd434f6033d3ab0c70886c06e3882b0 Cr-Commit-Position: refs/heads/master@{#373380} |