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

Unified Diff: ppapi/proxy/ppb_font_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_file_ref_proxy.cc ('k') | ppapi/proxy/ppb_input_event_proxy.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/proxy/ppb_font_proxy.cc
===================================================================
--- ppapi/proxy/ppb_font_proxy.cc (revision 96002)
+++ ppapi/proxy/ppb_font_proxy.cc (working copy)
@@ -13,10 +13,12 @@
#include "ppapi/proxy/serialized_var.h"
#include "ppapi/shared_impl/ppapi_preferences.h"
#include "ppapi/shared_impl/resource_object_base.h"
+#include "ppapi/shared_impl/var.h"
#include "ppapi/thunk/enter.h"
#include "ppapi/thunk/ppb_image_data_api.h"
#include "ppapi/thunk/thunk.h"
+using ppapi::StringVar;
using ppapi::thunk::EnterResourceNoLock;
using ppapi::thunk::PPB_ImageData_API;
using ppapi::WebKitForwarding;
@@ -28,12 +30,11 @@
bool PPTextRunToTextRun(const PP_TextRun_Dev* run,
WebKitForwarding::Font::TextRun* output) {
- const std::string* str = PluginVarTracker::GetInstance()->GetExistingString(
- run->text);
+ scoped_refptr<StringVar> str(StringVar::FromPPVar(run->text));
if (!str)
return false;
- output->text = *str;
+ output->text = str->value();
output->rtl = PP_ToBool(run->rtl);
output->override_direction = PP_ToBool(run->override_direction);
return true;
@@ -82,10 +83,7 @@
new PpapiHostMsg_PPBFont_GetFontFamilies(&families));
}
- PP_Var result;
- result.type = PP_VARTYPE_STRING;
- result.value.as_id = PluginVarTracker::GetInstance()->MakeString(families);
- return result;
+ return StringVar::StringToPPVar(0, families);
}
bool PPB_Font_Proxy::OnMessageReceived(const IPC::Message& msg) {
@@ -99,8 +97,7 @@
: PluginResource(resource),
webkit_event_(false, false) {
TRACE_EVENT0("ppapi proxy", "Font::Font");
- const std::string* face = PluginVarTracker::GetInstance()->GetExistingString(
- desc.face);
+ scoped_refptr<StringVar> face(StringVar::FromPPVar(desc.face));
WebKitForwarding* forwarding = GetDispatcher()->GetWebKitForwarding();
@@ -108,7 +105,7 @@
RunOnWebKitThread(base::Bind(&WebKitForwarding::CreateFontForwarding,
base::Unretained(forwarding),
&webkit_event_, desc,
- face ? *face : std::string(),
+ face.get() ? face->value() : std::string(),
GetDispatcher()->preferences(),
&result));
font_forwarding_.reset(result);
@@ -135,13 +132,10 @@
&webkit_event_, description, &face, metrics,
&result));
- if (result == PP_TRUE) {
- description->face.type = PP_VARTYPE_STRING;
- description->face.value.as_id =
- PluginVarTracker::GetInstance()->MakeString(face);
- } else {
- description->face.type = PP_VARTYPE_UNDEFINED;
- }
+ if (PP_ToBool(result))
+ description->face = StringVar::StringToPPVar(0, face);
+ else
+ description->face = PP_MakeUndefined();
return result;
}
« no previous file with comments | « ppapi/proxy/ppb_file_ref_proxy.cc ('k') | ppapi/proxy/ppb_input_event_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698