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

Unified Diff: ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_var.cc

Issue 9169052: Tweaks to PPB_VarArrayBuffer in preperation for taking out of Dev. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixes based on review comments Created 8 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_var.cc
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_var.cc b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_var.cc
index 6315c51f9d35d60db2f98ecc92192e22c2c81afe..b642eb0c3d7d1dea3a685d814990cf965bf9ff34 100644
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_var.cc
+++ b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_var.cc
@@ -99,14 +99,18 @@ PP_Var CreateArrayBuffer(uint32_t size_in_bytes) {
return var;
}
-uint32_t ByteLength(PP_Var var) {
+PP_Bool ByteLength(PP_Var var, uint32_t* byte_length) {
DebugPrintf("PPB_VarArrayBuffer::ByteLength: var=PPB_Var(%s)\n",
PluginVar::DebugString(var).c_str());
SharedArrayBufferProxyVar buffer_var = ArrayBufferProxyVar::CastFromProxyVar(
ProxyVarCache::GetInstance().SharedProxyVarForVar(var));
- uint32_t len = buffer_var->buffer_length();
- DebugPrintf("PPB_VarArrayBuffer::ByteLength: length=%"NACL_PRIu32"\n", len);
- return len;
+ if (buffer_var) {
+ *byte_length = buffer_var->buffer_length();
+ DebugPrintf("PPB_VarArrayBuffer::ByteLength: length=%"NACL_PRIu32"\n",
+ *byte_length);
+ return PP_TRUE;
+ }
+ return PP_FALSE;
}
void* Map(PP_Var var) {
@@ -119,6 +123,12 @@ void* Map(PP_Var var) {
return data;
}
+void Unmap(PP_Var var) {
+ DebugPrintf("PPB_VarArrayBuffer::Unap: var=PPB_Var(%s)\n",
+ PluginVar::DebugString(var).c_str());
+ // We don't use shared memory, so there's nothing to do.
+}
+
} // namespace
const PPB_Var* PluginVar::GetInterface() {
@@ -145,7 +155,8 @@ const PPB_VarArrayBuffer_Dev* PluginVar::GetArrayBufferInterface() {
static const PPB_VarArrayBuffer_Dev interface = {
CreateArrayBuffer,
ByteLength,
- Map
+ Map,
+ Unmap
};
return &interface;
}
@@ -254,10 +265,11 @@ void PluginVar::Print(const PP_Var& var) {
case PP_VARTYPE_OBJECT:
DebugPrintf("PP_Var(object: %"NACL_PRIu64")", GetVarId(var));
break;
+ case PP_VARTYPE_ARRAY_BUFFER:
+ DebugPrintf("PP_Var(object: %"NACL_PRIu64")", GetVarId(var));
+ break;
case PP_VARTYPE_ARRAY:
case PP_VARTYPE_DICTIONARY:
- case PP_VARTYPE_ARRAY_BUFFER:
- NACL_NOTREACHED();
break;
}
}

Powered by Google App Engine
This is Rietveld 408576698