diff options
author | finnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-24 16:00:34 +0000 |
---|---|---|
committer | finnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-24 16:00:34 +0000 |
commit | 699e1cd56df7b6f775601c80e99d26f83162a412 (patch) | |
tree | 22d80a14e0ddd552731daac0be3aa2e6dc8bd9ec /chrome/browser/gtk/location_bar_view_gtk.cc | |
parent | bfae5e6625d0b3cd38d1b7481a12f6a177a2fbde (diff) | |
download | chromium_src-699e1cd56df7b6f775601c80e99d26f83162a412.zip chromium_src-699e1cd56df7b6f775601c80e99d26f83162a412.tar.gz chromium_src-699e1cd56df7b6f775601c80e99d26f83162a412.tar.bz2 |
Eliminate all UI thread decoding of extension images.
Except one, that is. We have one location we need to
take a look at (I've added a comment). This changelist
converts UI usage of DecodeImage on the UI thread to
a revamped and simplified ImageLoadingTracker class.
I plan on adding to GetFilePath a DCHECK for the File
thread but decided to do so in another changelist,
since it has a high likelyhood of flushing something
out and be backed out because of that. This started
out as issue 38521 (make infobar use cached icons)
but grew in scope to just eliminate all UI thread
access to DecodeImage and GetFilePath.
BUG=http://crbug.com/38521
TEST=None (extensions should work as before)
Review URL: http://codereview.chromium.org/1075006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42471 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/gtk/location_bar_view_gtk.cc')
-rw-r--r-- | chrome/browser/gtk/location_bar_view_gtk.cc | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/chrome/browser/gtk/location_bar_view_gtk.cc b/chrome/browser/gtk/location_bar_view_gtk.cc index 541d01e..a764b3d 100644 --- a/chrome/browser/gtk/location_bar_view_gtk.cc +++ b/chrome/browser/gtk/location_bar_view_gtk.cc @@ -1057,6 +1057,7 @@ LocationBarViewGtk::PageActionViewGtk::PageActionViewGtk( 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 @@ LocationBarViewGtk::PageActionViewGtk::PageActionViewGtk( 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::UpdateVisibility( } } -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 @@ void LocationBarViewGtk::PageActionViewGtk::OnImageLoaded(SkBitmap* image, // 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(); } |