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

Unified Diff: chrome/browser/gtk/location_bar_view_gtk.cc

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 | « chrome/browser/gtk/location_bar_view_gtk.h ('k') | chrome/browser/views/browser_actions_container.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/gtk/location_bar_view_gtk.cc
===================================================================
--- chrome/browser/gtk/location_bar_view_gtk.cc (revision 42429)
+++ chrome/browser/gtk/location_bar_view_gtk.cc (working copy)
@@ -1057,6 +1057,7 @@
profile_(profile),
page_action_(page_action),
last_icon_pixbuf_(NULL),
+ tracker_(this),
preview_enabled_(false) {
event_box_.Own(gtk_event_box_new());
gtk_widget_set_size_request(event_box_.get(),
@@ -1083,19 +1084,15 @@
if (!page_action_->default_icon_path().empty())
icon_paths.push_back(page_action_->default_icon_path());
- tracker_ = new ImageLoadingTracker(this, icon_paths.size());
for (std::vector<std::string>::iterator iter = icon_paths.begin();
iter != icon_paths.end(); ++iter) {
- tracker_->PostLoadImageTask(
- extension->GetResource(*iter),
- gfx::Size(Extension::kPageActionIconMaxSize,
- Extension::kPageActionIconMaxSize));
+ tracker_.LoadImage(extension->GetResource(*iter),
+ gfx::Size(Extension::kPageActionIconMaxSize,
+ Extension::kPageActionIconMaxSize));
}
}
LocationBarViewGtk::PageActionViewGtk::~PageActionViewGtk() {
- if (tracker_)
- tracker_->StopTrackingImageLoad();
image_.Destroy();
event_box_.Destroy();
for (PixbufMap::iterator iter = pixbufs_.begin(); iter != pixbufs_.end();
@@ -1178,11 +1175,11 @@
}
}
-void LocationBarViewGtk::PageActionViewGtk::OnImageLoaded(SkBitmap* image,
- size_t index) {
+void LocationBarViewGtk::PageActionViewGtk::OnImageLoaded(
+ SkBitmap* image, ExtensionResource resource, int index) {
// We loaded icons()->size() icons, plus one extra if the page action had
// a default icon.
- size_t total_icons = page_action_->icon_paths()->size();
+ int total_icons = static_cast<int>(page_action_->icon_paths()->size());
if (!page_action_->default_icon_path().empty())
total_icons++;
DCHECK(index < total_icons);
@@ -1191,16 +1188,12 @@
// index greater than the number of icons, it must be the default icon.
if (image) {
GdkPixbuf* pixbuf = gfx::GdkPixbufFromSkBitmap(image);
- if (index < page_action_->icon_paths()->size())
+ if (index < static_cast<int>(page_action_->icon_paths()->size()))
pixbufs_[page_action_->icon_paths()->at(index)] = pixbuf;
else
pixbufs_[page_action_->default_icon_path()] = pixbuf;
}
- // If we are done, release the tracker.
- if (index == (total_icons - 1))
- tracker_ = NULL;
-
owner_->UpdatePageActions();
}
« no previous file with comments | « chrome/browser/gtk/location_bar_view_gtk.h ('k') | chrome/browser/views/browser_actions_container.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698