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

Side by Side Diff: ppapi/shared_impl/callback_tracker.cc

Issue 11189146: Eliminate implicit conversion from scoped_refptr<T> to T* (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 | « ppapi/proxy/plugin_globals.cc ('k') | ppapi/shared_impl/ppapi_globals.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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/shared_impl/callback_tracker.h" 5 #include "ppapi/shared_impl/callback_tracker.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 } 46 }
47 47
48 CallbackTracker::~CallbackTracker() { 48 CallbackTracker::~CallbackTracker() {
49 // All callbacks must be aborted before destruction. 49 // All callbacks must be aborted before destruction.
50 CHECK_EQ(0u, pending_callbacks_.size()); 50 CHECK_EQ(0u, pending_callbacks_.size());
51 } 51 }
52 52
53 void CallbackTracker::Add( 53 void CallbackTracker::Add(
54 const scoped_refptr<TrackedCallback>& tracked_callback) { 54 const scoped_refptr<TrackedCallback>& tracked_callback) {
55 PP_Resource resource_id = tracked_callback->resource_id(); 55 PP_Resource resource_id = tracked_callback->resource_id();
56 DCHECK(pending_callbacks_[resource_id].find(tracked_callback) == 56 DCHECK(pending_callbacks_[resource_id].find(tracked_callback.get()) ==
57 pending_callbacks_[resource_id].end()); 57 pending_callbacks_[resource_id].end());
58 pending_callbacks_[resource_id].insert(tracked_callback); 58 pending_callbacks_[resource_id].insert(tracked_callback);
59 } 59 }
60 60
61 void CallbackTracker::Remove( 61 void CallbackTracker::Remove(
62 const scoped_refptr<TrackedCallback>& tracked_callback) { 62 const scoped_refptr<TrackedCallback>& tracked_callback) {
63 CallbackSetMap::iterator map_it = 63 CallbackSetMap::iterator map_it =
64 pending_callbacks_.find(tracked_callback->resource_id()); 64 pending_callbacks_.find(tracked_callback->resource_id());
65 DCHECK(map_it != pending_callbacks_.end()); 65 DCHECK(map_it != pending_callbacks_.end());
66 CallbackSet::iterator it = map_it->second.find(tracked_callback); 66 CallbackSet::iterator it = map_it->second.find(tracked_callback);
67 DCHECK(it != map_it->second.end()); 67 DCHECK(it != map_it->second.end());
68 map_it->second.erase(it); 68 map_it->second.erase(it);
69 69
70 // If there are no pending callbacks left for this ID, get rid of the entry. 70 // If there are no pending callbacks left for this ID, get rid of the entry.
71 if (map_it->second.empty()) 71 if (map_it->second.empty())
72 pending_callbacks_.erase(map_it); 72 pending_callbacks_.erase(map_it);
73 } 73 }
74 74
75 } // namespace ppapi 75 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/proxy/plugin_globals.cc ('k') | ppapi/shared_impl/ppapi_globals.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698