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

Side by Side Diff: chrome/browser/extensions/image_loading_tracker.cc

Issue 10824359: Remove ImageSkia::empty and ImageSkia::extractSubset (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/extensions/image_loading_tracker.h" 5 #include "chrome/browser/extensions/image_loading_tracker.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 info->extension->SetCachedImage(image_info.resource, 365 info->extension->SetCachedImage(image_info.resource,
366 bitmap ? *bitmap : SkBitmap(), 366 bitmap ? *bitmap : SkBitmap(),
367 original_size); 367 original_size);
368 } 368 }
369 369
370 // If all pending bitmaps are done then report back. 370 // If all pending bitmaps are done then report back.
371 if (info->pending_count == 0) { 371 if (info->pending_count == 0) {
372 gfx::Image image; 372 gfx::Image image;
373 std::string extension_id = info->extension_id; 373 std::string extension_id = info->extension_id;
374 374
375 if (!info->image_skia.empty()) 375 if (!info->image_skia.isNull())
376 image = gfx::Image(info->image_skia); 376 image = gfx::Image(info->image_skia);
377 377
378 load_map_.erase(load_map_it); 378 load_map_.erase(load_map_it);
379 379
380 // ImageLoadingTracker might be deleted after the callback so don't do 380 // ImageLoadingTracker might be deleted after the callback so don't do
381 // anything after this statement. 381 // anything after this statement.
382 observer_->OnImageLoaded(image, extension_id, id); 382 observer_->OnImageLoaded(image, extension_id, id);
383 } 383 }
384 } 384 }
385 385
386 void ImageLoadingTracker::Observe(int type, 386 void ImageLoadingTracker::Observe(int type,
387 const content::NotificationSource& source, 387 const content::NotificationSource& source,
388 const content::NotificationDetails& details) { 388 const content::NotificationDetails& details) {
389 DCHECK(type == chrome::NOTIFICATION_EXTENSION_UNLOADED); 389 DCHECK(type == chrome::NOTIFICATION_EXTENSION_UNLOADED);
390 390
391 const Extension* extension = 391 const Extension* extension =
392 content::Details<extensions::UnloadedExtensionInfo>(details)->extension; 392 content::Details<extensions::UnloadedExtensionInfo>(details)->extension;
393 393
394 // Remove reference to this extension from all pending load entries. This 394 // Remove reference to this extension from all pending load entries. This
395 // ensures we don't attempt to cache the bitmap when the load completes. 395 // ensures we don't attempt to cache the bitmap when the load completes.
396 for (LoadMap::iterator i = load_map_.begin(); i != load_map_.end(); ++i) { 396 for (LoadMap::iterator i = load_map_.begin(); i != load_map_.end(); ++i) {
397 PendingLoadInfo* info = &i->second; 397 PendingLoadInfo* info = &i->second;
398 if (info->extension == extension) { 398 if (info->extension == extension) {
399 info->extension = NULL; 399 info->extension = NULL;
400 info->cache = DONT_CACHE; 400 info->cache = DONT_CACHE;
401 } 401 }
402 } 402 }
403 } 403 }
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/status/network_menu_icon.cc ('k') | chrome/browser/notifications/desktop_notification_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698