summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authordmichael@chromium.org <dmichael@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-07 22:50:43 +0000
committerdmichael@chromium.org <dmichael@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-07 22:50:43 +0000
commit872caf56ebb67c01a01d0c8c612e171fd4332624 (patch)
treeb574e7c9f2ac638f3dcd047bf58acc5365752df9 /webkit
parentf498828c37cca39771d2a578c609020b5293197c (diff)
downloadchromium_src-872caf56ebb67c01a01d0c8c612e171fd4332624.zip
chromium_src-872caf56ebb67c01a01d0c8c612e171fd4332624.tar.gz
chromium_src-872caf56ebb67c01a01d0c8c612e171fd4332624.tar.bz2
Remove PP_Module from parameters for PPB_Var.VarFromUtf8.
This change has tendrils stretching throughout the code, but mostly this lets us delete a bunch of stuff. This also does a slight refactor to put the PPB_Var implementations in 1 place, since they were already practically identical, and I didn't want to do the backwards-compat code in 2 places. BUG=106596 TEST=N/A TBR=darin,tony darin,tony TBR for rubber-stamp of webkit/glue/webkit_glue.gypi Review URL: http://codereview.chromium.org/8826011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@113491 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/glue/webkit_glue.gypi4
-rw-r--r--webkit/plugins/ppapi/host_var_tracker.h1
-rw-r--r--webkit/plugins/ppapi/message_channel.cc2
-rw-r--r--webkit/plugins/ppapi/npapi_glue.cc35
-rw-r--r--webkit/plugins/ppapi/npapi_glue.h35
-rw-r--r--webkit/plugins/ppapi/npobject_var.cc6
-rw-r--r--webkit/plugins/ppapi/npobject_var.h3
-rw-r--r--webkit/plugins/ppapi/plugin_module.cc9
-rw-r--r--webkit/plugins/ppapi/plugin_object.cc4
-rw-r--r--webkit/plugins/ppapi/ppapi_plugin_instance.cc12
-rw-r--r--webkit/plugins/ppapi/ppb_file_ref_impl.cc4
-rw-r--r--webkit/plugins/ppapi/ppb_flash_clipboard_impl.cc3
-rw-r--r--webkit/plugins/ppapi/ppb_flash_impl.cc4
-rw-r--r--webkit/plugins/ppapi/ppb_font_impl.cc3
-rw-r--r--webkit/plugins/ppapi/ppb_transport_impl.cc3
-rw-r--r--webkit/plugins/ppapi/ppb_url_response_info_impl.cc15
-rw-r--r--webkit/plugins/ppapi/ppb_var_deprecated_impl.cc (renamed from webkit/plugins/ppapi/ppb_var_impl.cc)92
-rw-r--r--webkit/plugins/ppapi/ppb_var_deprecated_impl.h (renamed from webkit/plugins/ppapi/ppb_var_impl.h)10
-rw-r--r--webkit/plugins/ppapi/ppb_websocket_impl.cc15
19 files changed, 74 insertions, 186 deletions
diff --git a/webkit/glue/webkit_glue.gypi b/webkit/glue/webkit_glue.gypi
index 571c7be..2f3a882 100644
--- a/webkit/glue/webkit_glue.gypi
+++ b/webkit/glue/webkit_glue.gypi
@@ -303,8 +303,8 @@
'../plugins/ppapi/ppb_url_request_info_impl.h',
'../plugins/ppapi/ppb_url_response_info_impl.cc',
'../plugins/ppapi/ppb_url_response_info_impl.h',
- '../plugins/ppapi/ppb_var_impl.cc',
- '../plugins/ppapi/ppb_var_impl.h',
+ '../plugins/ppapi/ppb_var_deprecated_impl.cc',
+ '../plugins/ppapi/ppb_var_deprecated_impl.h',
'../plugins/ppapi/ppb_video_capture_impl.cc',
'../plugins/ppapi/ppb_video_capture_impl.h',
'../plugins/ppapi/ppb_video_decoder_impl.cc',
diff --git a/webkit/plugins/ppapi/host_var_tracker.h b/webkit/plugins/ppapi/host_var_tracker.h
index 73b4272..a4344df 100644
--- a/webkit/plugins/ppapi/host_var_tracker.h
+++ b/webkit/plugins/ppapi/host_var_tracker.h
@@ -14,7 +14,6 @@
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "ppapi/c/pp_instance.h"
-#include "ppapi/c/pp_module.h"
#include "ppapi/c/pp_resource.h"
#include "ppapi/shared_impl/function_group_base.h"
#include "ppapi/shared_impl/resource_tracker.h"
diff --git a/webkit/plugins/ppapi/message_channel.cc b/webkit/plugins/ppapi/message_channel.cc
index 33b32b7..1c3cd86 100644
--- a/webkit/plugins/ppapi/message_channel.cc
+++ b/webkit/plugins/ppapi/message_channel.cc
@@ -111,7 +111,7 @@ PP_Var CopyPPVar(const PP_Var& var) {
StringVar* string = StringVar::FromPPVar(var);
if (!string)
return PP_MakeUndefined();
- return StringVar::StringToPPVar(string->pp_module(), string->value());
+ return StringVar::StringToPPVar(string->value());
} else {
return var;
}
diff --git a/webkit/plugins/ppapi/npapi_glue.cc b/webkit/plugins/ppapi/npapi_glue.cc
index 7f166cd..6b94d93 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);
diff --git a/webkit/plugins/ppapi/npapi_glue.h b/webkit/plugins/ppapi/npapi_glue.h
index c59de0a..f732402 100644
--- a/webkit/plugins/ppapi/npapi_glue.h
+++ b/webkit/plugins/ppapi/npapi_glue.h
@@ -47,9 +47,8 @@ WEBKIT_PLUGINS_EXPORT PP_Var NPVariantToPPVar(PluginInstance* instance,
NPIdentifier PPVarToNPIdentifier(PP_Var var);
// Returns a PP_Var corresponding to the given identifier. In the case of
-// a string identifier, the string will be allocated associated with the
-// given module. A returned string will have a reference count of 1.
-PP_Var NPIdentifierToPPVar(PP_Module module, NPIdentifier id);
+// a string identifier, the returned string will have a reference count of 1.
+PP_Var NPIdentifierToPPVar(NPIdentifier id);
// Helper function to create a PP_Var of type object that contains the given
// NPObject for use byt he given module. Calling this function multiple times
@@ -57,7 +56,7 @@ PP_Var NPIdentifierToPPVar(PP_Module module, NPIdentifier id);
// there is still a PP_Var with a reference open to it from the previous
// call.
//
-// The module is necessary because we can have different modules pointing to
+// The instance is necessary because we can have different instances pointing to
// the same NPObject, and we want to keep their refs separate.
//
// If no ObjectVar currently exists corresponding to the NPObject, one is
@@ -231,42 +230,20 @@ class TryCatch {
// The given exception may be NULL if the consumer isn't interested in
// catching exceptions. If non-NULL, the given var will be updated if any
// exception is thrown (so it must outlive the TryCatch object).
- //
- // The module associated with the exception is passed so we know which module
- // to associate any exception string with. It may be NULL if you don't know
- // the module at construction time, in which case you should set it later
- // by calling set_module().
- //
- // If an exception is thrown when the module is NULL, setting *any* exception
- // will result in using the InvalidObjectException.
- TryCatch(PP_Module module, PP_Var* exception);
+ TryCatch(PP_Var* exception);
~TryCatch();
- // Get and set the module. This may be NULL (see the constructor).
- PP_Module pp_module() { return pp_module_; }
- void set_pp_module(PP_Module module) { pp_module_ = module; }
-
// Returns true is an exception has been thrown. This can be true immediately
// after construction if the var passed to the constructor is non-void.
bool has_exception() const { return has_exception_; }
- // Sets the given exception. If no module has been set yet, the message will
- // be ignored (since we have no module to associate the string with) and the
- // SetInvalidObjectException() will be used instead.
- //
- // If an exception has been previously set, this function will do nothing
- // (normally you want only the first exception).
+ // Sets the given exception. If an exception has been previously set, this
+ // function will do nothing (normally you want only the first exception).
void SetException(const char* message);
- // Sets the exception to be a generic message contained in a magic string
- // not associated with any module.
- void SetInvalidObjectException();
-
private:
static void Catch(void* self, const char* message);
- PP_Module pp_module_;
-
// True if an exception has been thrown. Since the exception itself may be
// NULL if the plugin isn't interested in getting the exception, this will
// always indicate if SetException has been called, regardless of whether
diff --git a/webkit/plugins/ppapi/npobject_var.cc b/webkit/plugins/ppapi/npobject_var.cc
index 348e6ea..5a88176 100644
--- a/webkit/plugins/ppapi/npobject_var.cc
+++ b/webkit/plugins/ppapi/npobject_var.cc
@@ -17,11 +17,9 @@ namespace ppapi {
// NPObjectVar -----------------------------------------------------------------
-NPObjectVar::NPObjectVar(PP_Module module,
- PP_Instance instance,
+NPObjectVar::NPObjectVar(PP_Instance instance,
NPObject* np_object)
- : Var(module),
- pp_instance_(instance),
+ : pp_instance_(instance),
np_object_(np_object) {
WebBindings::retainObject(np_object_);
HostGlobals::Get()->host_var_tracker()->AddNPObjectVar(this);
diff --git a/webkit/plugins/ppapi/npobject_var.h b/webkit/plugins/ppapi/npobject_var.h
index 597799a..83430f3 100644
--- a/webkit/plugins/ppapi/npobject_var.h
+++ b/webkit/plugins/ppapi/npobject_var.h
@@ -9,7 +9,6 @@
#include "base/compiler_specific.h"
#include "ppapi/c/pp_instance.h"
-#include "ppapi/c/pp_module.h"
#include "ppapi/shared_impl/var.h"
#include "webkit/plugins/webkit_plugins_export.h"
@@ -33,7 +32,7 @@ class NPObjectVar : public Var {
// You should always use FromNPObject to create an NPObjectVar. This function
// guarantees that we maintain the 1:1 mapping between NPObject and
// NPObjectVar.
- NPObjectVar(PP_Module module, PP_Instance instance, NPObject* np_object);
+ NPObjectVar(PP_Instance instance, NPObject* np_object);
virtual ~NPObjectVar();
diff --git a/webkit/plugins/ppapi/plugin_module.cc b/webkit/plugins/ppapi/plugin_module.cc
index fc5b2a1..6845fb1 100644
--- a/webkit/plugins/ppapi/plugin_module.cc
+++ b/webkit/plugins/ppapi/plugin_module.cc
@@ -85,6 +85,7 @@
#include "ppapi/c/trusted/ppb_url_loader_trusted.h"
#include "ppapi/shared_impl/ppb_input_event_shared.h"
#include "ppapi/shared_impl/ppb_opengles2_shared.h"
+#include "ppapi/shared_impl/ppb_var_impl.h"
#include "ppapi/shared_impl/time_conversion.h"
#include "ppapi/thunk/enter.h"
#include "ppapi/thunk/thunk.h"
@@ -109,7 +110,7 @@
#include "webkit/plugins/ppapi/ppb_proxy_impl.h"
#include "webkit/plugins/ppapi/ppb_scrollbar_impl.h"
#include "webkit/plugins/ppapi/ppb_uma_private_impl.h"
-#include "webkit/plugins/ppapi/ppb_var_impl.h"
+#include "webkit/plugins/ppapi/ppb_var_deprecated_impl.h"
#include "webkit/plugins/ppapi/ppb_video_capture_impl.h"
#include "webkit/plugins/ppapi/ppb_video_decoder_impl.h"
#include "webkit/plugins/ppapi/ppb_video_layer_impl.h"
@@ -322,9 +323,11 @@ const void* GetInterface(const char* name) {
if (strcmp(name, PPB_URLLOADERTRUSTED_INTERFACE) == 0)
return ::ppapi::thunk::GetPPB_URLLoaderTrusted_Thunk();
if (strcmp(name, PPB_VAR_DEPRECATED_INTERFACE) == 0)
- return PPB_Var_Impl::GetVarDeprecatedInterface();
+ return PPB_Var_Deprecated_Impl::GetVarDeprecatedInterface();
if (strcmp(name, PPB_VAR_INTERFACE_1_0) == 0)
- return PPB_Var_Impl::GetVarInterface();
+ return ::ppapi::PPB_Var_Impl::GetVarInterface1_0();
+ if (strcmp(name, PPB_VAR_INTERFACE_1_1) == 0)
+ return ::ppapi::PPB_Var_Impl::GetVarInterface();
#ifdef ENABLE_FLAPPER_HACKS
if (strcmp(name, PPB_FLASH_NETCONNECTOR_INTERFACE) == 0)
diff --git a/webkit/plugins/ppapi/plugin_object.cc b/webkit/plugins/ppapi/plugin_object.cc
index 5cd5396..61f155b 100644
--- a/webkit/plugins/ppapi/plugin_object.cc
+++ b/webkit/plugins/ppapi/plugin_object.cc
@@ -195,8 +195,8 @@ bool WrapperClass_Enumerate(NPObject* object, NPIdentifier** values,
for (uint32_t i = 0; i < property_count; ++i) {
if (!((*values)[i] = PPVarToNPIdentifier(properties[i]))) {
// Throw an exception for the failed convertion.
- *result_converter.exception() = StringVar::StringToPPVar(
- obj->instance()->module()->pp_module(), kInvalidValueException);
+ *result_converter.exception() =
+ StringVar::StringToPPVar(kInvalidValueException);
break;
}
(*count)++;
diff --git a/webkit/plugins/ppapi/ppapi_plugin_instance.cc b/webkit/plugins/ppapi/ppapi_plugin_instance.cc
index 92882f9..3d75d86 100644
--- a/webkit/plugins/ppapi/ppapi_plugin_instance.cc
+++ b/webkit/plugins/ppapi/ppapi_plugin_instance.cc
@@ -1692,7 +1692,7 @@ PP_Var PluginInstance::ExecuteScript(PP_Instance instance,
// a reference to ourselves so that we can still process the result after the
// WebBindings::evaluate() below.
scoped_refptr<PluginInstance> ref(this);
- TryCatch try_catch(module()->pp_module(), exception);
+ TryCatch try_catch(exception);
if (try_catch.has_exception())
return PP_MakeUndefined();
@@ -1731,7 +1731,7 @@ PP_Var PluginInstance::ExecuteScript(PP_Instance instance,
PP_Var PluginInstance::GetDefaultCharSet(PP_Instance instance) {
std::string encoding = delegate()->GetDefaultEncoding();
- return StringVar::StringToPPVar(module()->pp_module(), encoding);
+ return StringVar::StringToPPVar(encoding);
}
void PluginInstance::Log(PP_Instance instance,
@@ -1896,7 +1896,6 @@ PP_Var PluginInstance::ResolveRelativeToDocument(
WebElement plugin_element = container()->element();
GURL document_url = plugin_element.document().baseURL();
return ::ppapi::PPB_URLUtil_Shared::GenerateURLReturn(
- module()->pp_module(),
document_url.Resolve(relative_string->value()),
components);
}
@@ -1933,15 +1932,14 @@ PP_Bool PluginInstance::DocumentCanAccessDocument(PP_Instance instance,
PP_Var PluginInstance::GetDocumentURL(PP_Instance instance,
PP_URLComponents_Dev* components) {
WebKit::WebDocument document = container()->element().document();
- return ::ppapi::PPB_URLUtil_Shared::GenerateURLReturn(
- module()->pp_module(), document.url(), components);
+ return ::ppapi::PPB_URLUtil_Shared::GenerateURLReturn(document.url(),
+ components);
}
PP_Var PluginInstance::GetPluginInstanceURL(
PP_Instance instance,
PP_URLComponents_Dev* components) {
- return ::ppapi::PPB_URLUtil_Shared::GenerateURLReturn(module()->pp_module(),
- plugin_url_,
+ return ::ppapi::PPB_URLUtil_Shared::GenerateURLReturn(plugin_url_,
components);
}
diff --git a/webkit/plugins/ppapi/ppb_file_ref_impl.cc b/webkit/plugins/ppapi/ppb_file_ref_impl.cc
index bc0de22..8cdcd76 100644
--- a/webkit/plugins/ppapi/ppb_file_ref_impl.cc
+++ b/webkit/plugins/ppapi/ppb_file_ref_impl.cc
@@ -248,11 +248,7 @@ PP_Var PPB_FileRef_Impl::GetAbsolutePath() {
if (GetFileSystemType() != PP_FILESYSTEMTYPE_EXTERNAL)
return GetPath();
if (!external_path_var_.get()) {
- PluginModule* plugin_module = ResourceHelper::GetPluginModule(this);
- if (!plugin_module)
- return PP_MakeNull();
external_path_var_ = new StringVar(
- plugin_module->pp_module(),
external_file_system_path_.AsUTF8Unsafe());
}
return external_path_var_->GetPPVar();
diff --git a/webkit/plugins/ppapi/ppb_flash_clipboard_impl.cc b/webkit/plugins/ppapi/ppb_flash_clipboard_impl.cc
index 432c132..3f2e083 100644
--- a/webkit/plugins/ppapi/ppb_flash_clipboard_impl.cc
+++ b/webkit/plugins/ppapi/ppb_flash_clipboard_impl.cc
@@ -19,7 +19,6 @@
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h"
#include "webkit/plugins/ppapi/common.h"
#include "webkit/plugins/ppapi/host_globals.h"
-#include "webkit/plugins/ppapi/plugin_module.h"
#include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
using ppapi::StringVar;
@@ -98,7 +97,7 @@ PP_Var PPB_Flash_Clipboard_Impl::ReadPlainText(
}
WebKit::WebCString s =
web_clipboard->readPlainText(ConvertClipboardType(clipboard_type)).utf8();
- return StringVar::StringToPPVar(instance_->module()->pp_module(), s);
+ return StringVar::StringToPPVar(s);
}
int32_t PPB_Flash_Clipboard_Impl::WritePlainText(
diff --git a/webkit/plugins/ppapi/ppb_flash_impl.cc b/webkit/plugins/ppapi/ppb_flash_impl.cc
index 6d75d15..b490316 100644
--- a/webkit/plugins/ppapi/ppb_flash_impl.cc
+++ b/webkit/plugins/ppapi/ppb_flash_impl.cc
@@ -50,7 +50,7 @@ PP_Var GetProxyForURL(PP_Instance pp_instance, const char* url) {
std::string proxy_host = instance->delegate()->ResolveProxy(gurl);
if (proxy_host.empty())
return PP_MakeUndefined(); // No proxy.
- return StringVar::StringToPPVar(instance->module()->pp_module(), proxy_host);
+ return StringVar::StringToPPVar(proxy_host);
}
int32_t Navigate(PP_Resource request_id,
@@ -110,7 +110,7 @@ PP_Var GetCommandLineArgs(PP_Module pp_module) {
return PP_MakeUndefined();
std::string args = instance->delegate()->GetFlashCommandLineArgs();
- return StringVar::StringToPPVar(pp_module, args);
+ return StringVar::StringToPPVar(args);
}
const PPB_Flash ppb_flash = {
diff --git a/webkit/plugins/ppapi/ppb_font_impl.cc b/webkit/plugins/ppapi/ppb_font_impl.cc
index cac50b5..0c439d0 100644
--- a/webkit/plugins/ppapi/ppb_font_impl.cc
+++ b/webkit/plugins/ppapi/ppb_font_impl.cc
@@ -86,8 +86,7 @@ PP_Bool PPB_Font_Impl::Describe(PP_FontDescription_Dev* description,
return PP_FALSE;
// Convert the string.
- description->face = StringVar::StringToPPVar(plugin_module->pp_module(),
- face);
+ description->face = StringVar::StringToPPVar(face);
return PP_TRUE;
}
diff --git a/webkit/plugins/ppapi/ppb_transport_impl.cc b/webkit/plugins/ppapi/ppb_transport_impl.cc
index efed706..44593d4 100644
--- a/webkit/plugins/ppapi/ppb_transport_impl.cc
+++ b/webkit/plugins/ppapi/ppb_transport_impl.cc
@@ -281,8 +281,7 @@ int32_t PPB_Transport_Impl::GetNextAddress(PP_Var* address,
return PP_ERROR_FAILED;
if (!local_candidates_.empty()) {
- *address = StringVar::StringToPPVar(plugin_module->pp_module(),
- local_candidates_.front());
+ *address = StringVar::StringToPPVar(local_candidates_.front());
local_candidates_.pop_front();
return PP_OK;
}
diff --git a/webkit/plugins/ppapi/ppb_url_response_info_impl.cc b/webkit/plugins/ppapi/ppb_url_response_info_impl.cc
index c788e99..cb96f8e 100644
--- a/webkit/plugins/ppapi/ppb_url_response_info_impl.cc
+++ b/webkit/plugins/ppapi/ppb_url_response_info_impl.cc
@@ -12,7 +12,6 @@
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLResponse.h"
#include "webkit/plugins/ppapi/common.h"
-#include "webkit/plugins/ppapi/plugin_module.h"
#include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
#include "webkit/plugins/ppapi/ppb_file_ref_impl.h"
#include "webkit/plugins/ppapi/resource_helper.h"
@@ -85,27 +84,23 @@ PPB_URLResponseInfo_API* PPB_URLResponseInfo_Impl::AsPPB_URLResponseInfo_API() {
}
PP_Var PPB_URLResponseInfo_Impl::GetProperty(PP_URLResponseProperty property) {
- PluginModule* plugin_module = ResourceHelper::GetPluginModule(this);
- if (!plugin_module)
- return PP_MakeUndefined();
- PP_Module pp_module = plugin_module->pp_module();
switch (property) {
case PP_URLRESPONSEPROPERTY_URL:
- return StringVar::StringToPPVar(pp_module, url_);
+ return StringVar::StringToPPVar(url_);
case PP_URLRESPONSEPROPERTY_REDIRECTURL:
if (IsRedirect(status_code_))
- return StringVar::StringToPPVar(pp_module, redirect_url_);
+ return StringVar::StringToPPVar(redirect_url_);
break;
case PP_URLRESPONSEPROPERTY_REDIRECTMETHOD:
if (IsRedirect(status_code_))
- return StringVar::StringToPPVar(pp_module, status_text_);
+ return StringVar::StringToPPVar(status_text_);
break;
case PP_URLRESPONSEPROPERTY_STATUSCODE:
return PP_MakeInt32(status_code_);
case PP_URLRESPONSEPROPERTY_STATUSLINE:
- return StringVar::StringToPPVar(pp_module, status_text_);
+ return StringVar::StringToPPVar(status_text_);
case PP_URLRESPONSEPROPERTY_HEADERS:
- return StringVar::StringToPPVar(pp_module, headers_);
+ return StringVar::StringToPPVar(headers_);
}
// The default is to return an undefined PP_Var.
return PP_MakeUndefined();
diff --git a/webkit/plugins/ppapi/ppb_var_impl.cc b/webkit/plugins/ppapi/ppb_var_deprecated_impl.cc
index d76864e..c946222 100644
--- a/webkit/plugins/ppapi/ppb_var_impl.cc
+++ b/webkit/plugins/ppapi/ppb_var_deprecated_impl.cc
@@ -2,13 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "webkit/plugins/ppapi/ppb_var_impl.h"
+#include "webkit/plugins/ppapi/ppb_var_deprecated_impl.h"
#include <limits>
#include "ppapi/c/dev/ppb_var_deprecated.h"
#include "ppapi/c/ppb_var.h"
#include "ppapi/c/pp_var.h"
+#include "ppapi/shared_impl/ppb_var_impl.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h"
#include "webkit/plugins/ppapi/common.h"
#include "webkit/plugins/ppapi/host_globals.h"
@@ -17,7 +18,6 @@
#include "webkit/plugins/ppapi/plugin_module.h"
#include "webkit/plugins/ppapi/plugin_object.h"
#include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
-#include "v8/include/v8.h"
using ppapi::NPObjectVar;
using ppapi::PpapiGlobals;
@@ -109,16 +109,10 @@ bool PPVarToNPVariantNoCopy(PP_Var var, NPVariant* result) {
class ObjectAccessorTryCatch : public TryCatch {
public:
ObjectAccessorTryCatch(PP_Var object, PP_Var* exception)
- : TryCatch(0, exception),
+ : TryCatch(exception),
object_(NPObjectVar::FromPPVar(object)) {
if (!object_) {
- // No object or an invalid object was given. This means we have no module
- // to associated with the exception text, so use the magic invalid object
- // exception.
- SetInvalidObjectException();
- } else {
- // When the object is valid, we have a valid module to associate
- set_pp_module(object_->pp_module());
+ SetException(kInvalidObjectException);
}
}
@@ -168,32 +162,6 @@ class ObjectAccessorWithIdentifierTryCatch : public ObjectAccessorTryCatch {
DISALLOW_COPY_AND_ASSIGN(ObjectAccessorWithIdentifierTryCatch);
};
-// PPB_Var methods -------------------------------------------------------------
-
-void AddRefVar(PP_Var var) {
- PpapiGlobals::Get()->GetVarTracker()->AddRefVar(var);
-}
-
-void ReleaseVar(PP_Var var) {
- PpapiGlobals::Get()->GetVarTracker()->ReleaseVar(var);
-}
-
-PP_Var VarFromUtf8(PP_Module module, const char* data, uint32_t len) {
- return StringVar::StringToPPVar(module, data, len);
-}
-
-const char* VarToUtf8(PP_Var var, uint32_t* len) {
- StringVar* str = StringVar::FromPPVar(var);
- if (!str) {
- *len = 0;
- return NULL;
- }
- *len = static_cast<uint32_t>(str->value().size());
- if (str->value().empty())
- return ""; // Don't return NULL on success.
- return str->value().data();
-}
-
PP_Bool HasProperty(PP_Var var,
PP_Var name,
PP_Var* exception) {
@@ -266,9 +234,7 @@ void EnumerateProperties(PP_Var var,
*property_count = count;
*properties = static_cast<PP_Var*>(malloc(sizeof(PP_Var) * count));
for (uint32_t i = 0; i < count; ++i) {
- (*properties)[i] = NPIdentifierToPPVar(
- accessor.GetPluginInstance()->module()->pp_module(),
- identifiers[i]);
+ (*properties)[i] = NPIdentifierToPPVar(identifiers[i]);
}
free(identifiers);
}
@@ -426,40 +392,28 @@ PP_Var CreateObjectWithModuleDeprecated(PP_Module pp_module,
ppp_class, ppp_class_data);
}
-const PPB_Var_Deprecated var_deprecated_interface = {
- &AddRefVar,
- &ReleaseVar,
- &VarFromUtf8,
- &VarToUtf8,
- &HasPropertyDeprecated,
- &HasMethodDeprecated,
- &GetProperty,
- &EnumerateProperties,
- &SetPropertyDeprecated,
- &DeletePropertyDeprecated,
- &CallDeprecated,
- &Construct,
- &IsInstanceOfDeprecated,
- &CreateObjectDeprecated,
- &CreateObjectWithModuleDeprecated,
-};
-
-const PPB_Var var_interface = {
- &AddRefVar,
- &ReleaseVar,
- &VarFromUtf8,
- &VarToUtf8
-};
-
} // namespace
// static
-const PPB_Var* PPB_Var_Impl::GetVarInterface() {
- return &var_interface;
-}
+const PPB_Var_Deprecated* PPB_Var_Deprecated_Impl::GetVarDeprecatedInterface() {
+ static const PPB_Var_Deprecated var_deprecated_interface = {
+ ::ppapi::PPB_Var_Impl::GetVarInterface1_0()->AddRef,
+ ::ppapi::PPB_Var_Impl::GetVarInterface1_0()->Release,
+ ::ppapi::PPB_Var_Impl::GetVarInterface1_0()->VarFromUtf8,
+ ::ppapi::PPB_Var_Impl::GetVarInterface1_0()->VarToUtf8,
+ &HasPropertyDeprecated,
+ &HasMethodDeprecated,
+ &GetProperty,
+ &EnumerateProperties,
+ &SetPropertyDeprecated,
+ &DeletePropertyDeprecated,
+ &CallDeprecated,
+ &Construct,
+ &IsInstanceOfDeprecated,
+ &CreateObjectDeprecated,
+ &CreateObjectWithModuleDeprecated,
+ };
-// static
-const PPB_Var_Deprecated* PPB_Var_Impl::GetVarDeprecatedInterface() {
return &var_deprecated_interface;
}
diff --git a/webkit/plugins/ppapi/ppb_var_impl.h b/webkit/plugins/ppapi/ppb_var_deprecated_impl.h
index d2c63a1..5e12400 100644
--- a/webkit/plugins/ppapi/ppb_var_impl.h
+++ b/webkit/plugins/ppapi/ppb_var_deprecated_impl.h
@@ -2,22 +2,20 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef WEBKIT_PLUGINS_PPAPI_PPB_VAR_IMPL_H_
-#define WEBKIT_PLUGINS_PPAPI_PPB_VAR_IMPL_H_
+#ifndef WEBKIT_PLUGINS_PPAPI_PPB_VAR_DEPRECATED_IMPL_H_
+#define WEBKIT_PLUGINS_PPAPI_PPB_VAR_DEPRECATED_IMPL_H_
-struct PPB_Var;
struct PPB_Var_Deprecated;
namespace webkit {
namespace ppapi {
-class PPB_Var_Impl {
+class PPB_Var_Deprecated_Impl {
public:
- static const PPB_Var* GetVarInterface();
static const PPB_Var_Deprecated* GetVarDeprecatedInterface();
};
} // namespace ppapi
} // namespace webkit
-#endif // WEBKIT_PLUGINS_PPAPI_PPB_VAR_IMPL_H_
+#endif // WEBKIT_PLUGINS_PPAPI_PPB_VAR_DEPRECATED_IMPL_H_
diff --git a/webkit/plugins/ppapi/ppb_websocket_impl.cc b/webkit/plugins/ppapi/ppb_websocket_impl.cc
index 9d4fc20..f460aea 100644
--- a/webkit/plugins/ppapi/ppb_websocket_impl.cc
+++ b/webkit/plugins/ppapi/ppb_websocket_impl.cc
@@ -84,8 +84,7 @@ PPB_WebSocket_Impl::PPB_WebSocket_Impl(PP_Instance instance)
close_was_clean_(PP_FALSE),
buffered_amount_(0),
buffered_amount_after_close_(0) {
- empty_string_ = new StringVar(
- PpapiGlobals::Get()->GetModuleForInstance(instance), "", 0);
+ empty_string_ = new StringVar("", 0);
}
PPB_WebSocket_Impl::~PPB_WebSocket_Impl() {
@@ -133,8 +132,7 @@ int32_t PPB_WebSocket_Impl::Connect(PP_Var url,
if (!url_string)
return PP_ERROR_BADARGUMENT;
GURL gurl(url_string->value());
- url_ = new StringVar(
- PpapiGlobals::Get()->GetModuleForInstance(pp_instance()), gurl.spec());
+ url_ = new StringVar(gurl.spec());
if (!gurl.is_valid())
return PP_ERROR_BADARGUMENT;
if (!gurl.SchemeIs("ws") && !gurl.SchemeIs("wss"))
@@ -368,8 +366,7 @@ PP_Var PPB_WebSocket_Impl::GetProtocol() {
return empty_string_->GetPPVar();
std::string protocol = websocket_->subprotocol().utf8();
- return StringVar::StringToPPVar(
- PpapiGlobals::Get()->GetModuleForInstance(pp_instance()), protocol);
+ return StringVar::StringToPPVar(protocol);
}
PP_WebSocketReadyState_Dev PPB_WebSocket_Impl::GetReadyState() {
@@ -395,8 +392,7 @@ void PPB_WebSocket_Impl::didReceiveMessage(const WebString& message) {
// Append received data to queue.
std::string string = message.utf8();
- PP_Var var = StringVar::StringToPPVar(
- PpapiGlobals::Get()->GetModuleForInstance(pp_instance()), string);
+ PP_Var var = StringVar::StringToPPVar(string);
received_messages_.push(var);
if (!wait_for_receive_)
@@ -451,8 +447,7 @@ void PPB_WebSocket_Impl::didClose(unsigned long unhandled_buffered_amount,
// Store code and reason.
close_code_ = code;
std::string reason_string = reason.utf8();
- close_reason_ = new StringVar(
- PpapiGlobals::Get()->GetModuleForInstance(pp_instance()), reason_string);
+ close_reason_ = new StringVar(reason_string);
// Set close_was_clean_.
bool was_clean =