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

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

Issue 1548813002: Switch to standard integer types in ppapi/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixes Created 4 years, 12 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 | « ppapi/shared_impl/resource_tracker.h ('k') | ppapi/shared_impl/resource_var.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/shared_impl/resource_tracker.h" 5 #include "ppapi/shared_impl/resource_tracker.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "ppapi/shared_impl/callback_tracker.h" 10 #include "ppapi/shared_impl/callback_tracker.h"
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 const bool is_message_loop = (object->AsPPB_MessageLoop_API() != NULL); 226 const bool is_message_loop = (object->AsPPB_MessageLoop_API() != NULL);
227 CHECK(object->pp_instance() || is_message_loop); 227 CHECK(object->pp_instance() || is_message_loop);
228 CallbackTracker* callback_tracker = 228 CallbackTracker* callback_tracker =
229 PpapiGlobals::Get()->GetCallbackTrackerForInstance(object->pp_instance()); 229 PpapiGlobals::Get()->GetCallbackTrackerForInstance(object->pp_instance());
230 CHECK(callback_tracker || is_message_loop); 230 CHECK(callback_tracker || is_message_loop);
231 if (callback_tracker) 231 if (callback_tracker)
232 callback_tracker->PostAbortForResource(object->pp_resource()); 232 callback_tracker->PostAbortForResource(object->pp_resource());
233 object->NotifyLastPluginRefWasDeleted(); 233 object->NotifyLastPluginRefWasDeleted();
234 } 234 }
235 235
236 int32 ResourceTracker::GetNextResourceValue() { 236 int32_t ResourceTracker::GetNextResourceValue() {
237 #if defined(NDEBUG) 237 #if defined(NDEBUG)
238 return ++last_resource_value_; 238 return ++last_resource_value_;
239 #else 239 #else
240 // In debug mode, the least significant bit indicates which side (renderer 240 // In debug mode, the least significant bit indicates which side (renderer
241 // or plugin process) created the resource. Increment by 2 so it's always the 241 // or plugin process) created the resource. Increment by 2 so it's always the
242 // same. 242 // same.
243 last_resource_value_ += 2; 243 last_resource_value_ += 2;
244 return last_resource_value_; 244 return last_resource_value_;
245 #endif 245 #endif
246 } 246 }
247 247
248 bool ResourceTracker::CanOperateOnResource(PP_Resource res) { 248 bool ResourceTracker::CanOperateOnResource(PP_Resource res) {
249 #if defined(NDEBUG) 249 #if defined(NDEBUG)
250 return true; 250 return true;
251 #else 251 #else
252 // The invalid PP_Resource value could appear at both sides. 252 // The invalid PP_Resource value could appear at both sides.
253 if (res == 0) 253 if (res == 0)
254 return true; 254 return true;
255 255
256 // Skipping the type bits, the least significant bit of |res| should be the 256 // Skipping the type bits, the least significant bit of |res| should be the
257 // same as that of |last_resource_value_|. 257 // same as that of |last_resource_value_|.
258 return ((res >> kPPIdTypeBits) & 1) == (last_resource_value_ & 1); 258 return ((res >> kPPIdTypeBits) & 1) == (last_resource_value_ & 1);
259 #endif 259 #endif
260 } 260 }
261 261
262 } // namespace ppapi 262 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/shared_impl/resource_tracker.h ('k') | ppapi/shared_impl/resource_var.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698