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

Issue 11027044: Add a class to replace ImageLoadingTracker with a nicer API. (Closed)

Created:
8 years, 2 months ago by Marijn Kruisselbrink
Modified:
8 years ago
CC:
chromium-reviews, mihaip-chromium-reviews_chromium.org, feature-media-reviews_chromium.org, mitchellwrosen
Visibility:
Public.

Description

Add a class to replace ImageLoadingTracker with a nicer API. This adds a new extensions::ImageLoader class, which mostly serves the same purpose as ImageLoadingTracker, but with some differences. It currently doesn't do any caching, and it uses callbacks instead of a delegate to pass the loaded image back to the caller. This should make this new class much nicer to use. Also ported some ILT usage to the new ImageLoader class. BUG=141673 Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=168155

Patch Set 1 #

Total comments: 20

Patch Set 2 : fix some small nits #

Patch Set 3 : move resource loading to UI thread, re-add loading from cache #

Total comments: 4

Patch Set 4 : return immediately if all images were cached #

Patch Set 5 : move from image_utils namespace to ImageLoader class #

Patch Set 6 : fix potential crash in ReplyBack part #

Total comments: 4

Patch Set 7 : SkBitmap* -> SkBitmap #

Total comments: 1

Patch Set 8 : rebase #

Patch Set 9 : remove caching, and change from singleton to ExtenionSystem member #

Total comments: 2

Patch Set 10 : remove unused code #

Total comments: 2

Patch Set 11 : change ImageLoader to be a PKS directly #

Patch Set 12 : add missing files #

Total comments: 8

Patch Set 13 : remove weak pointers from MediaStreamCaptureIndicator #

Patch Set 14 : rebase #

Patch Set 15 : fix build on windows and disable tests on android #

Patch Set 16 : rebase again #

Patch Set 17 : fix include order #

