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

Unified Diff: chrome/browser/cocoa/extensions/browser_action_button.mm

Issue 1075006: Eliminate all UI thread decoding of extension images.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/cocoa/extensions/extension_action_context_menu.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/cocoa/extensions/browser_action_button.mm
===================================================================
--- chrome/browser/cocoa/extensions/browser_action_button.mm (revision 42429)
+++ chrome/browser/cocoa/extensions/browser_action_button.mm (working copy)
@@ -42,13 +42,12 @@
public:
ExtensionImageTrackerBridge(BrowserActionButton* owner, Extension* extension)
: owner_(owner),
- tracker_(NULL) {
+ tracker_(this) {
// The Browser Action API does not allow the default icon path to be
// changed at runtime, so we can load this now and cache it.
std::string path = extension->browser_action()->default_icon_path();
if (!path.empty()) {
- tracker_ = new ImageLoadingTracker(this, 1);
- tracker_->PostLoadImageTask(extension->GetResource(path),
+ tracker_.LoadImage(extension->GetResource(path),
gfx::Size(Extension::kBrowserActionIconMaxSize,
Extension::kBrowserActionIconMaxSize));
}
@@ -57,15 +56,12 @@
}
~ExtensionImageTrackerBridge() {
- if (tracker_)
- tracker_->StopTrackingImageLoad();
}
// ImageLoadingTracker::Observer implementation.
- void OnImageLoaded(SkBitmap* image, size_t index) {
+ void OnImageLoaded(SkBitmap* image, ExtensionResource resource, int index) {
if (image)
[owner_ setDefaultIcon:gfx::SkBitmapToNSImage(*image)];
- tracker_ = NULL;
[owner_ updateState];
}
@@ -83,8 +79,8 @@
// Weak. Owns us.
BrowserActionButton* owner_;
- // Loads the button's icons for us on the file thread. Weak.
- ImageLoadingTracker* tracker_;
+ // Loads the button's icons for us on the file thread.
+ ImageLoadingTracker tracker_;
// Used for registering to receive notifications and automatic clean up.
NotificationRegistrar registrar_;
« no previous file with comments | « no previous file | chrome/browser/cocoa/extensions/extension_action_context_menu.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698