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

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: Created 7 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 "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 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 CacheMap::iterator found = cache_.find(instance); 267 CacheMap::iterator found = cache_.find(instance);
268 if (found == cache_.end()) 268 if (found == cache_.end())
269 return scoped_refptr<ImageData>(); 269 return scoped_refptr<ImageData>();
270 return found->second.Get(width, height, format); 270 return found->second.Get(width, height, format);
271 } 271 }
272 272
273 void ImageDataCache::Add(ImageData* image_data) { 273 void ImageDataCache::Add(ImageData* image_data) {
274 cache_[image_data->pp_instance()].Add(image_data); 274 cache_[image_data->pp_instance()].Add(image_data);
275 275
276 // Schedule a timer to invalidate this entry. 276 // Schedule a timer to invalidate this entry.
277 MessageLoop::current()->PostDelayedTask( 277 base::MessageLoop::current()->PostDelayedTask(
278 FROM_HERE, 278 FROM_HERE,
279 RunWhileLocked(base::Bind(&ImageDataCache::OnTimer, 279 RunWhileLocked(base::Bind(&ImageDataCache::OnTimer,
280 weak_factory_.GetWeakPtr(), 280 weak_factory_.GetWeakPtr(),
281 image_data->pp_instance())), 281 image_data->pp_instance())),
282 base::TimeDelta::FromSeconds(kMaxAgeSeconds)); 282 base::TimeDelta::FromSeconds(kMaxAgeSeconds));
283 } 283 }
284 284
285 void ImageDataCache::ImageDataUsable(ImageData* image_data) { 285 void ImageDataCache::ImageDataUsable(ImageData* image_data) {
286 CacheMap::iterator found = cache_.find(image_data->pp_instance()); 286 CacheMap::iterator found = cache_.find(image_data->pp_instance());
287 if (found != cache_.end()) 287 if (found != cache_.end())
288 found->second.ImageDataUsable(image_data); 288 found->second.ImageDataUsable(image_data);
289 } 289 }
290 290
291 void ImageDataCache::DidDeleteInstance(PP_Instance instance) { 291 void ImageDataCache::DidDeleteInstance(PP_Instance instance) {
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
628 // still cached in our process, the proxy still holds a reference so we can 628 // still cached in our process, the proxy still holds a reference so we can
629 // remove the one the renderer just sent is. If the proxy no longer holds a 629 // remove the one the renderer just sent is. If the proxy no longer holds a
630 // reference, we released everything and we should also release the one the 630 // reference, we released everything and we should also release the one the
631 // renderer just sent us. 631 // renderer just sent us.
632 dispatcher()->Send(new PpapiHostMsg_PPBCore_ReleaseResource( 632 dispatcher()->Send(new PpapiHostMsg_PPBCore_ReleaseResource(
633 API_ID_PPB_CORE, old_image_data)); 633 API_ID_PPB_CORE, old_image_data));
634 } 634 }
635 635
636 } // namespace proxy 636 } // namespace proxy
637 } // namespace ppapi 637 } // namespace ppapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698