Total comments: 6
Unified diffs Side-by-side diffs Delta from patch set Stats (+620 lines, -528 lines) Patch
M build/android/gtest_filter/unit_tests_disabled View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +1 line, -0 lines 0 comments Download
M chrome/browser/background/background_application_list_model.cc View 1 2 3 4 5 6 7 8 9 10 6 chunks +8 lines, -13 lines 0 comments Download
M chrome/browser/extensions/extension_icon_image_unittest.cc View 1 2 3 4 5 6 7 8 10 chunks +21 lines, -25 lines 0 comments Download
M chrome/browser/extensions/extension_install_prompt.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 6 chunks +8 lines, -12 lines 0 comments Download
M chrome/browser/extensions/extension_install_prompt.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 4 chunks +10 lines, -10 lines 0 comments Download
M chrome/browser/extensions/extension_protocols.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 2 chunks +2 lines, -2 lines 0 comments Download
M chrome/browser/extensions/extension_system.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +3 lines, -2 lines 0 comments Download
M chrome/browser/extensions/extension_web_ui.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 3 chunks +77 lines, -106 lines 0 comments Download
A + chrome/browser/extensions/image_loader.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 5 chunks +51 lines, -124 lines 2 comments Download
A chrome/browser/extensions/image_loader.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 chunk +327 lines, -0 lines 4 comments Download
A + chrome/browser/extensions/image_loader_factory.h View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +13 lines, -12 lines 0 comments Download
A + chrome/browser/extensions/image_loader_factory.cc View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +18 lines, -16 lines 0 comments Download
A + chrome/browser/extensions/image_loader_unittest.cc View 1 2 3 4 5 6 7 8 10 chunks +36 lines, -51 lines 0 comments Download
M chrome/browser/extensions/image_loading_tracker.h View 1 2 1 chunk +0 lines, -8 lines 0 comments Download
M chrome/browser/extensions/image_loading_tracker.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 2 chunks +3 lines, -61 lines 0 comments Download
M chrome/browser/extensions/image_loading_tracker_unittest.cc View 1 2 1 chunk +0 lines, -21 lines 0 comments Download
M chrome/browser/extensions/navigation_observer.h View 1 chunk +1 line, -0 lines 0 comments Download
M chrome/browser/media/media_stream_capture_indicator.h View 1 2 3 4 5 6 7 8 9 10 11 12 5 chunks +4 lines, -17 lines 0 comments Download
M chrome/browser/media/media_stream_capture_indicator.cc View 1 2 3 4 5 6 7 8 9 10 11 12 7 chunks +20 lines, -23 lines 0 comments Download
M chrome/browser/ui/webui/extensions/extension_icon_source.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 4 chunks +4 lines, -11 lines 0 comments Download
M chrome/browser/ui/webui/extensions/extension_icon_source.cc View 1 2 3 4 5 6 7 8 9 10 11 12 4 chunks +8 lines, -14 lines 0 comments Download
M chrome/chrome_browser_extensions.gypi View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +4 lines, -0 lines 0 comments Download
M chrome/chrome_tests_unit.gypi View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 59 (0 generated)
Marijn Kruisselbrink
This is sort of a continuation of mitchelwrosen's patch, although the implementation is mostly rewritten ...
8 years, 2 months ago (2012-10-04 22:30:04 UTC) #1
Finnur
http://codereview.chromium.org/11027044/diff/1/chrome/browser/background/background_application_list_model.cc File chrome/browser/background/background_application_list_model.cc (right): http://codereview.chromium.org/11027044/diff/1/chrome/browser/background/background_application_list_model.cc#newcode159 chrome/browser/background/background_application_list_model.cc:159: base::Bind(&Application::OnImageLoaded, AsWeakPtr())); I suggest you add the people who ...
8 years, 2 months ago (2012-10-05 14:41:33 UTC) #2
Aaron Boodman
http://codereview.chromium.org/11027044/diff/1/chrome/browser/extensions/extension_install_prompt.h File chrome/browser/extensions/extension_install_prompt.h (right): http://codereview.chromium.org/11027044/diff/1/chrome/browser/extensions/extension_install_prompt.h#newcode243 chrome/browser/extensions/extension_install_prompt.h:243: void OnImageLoaded(const gfx::Image& image); On 2012/10/05 14:41:33, Finnur wrote: ...
8 years, 2 months ago (2012-10-05 16:46:03 UTC) #3
Finnur
I think this is one of those rules that someone instilled in me a long ...
8 years, 2 months ago (2012-10-05 17:59:06 UTC) #4
Marijn Kruisselbrink
tbarzic/xiyuan: while trying to simplify ImageLoadingTracker it seems to me that nearly every current user ...
8 years, 2 months ago (2012-10-05 18:00:08 UTC) #5
xiyuan
On 2012/10/05 18:00:08, Marijn Kruisselbrink wrote: > tbarzic/xiyuan: while trying to simplify ImageLoadingTracker it seems ...
8 years, 2 months ago (2012-10-05 18:35:33 UTC) #6
Aaron Boodman
I think we should remove the cache. This is wrong layer to implement, and I ...
8 years, 2 months ago (2012-10-05 18:47:35 UTC) #7
Marijn Kruisselbrink
On 2012/10/05 18:47:35, Aaron Boodman wrote: > I think we should remove the cache. > ...
8 years, 2 months ago (2012-10-05 21:23:29 UTC) #8
Aaron Boodman
On Fri, Oct 5, 2012 at 2:23 PM, <mek@chromium.org> wrote: > On 2012/10/05 18:47:35, Aaron ...
8 years, 2 months ago (2012-10-05 21:42:32 UTC) #9
Marijn Kruisselbrink
On 2012/10/05 21:42:32, Aaron Boodman wrote: > On Fri, Oct 5, 2012 at 2:23 PM, ...
8 years, 2 months ago (2012-10-05 22:50:04 UTC) #10
Marijn Kruisselbrink
In the latest patch set I moved loading of resources from the blocking pool back ...
8 years, 2 months ago (2012-10-08 17:30:34 UTC) #11
xiyuan
On 2012/10/08 17:30:34, Marijn Kruisselbrink wrote: > In the latest patch set I moved loading ...
8 years, 2 months ago (2012-10-08 17:35:44 UTC) #12
Aaron Boodman
On 2012/10/05 22:50:04, Marijn Kruisselbrink wrote: > On 2012/10/05 21:42:32, Aaron Boodman wrote: > > ...
8 years, 2 months ago (2012-10-08 18:36:11 UTC) #13
Aaron Boodman
After look at Xiyuan's code again, I'm worried that there will be no obvious place ...
8 years, 2 months ago (2012-10-08 19:00:31 UTC) #14
Marijn Kruisselbrink
On 2012/10/08 19:00:31, Aaron Boodman wrote: > So I change my mind again (sorry): I ...
8 years, 2 months ago (2012-10-08 20:24:51 UTC) #15
Marijn Kruisselbrink
okay, in my latest patchset I changed it from an extension_image_utils namespace to an extensions::ImageLoader ...
8 years, 2 months ago (2012-10-10 18:08:33 UTC) #16
xiyuan
I am not sure caching the images based on its size is a good idea. ...
8 years, 2 months ago (2012-10-10 20:30:22 UTC) #17
Marijn Kruisselbrink
On 2012/10/10 20:30:22, xiyuan wrote: > I am not sure caching the images based on ...
8 years, 2 months ago (2012-10-10 22:33:03 UTC) #18
xiyuan
On 2012/10/10 22:33:03, Marijn Kruisselbrink wrote: > I'm not sure when which caller would decide ...
8 years, 2 months ago (2012-10-11 00:41:08 UTC) #19
Aaron Boodman
On 2012/10/10 20:30:22, xiyuan wrote: > I am not sure caching the images based on ...
8 years, 2 months ago (2012-10-11 02:36:10 UTC) #20
Marijn Kruisselbrink
Since apparently every alternative way to do caching compared to the current situation has its ...
8 years, 2 months ago (2012-10-17 16:52:19 UTC) #21
xiyuan
On 2012/10/17 16:52:19, Marijn Kruisselbrink wrote: > Since apparently every alternative way to do caching ...
8 years, 2 months ago (2012-10-17 17:01:10 UTC) #22
Aaron Boodman
I'm fine removing caching entirely :). But, I also think my earlier proposal about having ...
8 years, 2 months ago (2012-10-17 17:15:13 UTC) #23
xiyuan
Let's forget about my preloading CL for now. Moving icon loading to blocking pool might ...
8 years, 2 months ago (2012-10-17 17:33:19 UTC) #24
Marijn Kruisselbrink
Okay, I now removed caching entirely again, but keeping ImageLoader as a class instead of ...
8 years, 1 month ago (2012-10-25 21:13:54 UTC) #25
xiyuan
LGTM Thank you for making the changes. http://codereview.chromium.org/11027044/diff/34001/chrome/browser/extensions/image_loader.cc File chrome/browser/extensions/image_loader.cc (right): http://codereview.chromium.org/11027044/diff/34001/chrome/browser/extensions/image_loader.cc#newcode28 chrome/browser/extensions/image_loader.cc:28: std::string SizeToString(const ...
8 years, 1 month ago (2012-10-26 01:11:57 UTC) #26
Marijn Kruisselbrink
aa: what do you think of the current patch (ImageLoader class without caching)? http://codereview.chromium.org/11027044/diff/34001/chrome/browser/extensions/image_loader.cc File ...
8 years, 1 month ago (2012-10-30 23:11:07 UTC) #27
Aaron Boodman
I think it's fantastic. When can ILT be deleted? :) http://codereview.chromium.org/11027044/diff/42001/chrome/browser/extensions/extension_install_prompt.cc File chrome/browser/extensions/extension_install_prompt.cc (right): http://codereview.chromium.org/11027044/diff/42001/chrome/browser/extensions/extension_install_prompt.cc#newcode555 ...
8 years, 1 month ago (2012-10-31 07:38:22 UTC) #28
Marijn Kruisselbrink
http://codereview.chromium.org/11027044/diff/42001/chrome/browser/extensions/extension_install_prompt.cc File chrome/browser/extensions/extension_install_prompt.cc (right): http://codereview.chromium.org/11027044/diff/42001/chrome/browser/extensions/extension_install_prompt.cc#newcode555 chrome/browser/extensions/extension_install_prompt.cc:555: extensions::ExtensionSystem::Get(profile_)->image_loader()->LoadImageAsync( On 2012/10/31 07:38:22, Aaron Boodman wrote: > I ...
8 years, 1 month ago (2012-10-31 21:22:59 UTC) #29
Yoyo Zhou
On 2012/10/31 21:22:59, Marijn Kruisselbrink wrote: > http://codereview.chromium.org/11027044/diff/42001/chrome/browser/extensions/extension_install_prompt.cc > File chrome/browser/extensions/extension_install_prompt.cc (right): > > http://codereview.chromium.org/11027044/diff/42001/chrome/browser/extensions/extension_install_prompt.cc#newcode555 ...
8 years, 1 month ago (2012-11-01 17:53:40 UTC) #30
Marijn Kruisselbrink
On 2012/11/01 17:53:40, Yoyo Zhou wrote: > image_loader_factory looks missing from your CL. Oops, added.
8 years, 1 month ago (2012-11-01 18:01:12 UTC) #31
Aaron Boodman
lgtm http://codereview.chromium.org/11027044/diff/49024/chrome/browser/extensions/image_loader_factory.h File chrome/browser/extensions/image_loader_factory.h (right): http://codereview.chromium.org/11027044/diff/49024/chrome/browser/extensions/image_loader_factory.h#newcode15 chrome/browser/extensions/image_loader_factory.h:15: class ImageLoader; Can you please create a class ...
8 years, 1 month ago (2012-11-08 21:07:22 UTC) #32
Marijn Kruisselbrink
On 2012/11/08 21:07:22, Aaron Boodman wrote: > lgtm > > http://codereview.chromium.org/11027044/diff/49024/chrome/browser/extensions/image_loader_factory.h > File chrome/browser/extensions/image_loader_factory.h (right): ...
8 years, 1 month ago (2012-11-08 23:59:35 UTC) #33
Yoyo Zhou
On 2012/11/08 23:59:35, Marijn Kruisselbrink wrote: > On 2012/11/08 21:07:22, Aaron Boodman wrote: > > ...
8 years, 1 month ago (2012-11-09 00:14:24 UTC) #34
Marijn Kruisselbrink
for OWNERS reviews: atwilson -> chrome/browser/background/ xians -> chrome/browser/media/ jhawkins -> chrome/browser/ui/webui/extensions/
8 years, 1 month ago (2012-11-09 17:39:55 UTC) #35
James Hawkins
webui lgtm
8 years, 1 month ago (2012-11-09 17:42:21 UTC) #36
no longer working on chromium
http://codereview.chromium.org/11027044/diff/49024/chrome/browser/media/media_stream_capture_indicator.cc File chrome/browser/media/media_stream_capture_indicator.cc (right): http://codereview.chromium.org/11027044/diff/49024/chrome/browser/media/media_stream_capture_indicator.cc#newcode129 chrome/browser/media/media_stream_capture_indicator.cc:129: icon_tracker_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { Without looking the details, just want to ...
8 years, 1 month ago (2012-11-09 19:07:10 UTC) #37
Marijn Kruisselbrink
http://codereview.chromium.org/11027044/diff/49024/chrome/browser/media/media_stream_capture_indicator.cc File chrome/browser/media/media_stream_capture_indicator.cc (right): http://codereview.chromium.org/11027044/diff/49024/chrome/browser/media/media_stream_capture_indicator.cc#newcode129 chrome/browser/media/media_stream_capture_indicator.cc:129: icon_tracker_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { On 2012/11/09 19:07:10, xians1 wrote: > Without ...
8 years, 1 month ago (2012-11-10 00:19:19 UTC) #38
Andrew T Wilson (Slow)
browser/background LGTM
8 years, 1 month ago (2012-11-13 08:41:20 UTC) #39
no longer working on chromium
http://codereview.chromium.org/11027044/diff/49024/chrome/browser/media/media_stream_capture_indicator.cc File chrome/browser/media/media_stream_capture_indicator.cc (right): http://codereview.chromium.org/11027044/diff/49024/chrome/browser/media/media_stream_capture_indicator.cc#newcode129 chrome/browser/media/media_stream_capture_indicator.cc:129: icon_tracker_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { On 2012/11/10 00:19:19, Marijn Kruisselbrink wrote: > ...
8 years, 1 month ago (2012-11-13 15:17:29 UTC) #40
Marijn Kruisselbrink
http://codereview.chromium.org/11027044/diff/49024/chrome/browser/media/media_stream_capture_indicator.cc File chrome/browser/media/media_stream_capture_indicator.cc (right): http://codereview.chromium.org/11027044/diff/49024/chrome/browser/media/media_stream_capture_indicator.cc#newcode129 chrome/browser/media/media_stream_capture_indicator.cc:129: icon_tracker_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { On 2012/11/13 15:17:29, xians1 wrote: > On ...
8 years, 1 month ago (2012-11-14 17:35:27 UTC) #41
no longer working on chromium
chrome/browser/media lgtm
8 years, 1 month ago (2012-11-15 16:12:55 UTC) #42
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/mek@chromium.org/11027044/59001
8 years, 1 month ago (2012-11-15 16:14:21 UTC) #43
commit-bot: I haz the power
Failed to apply patch for chrome/browser/extensions/extension_install_prompt.h: While running patch -p1 --forward --force --no-backup-if-mismatch; patching file ...
8 years, 1 month ago (2012-11-15 16:14:35 UTC) #44
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/mek@chromium.org/11027044/65001
8 years, 1 month ago (2012-11-15 18:52:03 UTC) #45
commit-bot: I haz the power
Sorry for I got bad news for ya. Compile failed with a clobber build on ...
8 years, 1 month ago (2012-11-15 19:52:22 UTC) #46
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/mek@chromium.org/11027044/39002
8 years, 1 month ago (2012-11-15 19:52:28 UTC) #47
commit-bot: I haz the power
Failed to apply patch for chrome/browser/extensions/image_loading_tracker.cc: While running patch -p1 --forward --force --no-backup-if-mismatch; patching file ...
8 years, 1 month ago (2012-11-15 19:52:37 UTC) #48
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/mek@chromium.org/11027044/43048
8 years, 1 month ago (2012-11-15 20:09:30 UTC) #49
commit-bot: I haz the power
Presubmit check for 11027044-43048 failed and returned exit status 1. Running presubmit commit checks ...
8 years, 1 month ago (2012-11-15 20:09:50 UTC) #50
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/mek@chromium.org/11027044/43049
8 years, 1 month ago (2012-11-15 20:43:58 UTC) #51
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/mek@chromium.org/11027044/43049
8 years, 1 month ago (2012-11-16 04:25:54 UTC) #52
commit-bot: I haz the power
Change committed as 168155
8 years, 1 month ago (2012-11-16 07:40:50 UTC) #53
Aaron Boodman
https://chromiumcodereview.appspot.com/11027044/diff/43049/chrome/browser/extensions/image_loader.cc File chrome/browser/extensions/image_loader.cc (right): https://chromiumcodereview.appspot.com/11027044/diff/43049/chrome/browser/extensions/image_loader.cc#newcode251 chrome/browser/extensions/image_loader.cc:251: base::Bind(&ImageLoader::LoadImagesOnBlockingPool, base::Unretained(this), What prevents this callback from happening after ...
8 years, 1 month ago (2012-11-20 21:46:13 UTC) #54
Marijn Kruisselbrink
https://chromiumcodereview.appspot.com/11027044/diff/43049/chrome/browser/extensions/image_loader.cc File chrome/browser/extensions/image_loader.cc (right): https://chromiumcodereview.appspot.com/11027044/diff/43049/chrome/browser/extensions/image_loader.cc#newcode251 chrome/browser/extensions/image_loader.cc:251: base::Bind(&ImageLoader::LoadImagesOnBlockingPool, base::Unretained(this), On 2012/11/20 21:46:14, Aaron Boodman wrote: > ...
8 years, 1 month ago (2012-11-20 21:51:03 UTC) #55
Aaron Boodman
https://chromiumcodereview.appspot.com/11027044/diff/43049/chrome/browser/extensions/image_loader.cc File chrome/browser/extensions/image_loader.cc (right): https://chromiumcodereview.appspot.com/11027044/diff/43049/chrome/browser/extensions/image_loader.cc#newcode251 chrome/browser/extensions/image_loader.cc:251: base::Bind(&ImageLoader::LoadImagesOnBlockingPool, base::Unretained(this), On 2012/11/20 21:51:03, Marijn Kruisselbrink wrote: > ...
8 years, 1 month ago (2012-11-21 00:57:21 UTC) #56
Marijn Kruisselbrink
https://chromiumcodereview.appspot.com/11027044/diff/43049/chrome/browser/extensions/image_loader.cc File chrome/browser/extensions/image_loader.cc (right): https://chromiumcodereview.appspot.com/11027044/diff/43049/chrome/browser/extensions/image_loader.cc#newcode251 chrome/browser/extensions/image_loader.cc:251: base::Bind(&ImageLoader::LoadImagesOnBlockingPool, base::Unretained(this), On 2012/11/21 00:57:21, Aaron Boodman wrote: > ...
8 years, 1 month ago (2012-11-21 01:17:55 UTC) #57
kaiwang
https://chromiumcodereview.appspot.com/11027044/diff/43049/chrome/browser/extensions/image_loader.h File chrome/browser/extensions/image_loader.h (right): https://chromiumcodereview.appspot.com/11027044/diff/43049/chrome/browser/extensions/image_loader.h#newcode83 chrome/browser/extensions/image_loader.h:83: // if the image was found in the cache. ...
8 years ago (2012-11-29 03:57:37 UTC) #58
Marijn Kruisselbrink
8 years ago (2012-11-29 15:51:39 UTC) #59
Message was sent while issue was closed.
https://chromiumcodereview.appspot.com/11027044/diff/43049/chrome/browser/ext...
File chrome/browser/extensions/image_loader.h (right):

https://chromiumcodereview.appspot.com/11027044/diff/43049/chrome/browser/ext...
chrome/browser/extensions/image_loader.h:83: // if the image was found in the
cache.
On 2012/11/29 03:57:37, kaiwang wrote:
> Looking at the code, I think the callback is always run asynchronously?
Yeah, that's true; at the moment the callback is always run asynchronously. If
caching gets re-added in the future we'll at least keep the option of calling
the callback synchronously though. So I don't see a compelling reason to remove
this restriction evn though currently it is not being used.

Powered by Google App Engine
This is Rietveld 408576698