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

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

Issue 11275088: Remove implicit scoped_refptr operator T* Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 8 years, 1 month 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
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 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 ImageLoadingTracker::ImageLoadingTracker(Observer* observer) 247 ImageLoadingTracker::ImageLoadingTracker(Observer* observer)
248 : observer_(observer), 248 : observer_(observer),
249 next_id_(0) { 249 next_id_(0) {
250 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, 250 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED,
251 content::NotificationService::AllSources()); 251 content::NotificationService::AllSources());
252 } 252 }
253 253
254 ImageLoadingTracker::~ImageLoadingTracker() { 254 ImageLoadingTracker::~ImageLoadingTracker() {
255 // The loader is created lazily and is NULL if the tracker is destroyed before 255 // The loader is created lazily and is NULL if the tracker is destroyed before
256 // any valid image load tasks have been posted. 256 // any valid image load tasks have been posted.
257 if (loader_) 257 if (loader_.get())
258 loader_->StopTracking(); 258 loader_->StopTracking();
259 } 259 }
260 260
261 void ImageLoadingTracker::LoadImage(const Extension* extension, 261 void ImageLoadingTracker::LoadImage(const Extension* extension,
262 const ExtensionResource& resource, 262 const ExtensionResource& resource,
263 const gfx::Size& max_size, 263 const gfx::Size& max_size,
264 CacheParam cache) { 264 CacheParam cache) {
265 std::vector<ImageRepresentation> info_list; 265 std::vector<ImageRepresentation> info_list;
266 info_list.push_back(ImageRepresentation( 266 info_list.push_back(ImageRepresentation(
267 resource, 267 resource,
(...skipping 29 matching lines...) Expand all
297 // See if the extension has the bitmap already. 297 // See if the extension has the bitmap already.
298 if (extension->HasCachedImage(it->resource, it->desired_size)) { 298 if (extension->HasCachedImage(it->resource, it->desired_size)) {
299 SkBitmap bitmap = extension->GetCachedImage(it->resource, 299 SkBitmap bitmap = extension->GetCachedImage(it->resource,
300 it->desired_size); 300 it->desired_size);
301 OnBitmapLoaded(&bitmap, *it, it->desired_size, id, false); 301 OnBitmapLoaded(&bitmap, *it, it->desired_size, id, false);
302 continue; 302 continue;
303 } 303 }
304 304
305 // Instruct the ImageLoader to load this on the File thread. LoadImage and 305 // Instruct the ImageLoader to load this on the File thread. LoadImage and
306 // LoadResource do not block. 306 // LoadResource do not block.
307 if (!loader_) 307 if (!loader_.get())
308 loader_ = new ImageLoader(this); 308 loader_ = new ImageLoader(this);
309 309
310 int resource_id = -1; 310 int resource_id = -1;
311 if (IsComponentExtensionResource(extension, it->resource.relative_path(), 311 if (IsComponentExtensionResource(extension, it->resource.relative_path(),
312 &resource_id)) 312 &resource_id))
313 loader_->LoadResource(*it, id, resource_id); 313 loader_->LoadResource(*it, id, resource_id);
314 else 314 else
315 loader_->LoadImage(*it, id); 315 loader_->LoadImage(*it, id);
316 } 316 }
317 } 317 }
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 // Remove reference to this extension from all pending load entries. This 426 // Remove reference to this extension from all pending load entries. This
427 // ensures we don't attempt to cache the bitmap when the load completes. 427 // ensures we don't attempt to cache the bitmap when the load completes.
428 for (LoadMap::iterator i = load_map_.begin(); i != load_map_.end(); ++i) { 428 for (LoadMap::iterator i = load_map_.begin(); i != load_map_.end(); ++i) {
429 PendingLoadInfo* info = &i->second; 429 PendingLoadInfo* info = &i->second;
430 if (info->extension == extension) { 430 if (info->extension == extension) {
431 info->extension = NULL; 431 info->extension = NULL;
432 info->cache = DONT_CACHE; 432 info->cache = DONT_CACHE;
433 } 433 }
434 } 434 }
435 } 435 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_sync_bundle.cc ('k') | chrome/browser/extensions/menu_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698