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

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

Issue 10071035: RefCounted types should not have public destructors, chrome/browser/extensions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Compile fix Created 8 years, 8 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 "base/bind.h" 7 #include "base/bind.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" 9 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h"
10 #include "chrome/common/chrome_notification_types.h" 10 #include "chrome/common/chrome_notification_types.h"
(...skipping 29 matching lines...) Expand all
40 40
41 //////////////////////////////////////////////////////////////////////////////// 41 ////////////////////////////////////////////////////////////////////////////////
42 // ImageLoadingTracker::PendingLoadInfo 42 // ImageLoadingTracker::PendingLoadInfo
43 43
44 ImageLoadingTracker::PendingLoadInfo::PendingLoadInfo() 44 ImageLoadingTracker::PendingLoadInfo::PendingLoadInfo()
45 : extension(NULL), 45 : extension(NULL),
46 cache(CACHE), 46 cache(CACHE),
47 pending_count(0) { 47 pending_count(0) {
48 } 48 }
49 49
50 ImageLoadingTracker::PendingLoadInfo::~PendingLoadInfo() { 50 ImageLoadingTracker::PendingLoadInfo::~PendingLoadInfo() {}
51 }
52 51
53 //////////////////////////////////////////////////////////////////////////////// 52 ////////////////////////////////////////////////////////////////////////////////
54 // ImageLoadingTracker::ImageLoader 53 // ImageLoadingTracker::ImageLoader
55 54
56 // A RefCounted class for loading images on the File thread and reporting back 55 // A RefCounted class for loading images on the File thread and reporting back
57 // on the UI thread. 56 // on the UI thread.
58 class ImageLoadingTracker::ImageLoader 57 class ImageLoadingTracker::ImageLoader
59 : public base::RefCountedThreadSafe<ImageLoader> { 58 : public base::RefCountedThreadSafe<ImageLoader> {
60 public: 59 public:
61 explicit ImageLoader(ImageLoadingTracker* tracker) 60 explicit ImageLoader(ImageLoadingTracker* tracker)
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 const gfx::Size& original_size, int id) { 153 const gfx::Size& original_size, int id) {
155 DCHECK(!BrowserThread::CurrentlyOn(BrowserThread::FILE)); 154 DCHECK(!BrowserThread::CurrentlyOn(BrowserThread::FILE));
156 155
157 if (tracker_) 156 if (tracker_)
158 tracker_->OnImageLoaded(image, resource, original_size, id, true); 157 tracker_->OnImageLoaded(image, resource, original_size, id, true);
159 158
160 delete image; 159 delete image;
161 } 160 }
162 161
163 private: 162 private:
163 friend class base::RefCountedThreadSafe<ImageLoader>;
164 ~ImageLoader() {}
165
164 // The tracker we are loading the image for. If NULL, it means the tracker is 166 // The tracker we are loading the image for. If NULL, it means the tracker is
165 // no longer interested in the reply. 167 // no longer interested in the reply.
166 ImageLoadingTracker* tracker_; 168 ImageLoadingTracker* tracker_;
167 169
168 // The thread that we need to call back on to report that we are done. 170 // The thread that we need to call back on to report that we are done.
169 BrowserThread::ID callback_thread_id_; 171 BrowserThread::ID callback_thread_id_;
170 172
171 DISALLOW_COPY_AND_ASSIGN(ImageLoader); 173 DISALLOW_COPY_AND_ASSIGN(ImageLoader);
172 }; 174 };
173 175
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 // Remove reference to this extension from all pending load entries. This 331 // Remove reference to this extension from all pending load entries. This
330 // ensures we don't attempt to cache the image when the load completes. 332 // ensures we don't attempt to cache the image when the load completes.
331 for (LoadMap::iterator i = load_map_.begin(); i != load_map_.end(); ++i) { 333 for (LoadMap::iterator i = load_map_.begin(); i != load_map_.end(); ++i) {
332 PendingLoadInfo* info = &i->second; 334 PendingLoadInfo* info = &i->second;
333 if (info->extension == extension) { 335 if (info->extension == extension) {
334 info->extension = NULL; 336 info->extension = NULL;
335 info->cache = DONT_CACHE; 337 info->cache = DONT_CACHE;
336 } 338 }
337 } 339 }
338 } 340 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698