diff options
author | dmichael@chromium.org <dmichael@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-15 21:22:31 +0000 |
---|---|---|
committer | dmichael@chromium.org <dmichael@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-15 21:22:31 +0000 |
commit | 8cc26a4c78767feaf47fa94af34471d63e3596e5 (patch) | |
tree | 24399869b26449df2a6a838796941c984106f4b2 /ppapi/shared_impl/var.h | |
parent | b40a1f1acb4d3fa0c56a3706dd47a2ca8d471834 (diff) | |
download | chromium_src-8cc26a4c78767feaf47fa94af34471d63e3596e5.zip chromium_src-8cc26a4c78767feaf47fa94af34471d63e3596e5.tar.gz chromium_src-8cc26a4c78767feaf47fa94af34471d63e3596e5.tar.bz2 |
Implement in-process PPB_VarArrayBuffer_Dev.
+tony TBR for webkit/glue/webkit_glue.gypi
BUG=103435
TEST=N/A
TBR=tony
Review URL: http://codereview.chromium.org/8930010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@114700 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/shared_impl/var.h')
-rw-r--r-- | ppapi/shared_impl/var.h | 39 |
1 files changed, 37 insertions, 2 deletions
diff --git a/ppapi/shared_impl/var.h b/ppapi/shared_impl/var.h index 49b9272..d41d00e 100644 --- a/ppapi/shared_impl/var.h +++ b/ppapi/shared_impl/var.h @@ -14,6 +14,7 @@ namespace ppapi { +class ArrayBufferVar; class NPObjectVar; class ProxyObjectVar; class StringVar; @@ -30,12 +31,13 @@ class PPAPI_SHARED_EXPORT Var : public base::RefCounted<Var> { static std::string PPVarToLogString(PP_Var var); virtual StringVar* AsStringVar(); + virtual ArrayBufferVar* AsArrayBufferVar(); virtual NPObjectVar* AsNPObjectVar(); virtual ProxyObjectVar* AsProxyObjectVar(); // Creates a PP_Var corresponding to this object. The return value will have // one reference addrefed on behalf of the caller. - virtual PP_Var GetPPVar() = 0; + PP_Var GetPPVar(); // Returns the type of this var. virtual PP_VarType GetType() const = 0; @@ -97,7 +99,6 @@ class PPAPI_SHARED_EXPORT StringVar : public Var { // Var override. virtual StringVar* AsStringVar() OVERRIDE; - virtual PP_Var GetPPVar() OVERRIDE; virtual PP_VarType GetType() const OVERRIDE; // Helper function to create a PP_Var of type string that contains a copy of @@ -119,6 +120,40 @@ class PPAPI_SHARED_EXPORT StringVar : public Var { DISALLOW_COPY_AND_ASSIGN(StringVar); }; +// ArrayBufferVar -------------------------------------------------------------- + +// Represents an array buffer Var. +// +// Note this is an abstract class. To create an appropriate concrete one, you +// need to use the VarTracker: +// VarArrayBuffer* buf = +// PpapiGlobals::Get()->GetVarTracker()->CreateArrayBuffer(size); +// +// Converting a PP_Var to an ArrayBufferVar: +// ArrayBufferVar* array = ArrayBufferVar::FromPPVar(var); +// if (!array) +// return false; // Not an ArrayBuffer or an invalid var. +// DoSomethingWithTheBuffer(array); +class PPAPI_SHARED_EXPORT ArrayBufferVar : public Var { + public: + ArrayBufferVar(); + virtual ~ArrayBufferVar(); + + virtual void* Map() = 0; + virtual uint32 ByteLength() = 0; + + // Var override. + virtual ArrayBufferVar* AsArrayBufferVar() OVERRIDE; + virtual PP_VarType GetType() const OVERRIDE; + + // Helper function that converts a PP_Var to an ArrayBufferVar. This will + // return NULL if the PP_Var is not of ArrayBuffer type. + static ArrayBufferVar* FromPPVar(PP_Var var); + + private: + DISALLOW_COPY_AND_ASSIGN(ArrayBufferVar); +}; + } // namespace ppapi #endif // PPAPI_SHARED_IMPL_VAR_H_ |