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

Unified Diff: ppapi/shared_impl/var_tracker.h

Issue 1548813002: Switch to standard integer types in ppapi/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixes Created 5 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ppapi/shared_impl/var.cc ('k') | ppapi/shared_impl/var_tracker.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/shared_impl/var_tracker.h
diff --git a/ppapi/shared_impl/var_tracker.h b/ppapi/shared_impl/var_tracker.h
index 814b58cebc28c0d5640762f51cfba6e4d8d5f083..6ef9fc80723eec236780cb0e3d34f8243c411b48 100644
--- a/ppapi/shared_impl/var_tracker.h
+++ b/ppapi/shared_impl/var_tracker.h
@@ -5,10 +5,12 @@
#ifndef PPAPI_SHARED_IMPL_VAR_TRACKER_H_
#define PPAPI_SHARED_IMPL_VAR_TRACKER_H_
+#include <stdint.h>
+
#include <vector>
-#include "base/basictypes.h"
#include "base/containers/hash_tables.h"
+#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/shared_memory.h"
@@ -52,41 +54,42 @@ class PPAPI_SHARED_EXPORT VarTracker {
virtual ~VarTracker();
// Called by the Var object to add a new var to the tracker.
- int32 AddVar(Var* var);
+ int32_t AddVar(Var* var);
// Looks up a given var and returns a reference to the Var if it exists.
// Returns NULL if the var type is not an object we track (POD) or is
// invalid.
- Var* GetVar(int32 var_id) const;
+ Var* GetVar(int32_t var_id) const;
Var* GetVar(const PP_Var& var) const;
// Increases a previously-known Var ID's refcount, returning true on success,
// false if the ID is invalid. The PP_Var version returns true and does
// nothing for non-refcounted type vars.
- bool AddRefVar(int32 var_id);
+ bool AddRefVar(int32_t var_id);
bool AddRefVar(const PP_Var& var);
// Decreases the given Var ID's refcount, returning true on success, false if
// the ID is invalid or if the refcount was already 0. The PP_Var version
// returns true and does nothing for non-refcounted type vars. The var will
// be deleted if there are no more refs to it.
- bool ReleaseVar(int32 var_id);
+ bool ReleaseVar(int32_t var_id);
bool ReleaseVar(const PP_Var& var);
// Create a new array buffer of size |size_in_bytes|. Return a PP_Var that
// that references it and has an initial reference-count of 1.
- PP_Var MakeArrayBufferPPVar(uint32 size_in_bytes);
+ PP_Var MakeArrayBufferPPVar(uint32_t size_in_bytes);
// Same as above, but copy the contents of |data| in to the new array buffer.
- PP_Var MakeArrayBufferPPVar(uint32 size_in_bytes, const void* data);
+ PP_Var MakeArrayBufferPPVar(uint32_t size_in_bytes, const void* data);
// Same as above, but copy the contents of the shared memory in |h|
// into the new array buffer.
- PP_Var MakeArrayBufferPPVar(uint32 size_in_bytes, base::SharedMemoryHandle h);
+ PP_Var MakeArrayBufferPPVar(uint32_t size_in_bytes,
+ base::SharedMemoryHandle h);
// Create an ArrayBuffer and copy the contents of |data| in to it. The
// returned object has 0 reference count in the tracker, and like all
// RefCounted objects, has a 0 initial internal reference count. (You should
// usually immediately put this in a scoped_refptr).
- ArrayBufferVar* MakeArrayBufferVar(uint32 size_in_bytes, const void* data);
+ ArrayBufferVar* MakeArrayBufferVar(uint32_t size_in_bytes, const void* data);
// Creates a new resource var from a resource creation message. Returns a
// PP_Var that references a new PP_Resource, both with an initial reference
@@ -137,7 +140,7 @@ class PPAPI_SHARED_EXPORT VarTracker {
// host. Not implemented on the plugin side.
virtual int TrackSharedMemoryHandle(PP_Instance instance,
base::SharedMemoryHandle handle,
- uint32 size_in_bytes) = 0;
+ uint32_t size_in_bytes) = 0;
// Resolves an "id" generated by TrackSharedMemoryHandle back into
// a SharedMemory handle and its size on the host.
@@ -145,7 +148,7 @@ class PPAPI_SHARED_EXPORT VarTracker {
virtual bool StopTrackingSharedMemoryHandle(int id,
PP_Instance instance,
base::SharedMemoryHandle* handle,
- uint32* size_in_bytes) = 0;
+ uint32_t* size_in_bytes) = 0;
protected:
struct PPAPI_SHARED_EXPORT VarInfo {
@@ -170,7 +173,7 @@ class PPAPI_SHARED_EXPORT VarTracker {
// we know when we can stop tracking this object.
int track_with_no_reference_count;
};
- typedef base::hash_map<int32, VarInfo> VarMap;
+ typedef base::hash_map<int32_t, VarInfo> VarMap;
// Specifies what should happen with the refcount when calling AddVarInternal.
enum AddVarRefMode {
@@ -186,10 +189,10 @@ class PPAPI_SHARED_EXPORT VarTracker {
// initial refcount of the added object will be 0 or 1.
//
// Overridden in the plugin proxy to do additional object tracking.
- virtual int32 AddVarInternal(Var* var, AddVarRefMode mode);
+ virtual int32_t AddVarInternal(Var* var, AddVarRefMode mode);
// Convenience functions for doing lookups into the live_vars_ map.
- VarMap::iterator GetLiveVar(int32 id);
+ VarMap::iterator GetLiveVar(int32_t id);
VarMap::iterator GetLiveVar(const PP_Var& var);
VarMap::const_iterator GetLiveVar(const PP_Var& var) const;
@@ -217,15 +220,15 @@ class PPAPI_SHARED_EXPORT VarTracker {
VarMap live_vars_;
// Last assigned var ID.
- int32 last_var_id_;
+ int32_t last_var_id_;
private:
// Create and return a new ArrayBufferVar size_in_bytes bytes long. This is
// implemented by the Host and Plugin tracker separately, so that it can be
// a real WebKit ArrayBuffer on the host side.
- virtual ArrayBufferVar* CreateArrayBuffer(uint32 size_in_bytes) = 0;
+ virtual ArrayBufferVar* CreateArrayBuffer(uint32_t size_in_bytes) = 0;
virtual ArrayBufferVar* CreateShmArrayBuffer(
- uint32 size_in_bytes,
+ uint32_t size_in_bytes,
base::SharedMemoryHandle handle) = 0;
// On the host side, we want to check that we are only called on the main
« no previous file with comments | « ppapi/shared_impl/var.cc ('k') | ppapi/shared_impl/var_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698