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

Unified Diff: webkit/plugins/ppapi/npapi_glue.cc

Issue 8826011: Remove PP_Module from parameters for PPB_Var.VarFromUtf8. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge Created 9 years 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 | « webkit/plugins/ppapi/npapi_glue.h ('k') | webkit/plugins/ppapi/npobject_var.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/plugins/ppapi/npapi_glue.cc
diff --git a/webkit/plugins/ppapi/npapi_glue.cc b/webkit/plugins/ppapi/npapi_glue.cc
index 7f166cd969b2621dc506c897de66649bcc467285..6b94d9386607fa597a1d9e973ba0e5224b2f8d25 100644
--- a/webkit/plugins/ppapi/npapi_glue.cc
+++ b/webkit/plugins/ppapi/npapi_glue.cc
@@ -96,7 +96,6 @@ PP_Var NPVariantToPPVar(PluginInstance* instance, const NPVariant* variant) {
return PP_MakeDouble(NPVARIANT_TO_DOUBLE(*variant));
case NPVariantType_String:
return StringVar::StringToPPVar(
- instance->module()->pp_module(),
NPVARIANT_TO_STRING(*variant).UTF8Characters,
NPVARIANT_TO_STRING(*variant).UTF8Length);
case NPVariantType_Object:
@@ -121,13 +120,13 @@ NPIdentifier PPVarToNPIdentifier(PP_Var var) {
}
}
-PP_Var NPIdentifierToPPVar(PP_Module module, NPIdentifier id) {
+PP_Var NPIdentifierToPPVar(NPIdentifier id) {
const NPUTF8* string_value = NULL;
int32_t int_value = 0;
bool is_string = false;
WebBindings::extractIdentifierData(id, string_value, int_value, is_string);
if (is_string)
- return StringVar::StringToPPVar(module, string_value);
+ return StringVar::StringToPPVar(string_value);
return PP_MakeInt32(int_value);
}
@@ -138,8 +137,7 @@ PP_Var NPObjectToPPVar(PluginInstance* instance, NPObject* object) {
HostGlobals::Get()->host_var_tracker()->NPObjectVarForNPObject(
instance->pp_instance(), object));
if (!object_var) { // No object for this module yet, make a new one.
- object_var = new NPObjectVar(instance->module()->pp_module(),
- instance->pp_instance(), object);
+ object_var = new NPObjectVar(instance->pp_instance(), object);
}
return object_var->GetPPVar();
}
@@ -263,8 +261,7 @@ NPObjectAccessorWithIdentifier::NPObjectAccessorWithIdentifier(
: object_(PluginObject::FromNPObject(object)),
identifier_(PP_MakeUndefined()) {
if (object_) {
- identifier_ = NPIdentifierToPPVar(
- object_->instance()->module()->pp_module(), identifier);
+ identifier_ = NPIdentifierToPPVar(identifier);
if (identifier_.type == PP_VARTYPE_INT32 && !allow_integer_identifier)
identifier_.type = PP_VARTYPE_UNDEFINED; // Mark it invalid.
}
@@ -276,9 +273,8 @@ NPObjectAccessorWithIdentifier::~NPObjectAccessorWithIdentifier() {
// TryCatch --------------------------------------------------------------------
-TryCatch::TryCatch(PP_Module module, PP_Var* exception)
- : pp_module_(module),
- has_exception_(exception && exception->type != PP_VARTYPE_UNDEFINED),
+TryCatch::TryCatch(PP_Var* exception)
+ : has_exception_(exception && exception->type != PP_VARTYPE_UNDEFINED),
exception_(exception) {
WebBindings::pushExceptionHandler(&TryCatch::Catch, this);
}
@@ -288,31 +284,14 @@ TryCatch::~TryCatch() {
}
void TryCatch::SetException(const char* message) {
- if (!pp_module_) {
- // Don't have a module to make the string.
- SetInvalidObjectException();
- return;
- }
-
if (!has_exception()) {
has_exception_ = true;
if (exception_) {
- *exception_ = ::ppapi::StringVar::StringToPPVar(pp_module_,
- message, strlen(message));
+ *exception_ = ::ppapi::StringVar::StringToPPVar(message, strlen(message));
}
}
}
-void TryCatch::SetInvalidObjectException() {
- if (!has_exception()) {
- has_exception_ = true;
- // TODO(brettw) bug 54504: Have a global singleton string that can hold
- // a generic error message.
- if (exception_)
- *exception_ = PP_MakeInt32(1);
- }
-}
-
// static
void TryCatch::Catch(void* self, const char* message) {
static_cast<TryCatch*>(self)->SetException(message);
« no previous file with comments | « webkit/plugins/ppapi/npapi_glue.h ('k') | webkit/plugins/ppapi/npobject_var.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698