summaryrefslogtreecommitdiffstats
path: root/chrome/plugin/npobject_util.cc
diff options
context:
space:
mode:
authordarin@google.com <darin@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-06 18:44:29 +0000
committerdarin@google.com <darin@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-06 18:44:29 +0000
commit6408eba7f314035688d4222360d0b0346f0ed2f7 (patch)
treeb86b552ee768762b4ebdd581779bcbe6b3c16ed9 /chrome/plugin/npobject_util.cc
parente6d08cad82c6175196682a0730be347d5dddd415 (diff)
downloadchromium_src-6408eba7f314035688d4222360d0b0346f0ed2f7.zip
chromium_src-6408eba7f314035688d4222360d0b0346f0ed2f7.tar.gz
chromium_src-6408eba7f314035688d4222360d0b0346f0ed2f7.tar.bz2
Improve NPRuntime marshalling by adding glue functions for serializing / deserializing a NPIdentifier. Also kill some extraneous std::string copies in NPVariant_Param code.
If you like I could eliminate NPIdentifier_Param in place of using NPIdentifier directly. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@442 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/plugin/npobject_util.cc')
-rw-r--r--chrome/plugin/npobject_util.cc21
1 files changed, 5 insertions, 16 deletions
diff --git a/chrome/plugin/npobject_util.cc b/chrome/plugin/npobject_util.cc
index fa6f68e..1f4b67d 100644
--- a/chrome/plugin/npobject_util.cc
+++ b/chrome/plugin/npobject_util.cc
@@ -150,22 +150,11 @@ bool IsPluginProcess() {
}
void CreateNPIdentifierParam(NPIdentifier id, NPIdentifier_Param* param) {
- param->is_string = NPN_IdentifierIsString(id);
- if (param->is_string) {
- NPUTF8* utf8 = NPN_UTF8FromIdentifier(id);
- param->string = utf8;
- NPN_MemFree(utf8);
- } else {
- param->number = NPN_IntFromIdentifier(id);
- }
+ param->identifier = id;
}
-NPIdentifier CreateNPIdentifier(const NPIdentifier_Param& param) {
- if (param.is_string) {
- return NPN_GetStringIdentifier(param.string.c_str());
- } else {
- return NPN_GetIntIdentifier(param.number);
- }
+NPIdentifier CreateNPIdentifier(const NPIdentifier_Param& param) {
+ return param.identifier;
}
void CreateNPVariantParam(const NPVariant& variant,
@@ -194,8 +183,8 @@ void CreateNPVariantParam(const NPVariant& variant,
case NPVariantType_String:
param->type = NPVARIANT_PARAM_STRING;
if (variant.value.stringValue.UTF8Length) {
- param->string_value = std::string(variant.value.stringValue.UTF8Characters,
- variant.value.stringValue.UTF8Length);
+ param->string_value.assign(variant.value.stringValue.UTF8Characters,
+ variant.value.stringValue.UTF8Length);
}
break;
case NPVariantType_Object: