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

Issue 10578055: Rewrite guts of ResourceLoader and BufferedResourceHandler to suck less. (Closed)

Created:
8 years, 6 months ago by darin (slow to review)
Modified:
8 years, 5 months ago
Reviewers:
jam
CC:
chromium-reviews, joi+watch-content_chromium.org, darin-cc_chromium.org, jam, rdsmith+dwatch_chromium.org, jochen+watch-content_chromium.org
Visibility:
Public.

Description

Rewrite guts of ResourceLoader and BufferedResourceHandler to suck less. The key change is to the pause/resume behavior. ResourceHandlers are now expected to consume events they receive. They can only defer subsequent processing. It used to be the case that pausing during OnReadCompleted would lead to repeating the call to OnReadCompleted when resumed. This was quite problematic for chained ResourceHandlers. BufferedResourceHandler is now the ResourceController for its downstream ResourceHandler. This enables the ResourceLoader and the BufferedResourceHandler to be more cleanly decoupled. The BufferedResourceHandler buffers network events, determines the mime type of the response, selects the appropriate downstream ResourceHandler, and then it replays the network events. It can now do this independently of the ResourceLoader state machine. OnReadCompleted no longer has an in/out bytes_read parameter. This was used before in a very complicated way by the BufferedResourceHandler to effect the bytes_read parameter of future calls to OnReadCompleted (see the now deleted ResourceLoader::paused_bytes_read_ member variable). ResourceLoader gets a lot simpler and loses a lot of state variables. It no longer needs to track things like pause_count_ or paused_read_bytes_. is_paused_, called_on_response_started_ and has_started_reading_ are all subsumed by deferred_stage_. BufferedResourceLoader is modified extensively to hopefully separate out the states more logically. It now advances through buffering (withholds events from the downstream handler), processing (detects mime type and selects downstream handler), replaying (feeding downstream handler with buffered events) and finally streaming (acts like a simple pass-through) states. R=jam@chromium.org Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=144873

Patch Set 1 #

Patch Set 2 : #

Patch Set 3 : #

Patch Set 4 : #

Patch Set 5 : #

Patch Set 6 : #

Patch Set 7 : #

Patch Set 8 : #

Patch Set 9 : #

Patch Set 10 : #

Patch Set 11 : #

Patch Set 12 : #

Patch Set 13 : #

Total comments: 5

Patch Set 14 : #

Unified diffs Side-by-side diffs Delta from patch set Stats (+457 lines, -553 lines) Patch
M content/browser/download/download_resource_handler.h View 1 2 3 4 5 6 7 8 9 10 1 chunk +1 line, -1 line 0 comments Download
M content/browser/download/download_resource_handler.cc View 1 2 3 4 5 6 7 8 9 10 2 chunks +6 lines, -12 lines 0 comments Download
M content/browser/download/save_file_resource_handler.h View 1 2 3 4 5 6 7 8 9 10 1 chunk +1 line, -1 line 0 comments Download
M content/browser/download/save_file_resource_handler.cc View 1 2 3 4 5 6 7 8 9 10 2 chunks +2 lines, -2 lines 0 comments Download
M content/browser/renderer_host/async_resource_handler.h View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +2 lines, -2 lines 0 comments Download
M content/browser/renderer_host/async_resource_handler.cc View 1 2 3 4 5 6 7 8 9 10 11 4 chunks +8 lines, -21 lines 0 comments Download
M content/browser/renderer_host/buffered_resource_handler.h View 1 2 3 4 5 6 7 8 9 10 4 chunks +47 lines, -41 lines 0 comments Download
M content/browser/renderer_host/buffered_resource_handler.cc View 1 2 3 4 5 6 7 8 9 10 4 chunks +258 lines, -262 lines 0 comments Download
M content/browser/renderer_host/cross_site_resource_handler.h View 1 2 3 4 5 6 7 8 9 10 1 chunk +1 line, -1 line 0 comments Download
M content/browser/renderer_host/cross_site_resource_handler.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +1 line, -1 line 0 comments Download
M content/browser/renderer_host/doomed_resource_handler.h View 1 2 3 4 5 6 7 8 9 10 1 chunk +1 line, -1 line 0 comments Download
M content/browser/renderer_host/doomed_resource_handler.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +1 line, -1 line 0 comments Download
M content/browser/renderer_host/layered_resource_handler.h View 1 2 3 4 5 6 7 8 9 10 1 chunk +1 line, -1 line 0 comments Download
M content/browser/renderer_host/layered_resource_handler.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +1 line, -1 line 0 comments Download
M content/browser/renderer_host/redirect_to_file_resource_handler.h View 1 2 3 4 5 6 7 8 9 10 1 chunk +1 line, -1 line 0 comments Download
M content/browser/renderer_host/redirect_to_file_resource_handler.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +3 lines, -13 lines 0 comments Download
M content/browser/renderer_host/resource_dispatcher_host_unittest.cc View 1 2 3 4 5 6 7 8 9 10 2 chunks +28 lines, -0 lines 0 comments Download
M content/browser/renderer_host/resource_handler.h View 1 2 3 4 5 6 7 8 9 10 2 chunks +3 lines, -5 lines 0 comments Download
M content/browser/renderer_host/resource_loader.h View 1 2 3 4 5 6 7 8 9 10 11 12 3 chunks +8 lines, -15 lines 0 comments Download
M content/browser/renderer_host/resource_loader.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 9 chunks +74 lines, -162 lines 0 comments Download
M content/browser/renderer_host/sync_resource_handler.h View 1 2 3 4 5 6 7 8 9 10 1 chunk +1 line, -1 line 0 comments Download
M content/browser/renderer_host/sync_resource_handler.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +3 lines, -3 lines 0 comments Download
M content/browser/renderer_host/x509_user_cert_resource_handler.h View 1 2 3 4 5 6 7 8 9 10 1 chunk +1 line, -1 line 0 comments Download
M content/browser/renderer_host/x509_user_cert_resource_handler.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +4 lines, -4 lines 0 comments Download

Messages

Total messages: 6 (0 generated)
darin (slow to review)
http://codereview.chromium.org/10578055/diff/38006/content/browser/renderer_host/async_resource_handler.cc File content/browser/renderer_host/async_resource_handler.cc (right): http://codereview.chromium.org/10578055/diff/38006/content/browser/renderer_host/async_resource_handler.cc#newcode316 content/browser/renderer_host/async_resource_handler.cc:316: if (++pending_data_count_ >= kMaxPendingDataMessages) { NOTE: This change results ...
8 years, 5 months ago (2012-06-28 21:49:53 UTC) #1
jam
lgtm
8 years, 5 months ago (2012-06-28 23:27:07 UTC) #2
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/darin@chromium.org/10578055/27012
8 years, 5 months ago (2012-06-28 23:57:44 UTC) #3
commit-bot: I haz the power
Try job failure for 10578055-27012 (retry) on linux_rel for step "interactive_ui_tests". It's a second try, ...
8 years, 5 months ago (2012-06-29 00:54:10 UTC) #4
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/darin@chromium.org/10578055/27012
8 years, 5 months ago (2012-06-29 03:33:18 UTC) #5
commit-bot: I haz the power
8 years, 5 months ago (2012-06-29 04:45:04 UTC) #6
Change committed as 144873

Powered by Google App Engine
This is Rietveld 408576698