Index: webkit/plugins/ppapi/var.cc |
=================================================================== |
--- webkit/plugins/ppapi/var.cc (revision 0) |
+++ webkit/plugins/ppapi/var.cc (working copy) |
@@ -2,7 +2,7 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#include "webkit/glue/plugins/pepper_var.h" |
+#include "webkit/plugins/ppapi/var.h" |
#include <limits> |
@@ -13,15 +13,16 @@ |
#include "ppapi/c/ppb_var.h" |
#include "ppapi/c/pp_var.h" |
#include "third_party/WebKit/WebKit/chromium/public/WebBindings.h" |
-#include "webkit/glue/plugins/pepper_common.h" |
-#include "webkit/glue/plugins/pepper_plugin_instance.h" |
-#include "webkit/glue/plugins/pepper_plugin_module.h" |
-#include "webkit/glue/plugins/pepper_plugin_object.h" |
+#include "webkit/plugins/ppapi/common.h" |
+#include "webkit/plugins/ppapi/plugin_instance.h" |
+#include "webkit/plugins/ppapi/plugin_module.h" |
+#include "webkit/plugins/ppapi/plugin_object.h" |
#include "v8/include/v8.h" |
using WebKit::WebBindings; |
-namespace pepper { |
+namespace webkit { |
+namespace ppapi { |
namespace { |
@@ -652,6 +653,10 @@ |
Var::~Var() { |
} |
+Var* Var::AsVar() { |
+ return this; |
+} |
+ |
// static |
PP_Var Var::NPVariantToPPVar(PluginModule* module, const NPVariant* variant) { |
switch (variant->type) { |
@@ -710,7 +715,8 @@ |
if (var.type == PP_VARTYPE_STRING || var.type == PP_VARTYPE_OBJECT) { |
// TODO(brettw) consider checking that the ID is actually a var ID rather |
// than some random other resource ID. |
- if (!ResourceTracker::Get()->AddRefResource(var.value.as_id)) |
+ PP_Resource resource = static_cast<PP_Resource>(var.value.as_id); |
+ if (!ResourceTracker::Get()->AddRefResource(resource)) |
DLOG(WARNING) << "AddRefVar()ing a nonexistant string/object var."; |
} |
} |
@@ -720,7 +726,8 @@ |
if (var.type == PP_VARTYPE_STRING || var.type == PP_VARTYPE_OBJECT) { |
// TODO(brettw) consider checking that the ID is actually a var ID rather |
// than some random other resource ID. |
- if (!ResourceTracker::Get()->UnrefResource(var.value.as_id)) |
+ PP_Resource resource = static_cast<PP_Resource>(var.value.as_id); |
+ if (!ResourceTracker::Get()->UnrefResource(resource)) |
DLOG(WARNING) << "ReleaseVar()ing a nonexistant string/object var."; |
} |
} |
@@ -744,6 +751,10 @@ |
StringVar::~StringVar() { |
} |
+StringVar* StringVar::AsStringVar() { |
+ return this; |
+} |
+ |
// static |
PP_Var StringVar::StringToPPVar(PluginModule* module, const std::string& var) { |
return StringToPPVar(module, var.c_str(), var.size()); |
@@ -768,7 +779,8 @@ |
scoped_refptr<StringVar> StringVar::FromPPVar(PP_Var var) { |
if (var.type != PP_VARTYPE_STRING) |
return scoped_refptr<StringVar>(NULL); |
- return Resource::GetAs<StringVar>(var.value.as_id); |
+ PP_Resource resource = static_cast<PP_Resource>(var.value.as_id); |
+ return Resource::GetAs<StringVar>(resource); |
} |
// ObjectVar ------------------------------------------------------------- |
@@ -785,6 +797,10 @@ |
WebBindings::releaseObject(np_object_); |
} |
+ObjectVar* ObjectVar::AsObjectVar() { |
+ return this; |
+} |
+ |
// static |
PP_Var ObjectVar::NPObjectToPPVar(PluginModule* module, NPObject* object) { |
scoped_refptr<ObjectVar> object_var(module->ObjectVarForNPObject(object)); |
@@ -805,7 +821,8 @@ |
scoped_refptr<ObjectVar> ObjectVar::FromPPVar(PP_Var var) { |
if (var.type != PP_VARTYPE_OBJECT) |
return scoped_refptr<ObjectVar>(NULL); |
- return Resource::GetAs<ObjectVar>(var.value.as_id); |
+ PP_Resource resource = static_cast<PP_Resource>(var.value.as_id); |
+ return Resource::GetAs<ObjectVar>(resource); |
} |
// TryCatch -------------------------------------------------------------------- |
@@ -850,4 +867,6 @@ |
static_cast<TryCatch*>(self)->SetException(message); |
} |
-} // namespace pepper |
+} // namespace ppapi |
+} // namespace webkit |
+ |