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

Unified Diff: ppapi/proxy/ppb_var_deprecated_proxy.cc

Issue 7578001: Unify var tracking between webkit and the proxy. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 4 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
« no previous file with comments | « ppapi/proxy/ppb_url_util_proxy.cc ('k') | ppapi/proxy/ppb_var_proxy.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/proxy/ppb_var_deprecated_proxy.cc
===================================================================
--- ppapi/proxy/ppb_var_deprecated_proxy.cc (revision 96002)
+++ ppapi/proxy/ppb_var_deprecated_proxy.cc (working copy)
@@ -14,11 +14,15 @@
#include "ppapi/c/ppb_core.h"
#include "ppapi/proxy/host_dispatcher.h"
#include "ppapi/proxy/plugin_dispatcher.h"
+#include "ppapi/proxy/plugin_resource_tracker.h"
#include "ppapi/proxy/plugin_var_tracker.h"
#include "ppapi/proxy/ppapi_messages.h"
#include "ppapi/proxy/ppp_class_proxy.h"
#include "ppapi/proxy/serialized_var.h"
+#include "ppapi/shared_impl/var.h"
+using ppapi::StringVar;
+
namespace pp {
namespace proxy {
@@ -35,17 +39,20 @@
if (exception && exception->type != PP_VARTYPE_UNDEFINED)
return NULL;
- PluginVarTracker* tracker = PluginVarTracker::GetInstance();
- PluginDispatcher* dispatcher = tracker->DispatcherForPluginObject(object);
- if (dispatcher)
- return dispatcher;
+ if (object.type == PP_VARTYPE_OBJECT) {
+ // Get the dispatcher for the object.
+ PluginDispatcher* dispatcher = PluginResourceTracker::GetInstance()->
+ var_tracker().DispatcherForPluginObject(object);
+ if (dispatcher)
+ return dispatcher;
+ }
+
// The object is invalid. This means we can't figure out which dispatcher
// to use, which is OK because the call will fail anyway. Set the exception.
if (exception) {
- exception->type = PP_VARTYPE_STRING;
- exception->value.as_id =
- tracker->MakeString("Attempting to use an invalid object");
+ *exception = StringVar::StringToPPVar(0,
+ std::string("Attempting to use an invalid object"));
}
return NULL;
}
@@ -53,27 +60,22 @@
// PPP_Var_Deprecated plugin ---------------------------------------------------
void AddRefVar(PP_Var var) {
- PluginVarTracker::GetInstance()->AddRef(var);
+ PluginResourceTracker::GetInstance()->var_tracker().AddRefVar(var);
}
void ReleaseVar(PP_Var var) {
- PluginVarTracker::GetInstance()->Release(var);
+ PluginResourceTracker::GetInstance()->var_tracker().ReleaseVar(var);
}
PP_Var VarFromUtf8(PP_Module module, const char* data, uint32_t len) {
- PP_Var ret = {};
- ret.type = PP_VARTYPE_STRING;
- ret.value.as_id = PluginVarTracker::GetInstance()->MakeString(
- data, len);
- return ret;
+ return StringVar::StringToPPVar(module, data, len);
}
const char* VarToUtf8(PP_Var var, uint32_t* len) {
- const std::string* str =
- PluginVarTracker::GetInstance()->GetExistingString(var);
+ scoped_refptr<StringVar> str(StringVar::FromPPVar(var));
if (str) {
- *len = static_cast<uint32_t>(str->size());
- return str->c_str();
+ *len = static_cast<uint32_t>(str->value().size());
+ return str->value().c_str();
}
*len = 0;
return NULL;
« no previous file with comments | « ppapi/proxy/ppb_url_util_proxy.cc ('k') | ppapi/proxy/ppb_var_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698