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

Issue 787903003: Upstream image_fetcher::ImageFetcher (Closed)

Created:
6 years ago by sdefresne
Modified:
6 years ago
Reviewers:
droger, mef, Ryan Sleevi
CC:
cbentzel+watch_chromium.org, chromium-reviews
Base URL:
https://chromium.googlesource.com/chromium/src.git@436897
Project:
chromium
Visibility:
Public.

Description

Upstream image_fetcher::ImageFetcher This class is a wrapper around net::URLFetcherDelegate that is designed specifically to fetch images. It will transcode WebP encoded images. BUG=436897, 441327 Committed: https://crrev.com/80483075c0039a6c312ed99891bcefe52f79cb92 Cr-Commit-Position: refs/heads/master@{#308116}

Patch Set 1 #

Patch Set 2 : git cl upload --no-find-copies, fix indentation and minor cleanup #

Total comments: 1

Patch Set 3 : Address comments #

Patch Set 4 : Fix compilation with Xcode 5.1 by adding ugly casts #

Total comments: 37
Unified diffs Side-by-side diffs Delta from patch set Stats (+472 lines, -12 lines) Patch
A + ios/chrome/DEPS View 3 0 chunks +-1 lines, --1 lines 0 comments Download
A + ios/chrome/OWNERS View 3 0 chunks +-1 lines, --1 lines 0 comments Download
A ios/chrome/browser/net/image_fetcher.h View 1 chunk +88 lines, -0 lines 12 comments Download
A ios/chrome/browser/net/image_fetcher.mm View 1 1 chunk +176 lines, -0 lines 15 comments Download
A ios/chrome/browser/net/image_fetcher_unittest.mm View 1 2 3 1 chunk +190 lines, -0 lines 10 comments Download
A + ios/chrome/ios_chrome.gyp View 3 1 chunk +11 lines, -7 lines 0 comments Download
A + ios/chrome/ios_chrome_tests.gyp View 1 3 1 chunk +8 lines, -7 lines 0 comments Download
M ios/ios.gyp View 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 23 (8 generated)
sdefresne
droger: please take a look rsleevi: OWNERS for new dependency on //net
6 years ago (2014-12-11 16:19:57 UTC) #2
droger
LGTM I did not review the image_fetcher code in detail, since it is direct upstreaming. ...
6 years ago (2014-12-11 16:28:32 UTC) #3
sdefresne
On 2014/12/11 at 16:28:32, droger wrote: > LGTM > > I did not review the ...
6 years ago (2014-12-11 16:48:03 UTC) #4
sdefresne
-rsleevi (overloaded), +mef: need OWNERS approval for adding DEPS on //net
6 years ago (2014-12-12 14:23:39 UTC) #6
mef
lgtm for adding DEPS on //net
6 years ago (2014-12-12 14:50:58 UTC) #7
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/787903003/40001
6 years ago (2014-12-12 16:17:50 UTC) #9
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/787903003/40001
6 years ago (2014-12-12 16:18:42 UTC) #12
commit-bot: I haz the power
Try jobs failed on following builders: ios_rel_device_ninja on tryserver.chromium.mac (http://build.chromium.org/p/tryserver.chromium.mac/builders/ios_rel_device_ninja/builds/36035)
6 years ago (2014-12-12 16:30:48 UTC) #14
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/787903003/60001
6 years ago (2014-12-12 16:50:13 UTC) #16
commit-bot: I haz the power
Committed patchset #4 (id:60001)
6 years ago (2014-12-12 17:46:35 UTC) #17
commit-bot: I haz the power
Patchset 4 (id:??) landed as https://crrev.com/80483075c0039a6c312ed99891bcefe52f79cb92 Cr-Commit-Position: refs/heads/master@{#308116}
6 years ago (2014-12-12 17:48:43 UTC) #18
Ryan Sleevi
A number of issues for follow-up. https://codereview.chromium.org/787903003/diff/60001/ios/chrome/browser/net/image_fetcher.h File ios/chrome/browser/net/image_fetcher.h (right): https://codereview.chromium.org/787903003/diff/60001/ios/chrome/browser/net/image_fetcher.h#newcode26 ios/chrome/browser/net/image_fetcher.h:26: typedef void (^Callback)(const ...
6 years ago (2014-12-12 23:32:01 UTC) #20
sdefresne
On 2014/12/12 at 23:32:01, rsleevi wrote: > A number of issues for follow-up. > > ...
6 years ago (2014-12-13 10:47:20 UTC) #21
sdefresne
Followup CL: https://codereview.chromium.org/805713004 https://codereview.chromium.org/787903003/diff/60001/ios/chrome/browser/net/image_fetcher.h File ios/chrome/browser/net/image_fetcher.h (right): https://codereview.chromium.org/787903003/diff/60001/ios/chrome/browser/net/image_fetcher.h#newcode26 ios/chrome/browser/net/image_fetcher.h:26: typedef void (^Callback)(const GURL& url, int ...
6 years ago (2014-12-15 13:11:58 UTC) #22
Ryan Sleevi
6 years ago (2014-12-15 20:40:39 UTC) #23
Message was sent while issue was closed.
Consider one suggestion, below, in response to the use of SequencedWorkerPool.

This is more a design nit than anything, but I just wanted to make sure the
justification was understood.

https://codereview.chromium.org/787903003/diff/60001/ios/chrome/browser/net/i...
File ios/chrome/browser/net/image_fetcher.h (right):

https://codereview.chromium.org/787903003/diff/60001/ios/chrome/browser/net/i...
ios/chrome/browser/net/image_fetcher.h:38: const
scoped_refptr<base::SequencedWorkerPool> decoding_pool);
On 2014/12/15 13:11:58, sdefresne wrote:
> On 2014/12/12 at 23:32:00, Ryan Sleevi wrote:
> > Pass as const-ref, not const. Avoid refcount churn.
> 
> Done.
> 
> > DESIGN: Prefer passing in a SequencedTaskRunner, rather than a worker pool.
> Only use pools if you're creating them yourself.
> > 
> > You can get a SequencedTaskRunner from a given pool by creating an STR for a
> token you supply.
> > 
> > This allows callers to avoid instantiating a pool if they would rather use a
> dedicated/common thread, and makes it easier for tests (which can then just
test
> on the main thread).
> 
> We want a pool since some of our clients uses a single ImageFetcher to fetch
> multiple images and we'd like the decoding to be done in parallel if possible
> (i.e. if the pool has multiple thread). We cannot use
> web::WebThread::GetBlockingPool() since it is not initialized during unit
tests
> (need to create web::TestWebThread and web::TestWebThreadBundle for that).
> Created http://crbug.com/442292 to track this.

If you want requests to happen serially, but on any thread, you can use the
SequencedTaskRunner from the SWP with a given token.
If you want requests to happen in parallel, then you can just pass in a
TaskRunner (which a SequencedWorkerPool is). Tasks may be started at any time
(e.g. while other tasks are running), which matches your stated preference.

Both of these interfaces avoid needing to directly depend on a
SequencedWorkerPool.

That is, you should consider SequencedWorkerPool to be an implementation detail,
and instead code against the interfaces that express the API contract you want.
SequencedWorkerPool may be one way to fill that, but it doesn't have to be the
only way.

Powered by Google App Engine
This is Rietveld 408576698