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

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

Issue 14273043: ppapi: Use base::MessageLoop. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comments Created 7 years, 7 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 | « ppapi/proxy/ppapi_proxy_test.cc ('k') | ppapi/proxy/ppb_instance_proxy.cc » ('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 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 CacheMap::iterator found = cache_.find(instance); 268 CacheMap::iterator found = cache_.find(instance);
269 if (found == cache_.end()) 269 if (found == cache_.end())
270 return scoped_refptr<ImageData>(); 270 return scoped_refptr<ImageData>();
271 return found->second.Get(width, height, format); 271 return found->second.Get(width, height, format);
272 } 272 }
273 273
274 void ImageDataCache::Add(ImageData* image_data) { 274 void ImageDataCache::Add(ImageData* image_data) {
275 cache_[image_data->pp_instance()].Add(image_data); 275 cache_[image_data->pp_instance()].Add(image_data);
276 276
277 // Schedule a timer to invalidate this entry. 277 // Schedule a timer to invalidate this entry.
278 MessageLoop::current()->PostDelayedTask( 278 base::MessageLoop::current()->PostDelayedTask(
279 FROM_HERE, 279 FROM_HERE,
280 RunWhileLocked(base::Bind(&ImageDataCache::OnTimer, 280 RunWhileLocked(base::Bind(&ImageDataCache::OnTimer,
281 weak_factory_.GetWeakPtr(), 281 weak_factory_.GetWeakPtr(),
282 image_data->pp_instance())), 282 image_data->pp_instance())),
283 base::TimeDelta::FromSeconds(kMaxAgeSeconds)); 283 base::TimeDelta::FromSeconds(kMaxAgeSeconds));
284 } 284 }
285 285
286 void ImageDataCache::ImageDataUsable(ImageData* image_data) { 286 void ImageDataCache::ImageDataUsable(ImageData* image_data) {
287 CacheMap::iterator found = cache_.find(image_data->pp_instance()); 287 CacheMap::iterator found = cache_.find(image_data->pp_instance());
288 if (found != cache_.end()) 288 if (found != cache_.end())
289 found->second.ImageDataUsable(image_data); 289 found->second.ImageDataUsable(image_data);
290 } 290 }
291 291
292 void ImageDataCache::DidDeleteInstance(PP_Instance instance) { 292 void ImageDataCache::DidDeleteInstance(PP_Instance instance) {
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
662 // still cached in our process, the proxy still holds a reference so we can 662 // still cached in our process, the proxy still holds a reference so we can
663 // remove the one the renderer just sent is. If the proxy no longer holds a 663 // remove the one the renderer just sent is. If the proxy no longer holds a
664 // reference, we released everything and we should also release the one the 664 // reference, we released everything and we should also release the one the
665 // renderer just sent us. 665 // renderer just sent us.
666 dispatcher()->Send(new PpapiHostMsg_PPBCore_ReleaseResource( 666 dispatcher()->Send(new PpapiHostMsg_PPBCore_ReleaseResource(
667 API_ID_PPB_CORE, old_image_data)); 667 API_ID_PPB_CORE, old_image_data));
668 } 668 }
669 669
670 } // namespace proxy 670 } // namespace proxy
671 } // namespace ppapi 671 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/proxy/ppapi_proxy_test.cc ('k') | ppapi/proxy/ppb_instance_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698