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

Unified Diff: chrome/browser/views/browser_actions_container.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
Index: chrome/browser/views/browser_actions_container.cc
===================================================================
--- chrome/browser/views/browser_actions_container.cc (revision 42362)
+++ chrome/browser/views/browser_actions_container.cc (working copy)
@@ -98,7 +98,7 @@
: ALLOW_THIS_IN_INITIALIZER_LIST(MenuButton(this, L"", NULL, false)),
browser_action_(extension->browser_action()),
extension_(extension),
- tracker_(NULL),
+ ALLOW_THIS_IN_INITIALIZER_LIST(tracker_(this)),
showing_context_menu_(false),
panel_(panel) {
set_alignment(TextButton::ALIGN_CENTER);
@@ -120,16 +120,14 @@
// will crash. But since we know that ImageLoadingTracker is asynchronous,
// this should be OK. And doing this in the constructor means that we don't
// have to protect against it getting done multiple times.
- tracker_ = new ImageLoadingTracker(this, 1);
- tracker_->PostLoadImageTask(
+ tracker_.PostLoadImageTask(
extension->GetResource(relative_path),
gfx::Size(Extension::kBrowserActionIconMaxSize,
- Extension::kBrowserActionIconMaxSize));
+ Extension::kBrowserActionIconMaxSize),
+ 0); // |index| == 0, since we only ever load one image.
}
BrowserActionButton::~BrowserActionButton() {
- if (tracker_)
- tracker_->StopTrackingImageLoad();
}
gfx::Insets BrowserActionButton::GetInsets() const {
@@ -142,12 +140,10 @@
panel_->OnBrowserActionExecuted(this, false); // inspect_with_devtools
}
-void BrowserActionButton::OnImageLoaded(SkBitmap* image, size_t index) {
+void BrowserActionButton::OnImageLoaded(SkBitmap* image, int index) {
if (image)
default_icon_ = *image;
- tracker_ = NULL; // The tracker object will delete itself when we return.
-
// Call back to UpdateState() because a more specific icon might have been set
// while the load was outstanding.
UpdateState();
@@ -207,7 +203,7 @@
bool BrowserActionButton::Activate() {
if (IsPopup()) {
- panel_->OnBrowserActionExecuted(this, false); // inspect_with_devtools
+ panel_->OnBrowserActionExecuted(this, false); // |inspect_with_devtools|.
// TODO(erikkay): Run a nested modal loop while the mouse is down to
// enable menu-like drag-select behavior.
@@ -511,7 +507,7 @@
void BrowserActionsContainer::TestExecuteBrowserAction(int index) {
BrowserActionButton* button = browser_action_views_[index]->button();
- OnBrowserActionExecuted(button, false); // inspect_with_devtools
+ OnBrowserActionExecuted(button, false); // |inspect_with_devtools|.
}
void BrowserActionsContainer::TestSetIconVisibilityCount(size_t icons) {
@@ -1114,7 +1110,7 @@
void BrowserActionsContainer::InspectPopup(
ExtensionAction* action) {
OnBrowserActionExecuted(GetBrowserActionView(action)->button(),
- true); // inspect_with_devtools
+ true); // |inspect_with_devtools|.
}
void BrowserActionsContainer::ExtensionPopupClosed(ExtensionPopup* popup) {

Powered by Google App Engine
This is Rietveld 408576698