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

Side by Side Diff: ppapi/proxy/ppb_image_data_proxy.cc

Issue 26308002: Fix some WeakPtrFactory members that aren't last (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix weak ptr initialization Created 7 years, 2 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
« no previous file with comments | « net/ssl/server_bound_cert_service.cc ('k') | ppapi/proxy/ppb_var_deprecated_proxy.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "ppapi/proxy/ppb_image_data_proxy.h" 5 #include "ppapi/proxy/ppb_image_data_proxy.h"
6 6
7 #include <string.h> // For memcpy 7 #include <string.h> // For memcpy
8 8
9 #include <map> 9 #include <map>
10 #include <vector> 10 #include <vector>
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 void ImageDataUsable(ImageData* image_data); 242 void ImageDataUsable(ImageData* image_data);
243 243
244 void DidDeleteInstance(PP_Instance instance); 244 void DidDeleteInstance(PP_Instance instance);
245 245
246 private: 246 private:
247 friend struct LeakySingletonTraits<ImageDataCache>; 247 friend struct LeakySingletonTraits<ImageDataCache>;
248 248
249 // Timer callback to expire entries for the given instance. 249 // Timer callback to expire entries for the given instance.
250 void OnTimer(PP_Instance instance); 250 void OnTimer(PP_Instance instance);
251 251
252 typedef std::map<PP_Instance, ImageDataInstanceCache> CacheMap;
253 CacheMap cache_;
254
252 // This class does timer calls and we don't want to run these outside of the 255 // This class does timer calls and we don't want to run these outside of the
253 // scope of the object. Technically, since this class is a leaked static, 256 // scope of the object. Technically, since this class is a leaked static,
254 // this will never happen and this factory is unnecessary. However, it's 257 // this will never happen and this factory is unnecessary. However, it's
255 // probably better not to make assumptions about the lifetime of this class. 258 // probably better not to make assumptions about the lifetime of this class.
256 base::WeakPtrFactory<ImageDataCache> weak_factory_; 259 base::WeakPtrFactory<ImageDataCache> weak_factory_;
257 260
258 typedef std::map<PP_Instance, ImageDataInstanceCache> CacheMap;
259 CacheMap cache_;
260
261 DISALLOW_COPY_AND_ASSIGN(ImageDataCache); 261 DISALLOW_COPY_AND_ASSIGN(ImageDataCache);
262 }; 262 };
263 263
264 // static 264 // static
265 ImageDataCache* ImageDataCache::GetInstance() { 265 ImageDataCache* ImageDataCache::GetInstance() {
266 return Singleton<ImageDataCache, 266 return Singleton<ImageDataCache,
267 LeakySingletonTraits<ImageDataCache> >::get(); 267 LeakySingletonTraits<ImageDataCache> >::get();
268 } 268 }
269 269
270 scoped_refptr<ImageData> ImageDataCache::Get( 270 scoped_refptr<ImageData> ImageDataCache::Get(
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after
698 // still cached in our process, the proxy still holds a reference so we can 698 // still cached in our process, the proxy still holds a reference so we can
699 // remove the one the renderer just sent is. If the proxy no longer holds a 699 // remove the one the renderer just sent is. If the proxy no longer holds a
700 // reference, we released everything and we should also release the one the 700 // reference, we released everything and we should also release the one the
701 // renderer just sent us. 701 // renderer just sent us.
702 dispatcher()->Send(new PpapiHostMsg_PPBCore_ReleaseResource( 702 dispatcher()->Send(new PpapiHostMsg_PPBCore_ReleaseResource(
703 API_ID_PPB_CORE, old_image_data)); 703 API_ID_PPB_CORE, old_image_data));
704 } 704 }
705 705
706 } // namespace proxy 706 } // namespace proxy
707 } // namespace ppapi 707 } // namespace ppapi
OLDNEW
« no previous file with comments | « net/ssl/server_bound_cert_service.cc ('k') | ppapi/proxy/ppb_var_deprecated_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698