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

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

Issue 938843002: PPAPI: Don't use MessageLoop::current in the plugin process (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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
« no previous file with comments | « no previous file | 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 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 CacheMap::iterator found = cache_.find(instance); 275 CacheMap::iterator found = cache_.find(instance);
276 if (found == cache_.end()) 276 if (found == cache_.end())
277 return scoped_refptr<ImageData>(); 277 return scoped_refptr<ImageData>();
278 return found->second.Get(type, width, height, format); 278 return found->second.Get(type, width, height, format);
279 } 279 }
280 280
281 void ImageDataCache::Add(ImageData* image_data) { 281 void ImageDataCache::Add(ImageData* image_data) {
282 cache_[image_data->pp_instance()].Add(image_data); 282 cache_[image_data->pp_instance()].Add(image_data);
283 283
284 // Schedule a timer to invalidate this entry. 284 // Schedule a timer to invalidate this entry.
285 base::MessageLoop::current()->PostDelayedTask( 285 PpapiGlobals::Get()->GetMainThreadMessageLoop()->PostDelayedTask(
286 FROM_HERE, 286 FROM_HERE,
287 RunWhileLocked(base::Bind(&ImageDataCache::OnTimer, 287 RunWhileLocked(base::Bind(&ImageDataCache::OnTimer,
288 weak_factory_.GetWeakPtr(), 288 weak_factory_.GetWeakPtr(),
289 image_data->pp_instance())), 289 image_data->pp_instance())),
290 base::TimeDelta::FromSeconds(kMaxAgeSeconds)); 290 base::TimeDelta::FromSeconds(kMaxAgeSeconds));
291 } 291 }
292 292
293 void ImageDataCache::ImageDataUsable(ImageData* image_data) { 293 void ImageDataCache::ImageDataUsable(ImageData* image_data) {
294 CacheMap::iterator found = cache_.find(image_data->pp_instance()); 294 CacheMap::iterator found = cache_.find(image_data->pp_instance());
295 if (found != cache_.end()) 295 if (found != cache_.end())
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
687 // still cached in our process, the proxy still holds a reference so we can 687 // still cached in our process, the proxy still holds a reference so we can
688 // remove the one the renderer just sent is. If the proxy no longer holds a 688 // remove the one the renderer just sent is. If the proxy no longer holds a
689 // reference, we released everything and we should also release the one the 689 // reference, we released everything and we should also release the one the
690 // renderer just sent us. 690 // renderer just sent us.
691 dispatcher()->Send(new PpapiHostMsg_PPBCore_ReleaseResource( 691 dispatcher()->Send(new PpapiHostMsg_PPBCore_ReleaseResource(
692 API_ID_PPB_CORE, old_image_data)); 692 API_ID_PPB_CORE, old_image_data));
693 } 693 }
694 694
695 } // namespace proxy 695 } // namespace proxy
696 } // namespace ppapi 696 } // namespace ppapi
OLDNEW
« no previous file with comments | « no previous file | ppapi/proxy/ppb_instance_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698