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

Issue 2535723005: Stop using ResourceController in ResourceThrottle (Closed)

Created:
4 years ago by tyoshino (SeeGerritForStatus)
Modified:
4 years ago
CC:
achuith+watch_chromium.org, alemate+watch_chromium.org, asanka, cbentzel+watch_chromium.org, chromium-apps-reviews_chromium.org, chromium-reviews, darin-cc_chromium.org, davemoore+watch_chromium.org, extensions-reviews_chromium.org, gavinp+prer_chromium.org, jam, loading-reviews_chromium.org, oshima+watch_chromium.org, pam+watch_chromium.org, Randy Smith (Not in Mondays), tburkard+watch_chromium.org, mmenke
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Stop using ResourceController in ResourceThrottle The following classes are subclasses of the ResourceController interface: - AsyncRevalidationDriver - DetachableResourceHandler - InterceptingResourceHandler - MimeSniffingResourceHandler - ResourceLoader - ThrottlingResourceHandler The following classes out of them sets themselves as the controller for the next handler: - DetachableResourceHandler - InterceptingResourceHandler - MimeSniffingResourceHandler - ResourceLoader Classes implementing LayeredResourceHandler pass the controller given to SetController() call through to the next handler. With this mechanism, we can chain handlers, let each handler communicate defer signal via the ResourceHandler interface methods, and let the left most handler to propagate cancel/resume signal to the right most handler (it's ResourceLoader. possibly intercepted by the 4 classes). This is easy to understand. On the other hand, the AsyncRevalidationDriver and ThrottlingResourceHandler are diverting the ResourceController interface for defining their own interface to allow the throttles they have to resume handlers deferred due to throttling. Not for communication with the next handler. Moreover, the ResourceThrottle is exposing the ResourceController instance to its subclasses and letting them directly operate on the instance. This is making the ResourceController interface and handler chain hard to understand e.g. by making the cross reference on codesearch list a lot of callers. I'd like to make this cleaner by: - adding methods on ResourceThrottle that hides the details of communication with the associated handler, - introduce a dedicated interface ResourceThrottle::Delegate between the ResourceThrottle and the handlers than diverting the ResourceController interface. Motivation: - I plan to change AsyncResourceHandler::OnFollowRedirect() to take more arguments to reflect changes in parameters made by Blink (See crbug.com/646277 and crbug.com/665766 for the details why we need to do this). - I want to construct a path to propagate it to the URLRequest, but ResourceController::Resume() is used for various kinds of resuming. I want to separate redirect handling logic in Resume() into a separate method on ResourceController than adding arguments to Resume(). - Found that ResourceController is used for various purposes. Before fixing the issue, I wanted to clean it up for readability. R=reillyg@chromium.org,boliu@chromium.org,jochen@chromium.org BUG=646277 Committed: https://crrev.com/64fa092bc4ccdcb1c0cc08b93d6c1bd49363adb0 Cr-Commit-Position: refs/heads/master@{#436889}

Patch Set 1 : a #

Patch Set 2 : a #

Patch Set 3 : Rebase #

Total comments: 4

Patch Set 4 : Rebase #

Patch Set 5 : Addressed #48 #

Total comments: 7

Patch Set 6 : Addressed #62 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+156 lines, -153 lines) Patch
M android_webview/browser/renderer_host/aw_resource_dispatcher_host_delegate.cc View 2 chunks +2 lines, -3 lines 0 comments Download
M chrome/browser/chromeos/login/signin/merge_session_resource_throttle.cc View 2 chunks +1 line, -2 lines 0 comments Download
M chrome/browser/component_updater/component_updater_resource_throttle.cc View 2 chunks +1 line, -2 lines 0 comments Download
M chrome/browser/download/download_resource_throttle.cc View 3 chunks +3 lines, -4 lines 0 comments Download
M chrome/browser/download/download_resource_throttle_unittest.cc View 1 6 chunks +6 lines, -6 lines 0 comments Download
M chrome/browser/extensions/api/streams_private/streams_private_apitest.cc View 2 chunks +0 lines, -2 lines 0 comments Download
M chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc View 1 2 3 4 5 4 chunks +3 lines, -6 lines 0 comments Download
M chrome/browser/extensions/user_script_listener.cc View 3 chunks +3 lines, -4 lines 0 comments Download
M chrome/browser/extensions/user_script_listener_unittest.cc View 1 2 3 4 5 5 chunks +9 lines, -12 lines 0 comments Download
M chrome/browser/loader/data_reduction_proxy_resource_throttle_android.cc View 1 2 3 4 5 4 chunks +3 lines, -4 lines 0 comments Download
M chrome/browser/loader/safe_browsing_resource_throttle.h View 1 2 1 chunk +0 lines, -4 lines 0 comments Download
M chrome/browser/loader/safe_browsing_resource_throttle.cc View 1 2 5 chunks +3 lines, -8 lines 0 comments Download
M chrome/browser/prerender/prerender_contents.cc View 1 2 3 4 5 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/prerender/prerender_resource_throttle.h View 1 chunk +1 line, -5 lines 0 comments Download
M chrome/browser/prerender/prerender_resource_throttle.cc View 4 chunks +4 lines, -9 lines 0 comments Download
M chrome/browser/prerender/prerender_resource_throttle_unittest.cc View 1 4 chunks +4 lines, -4 lines 0 comments Download
M chrome/browser/supervised_user/supervised_user_resource_throttle.cc View 2 chunks +3 lines, -4 lines 0 comments Download
M components/web_restrictions/browser/web_restrictions_resource_throttle.cc View 2 chunks +2 lines, -3 lines 0 comments Download
M components/web_restrictions/browser/web_restrictions_resource_throttle_unittest.cc View 1 8 chunks +17 lines, -16 lines 0 comments Download
M content/browser/loader/async_revalidation_driver.h View 1 3 chunks +4 lines, -4 lines 0 comments Download
M content/browser/loader/async_revalidation_driver.cc View 1 1 chunk +1 line, -1 line 0 comments Download
M content/browser/loader/async_revalidation_driver_unittest.cc View 1 1 chunk +3 lines, -2 lines 0 comments Download
M content/browser/loader/cross_site_resource_handler_browsertest.cc View 3 chunks +3 lines, -4 lines 0 comments Download
M content/browser/loader/navigation_resource_throttle.cc View 1 2 2 chunks +4 lines, -5 lines 0 comments Download
M content/browser/loader/resource_dispatcher_host_unittest.cc View 1 2 3 4 5 5 chunks +9 lines, -9 lines 0 comments Download
M content/browser/loader/resource_scheduler.cc View 2 chunks +1 line, -2 lines 0 comments Download
M content/browser/loader/resource_scheduler_unittest.cc View 1 4 chunks +3 lines, -4 lines 0 comments Download
M content/browser/loader/throttling_resource_handler.h View 1 4 chunks +4 lines, -5 lines 0 comments Download
M content/browser/loader/throttling_resource_handler.cc View 1 9 chunks +9 lines, -8 lines 0 comments Download
M content/public/browser/resource_throttle.h View 1 2 3 4 2 chunks +31 lines, -7 lines 0 comments Download
M content/public/browser/resource_throttle.cc View 1 1 chunk +16 lines, -0 lines 0 comments Download
M extensions/browser/extension_request_limiting_throttle.cc View 3 chunks +2 lines, -3 lines 0 comments Download

Messages

Total messages: 76 (59 generated)
tyoshino (SeeGerritForStatus)
4 years ago (2016-11-30 15:05:50 UTC) #39
mmenke
Note that I have a pretty significant refactor of how ResourceControllers are passed through the ...
4 years ago (2016-11-30 15:15:35 UTC) #40
tyoshino (SeeGerritForStatus)
On 2016/11/30 15:15:35, mmenke wrote: > Note that I have a pretty significant refactor of ...
4 years ago (2016-12-01 12:17:38 UTC) #43
jochen (gone - plz use gerrit)
lgtm with comments added https://codereview.chromium.org/2535723005/diff/160001/content/public/browser/resource_throttle.h File content/public/browser/resource_throttle.h (right): https://codereview.chromium.org/2535723005/diff/160001/content/public/browser/resource_throttle.h#newcode29 content/public/browser/resource_throttle.h:29: virtual void Cancel() = 0; ...
4 years ago (2016-12-05 15:25:03 UTC) #48
jochen (gone - plz use gerrit)
please also add a tracking bug
4 years ago (2016-12-05 15:25:13 UTC) #49
tyoshino (SeeGerritForStatus)
On 2016/12/05 15:25:13, jochen wrote: > please also add a tracking bug I'll do. Thank ...
4 years ago (2016-12-05 16:07:08 UTC) #52
tyoshino (SeeGerritForStatus)
On 2016/12/05 16:07:08, tyoshino wrote: > On 2016/12/05 15:25:13, jochen wrote: > > please also ...
4 years ago (2016-12-05 16:07:33 UTC) #53
boliu
rs lgtm
4 years ago (2016-12-05 17:01:31 UTC) #54
tyoshino (SeeGerritForStatus)
On 2016/12/05 16:07:08, tyoshino wrote: > On 2016/12/05 15:25:13, jochen wrote: > > please also ...
4 years ago (2016-12-06 11:01:22 UTC) #56
tyoshino (SeeGerritForStatus)
https://codereview.chromium.org/2535723005/diff/160001/content/public/browser/resource_throttle.h File content/public/browser/resource_throttle.h (right): https://codereview.chromium.org/2535723005/diff/160001/content/public/browser/resource_throttle.h#newcode29 content/public/browser/resource_throttle.h:29: virtual void Cancel() = 0; On 2016/12/05 15:25:03, jochen ...
4 years ago (2016-12-06 11:25:31 UTC) #57
Reilly Grant (use Gerrit)
*/extensions/* lgtm with nits https://codereview.chromium.org/2535723005/diff/200001/chrome/browser/extensions/user_script_listener_unittest.cc File chrome/browser/extensions/user_script_listener_unittest.cc (right): https://codereview.chromium.org/2535723005/diff/200001/chrome/browser/extensions/user_script_listener_unittest.cc#newcode166 chrome/browser/extensions/user_script_listener_unittest.cc:166: request->SetUserData(NULL, new ThrottleDelegate(request.get(), throttle)); nit: ...
4 years ago (2016-12-06 18:53:44 UTC) #62
mmenke
https://codereview.chromium.org/2535723005/diff/200001/content/public/browser/resource_throttle.h File content/public/browser/resource_throttle.h (right): https://codereview.chromium.org/2535723005/diff/200001/content/public/browser/resource_throttle.h#newcode91 content/public/browser/resource_throttle.h:91: Delegate* delegate_; With the ResourceController dependency removed, you should ...
4 years ago (2016-12-06 20:16:42 UTC) #64
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2535723005/220001
4 years ago (2016-12-07 05:51:49 UTC) #69
tyoshino (SeeGerritForStatus)
https://codereview.chromium.org/2535723005/diff/200001/chrome/browser/extensions/user_script_listener_unittest.cc File chrome/browser/extensions/user_script_listener_unittest.cc (right): https://codereview.chromium.org/2535723005/diff/200001/chrome/browser/extensions/user_script_listener_unittest.cc#newcode166 chrome/browser/extensions/user_script_listener_unittest.cc:166: request->SetUserData(NULL, new ThrottleDelegate(request.get(), throttle)); On 2016/12/06 18:53:44, Reilly Grant ...
4 years ago (2016-12-07 05:52:16 UTC) #70
commit-bot: I haz the power
Committed patchset #6 (id:220001)
4 years ago (2016-12-07 07:40:43 UTC) #73
commit-bot: I haz the power
Patchset 6 (id:??) landed as https://crrev.com/64fa092bc4ccdcb1c0cc08b93d6c1bd49363adb0 Cr-Commit-Position: refs/heads/master@{#436889}
4 years ago (2016-12-07 07:42:41 UTC) #75
tyoshino (SeeGerritForStatus)
4 years ago (2016-12-07 08:34:24 UTC) #76
Message was sent while issue was closed.
https://codereview.chromium.org/2535723005/diff/200001/content/public/browser...
File content/public/browser/resource_throttle.h (right):

https://codereview.chromium.org/2535723005/diff/200001/content/public/browser...
content/public/browser/resource_throttle.h:91: Delegate* delegate_;
On 2016/12/07 05:52:15, tyoshino wrote:
> On 2016/12/06 20:16:42, mmenke wrote:
> > With the ResourceController dependency removed, you should remove
> > resource_controller from content/public, and move it into
> > content/browser/loader, since ResourceHandler isn't in content/public.
> 
> OK. Let me do it in the next CL.

Created https://codereview.chromium.org/2554273002/

Powered by Google App Engine
This is Rietveld 408576698