diff options
24 files changed, 26 insertions, 608 deletions
diff --git a/ppapi/c/ppb_instance.h b/ppapi/c/ppb_instance.h index dbda74d6..b2fa404 100644 --- a/ppapi/c/ppb_instance.h +++ b/ppapi/c/ppb_instance.h @@ -8,16 +8,10 @@ #include "ppapi/c/pp_bool.h" #include "ppapi/c/pp_instance.h" #include "ppapi/c/pp_resource.h" -#include "ppapi/c/pp_var.h" -#define PPB_INSTANCE_INTERFACE_0_4 "PPB_Instance;0.4" #define PPB_INSTANCE_INTERFACE_0_5 "PPB_Instance;0.5" #define PPB_INSTANCE_INTERFACE_1_0 "PPB_Instance;1.0" -#ifdef PPAPI_INSTANCE_REMOVE_SCRIPTING #define PPB_INSTANCE_INTERFACE PPB_INSTANCE_INTERFACE_1_0 -#else -#define PPB_INSTANCE_INTERFACE PPB_INSTANCE_INTERFACE_0_4 -#endif /** * @file @@ -35,11 +29,7 @@ * */ -#ifdef PPAPI_INSTANCE_REMOVE_SCRIPTING struct PPB_Instance { -#else -struct PPB_Instance_1_0 { -#endif /** * BindGraphics() binds the given graphics as the current drawing surface. * The contents of this device is what will be displayed in the module's @@ -86,25 +76,7 @@ struct PPB_Instance_1_0 { }; -#ifdef PPAPI_INSTANCE_REMOVE_SCRIPTING -struct PPB_Instance_0_4 { -#else -struct PPB_Instance { -#endif - struct PP_Var (*GetWindowObject)(PP_Instance instance); - struct PP_Var (*GetOwnerElementObject)(PP_Instance instance); - PP_Bool (*BindGraphics)(PP_Instance instance, PP_Resource device); - PP_Bool (*IsFullFrame)(PP_Instance instance); - struct PP_Var (*ExecuteScript)(PP_Instance instance, - struct PP_Var script, - struct PP_Var* exception); -}; - -#ifdef PPAPI_INSTANCE_REMOVE_SCRIPTING typedef struct PPB_Instance PPB_Instance_1_0; -#else -typedef struct PPB_Instance PPB_Instance_0_4; -#endif /** * @} diff --git a/ppapi/c/ppp_instance.h b/ppapi/c/ppp_instance.h index 52ad9cb..3fd8263 100644 --- a/ppapi/c/ppp_instance.h +++ b/ppapi/c/ppp_instance.h @@ -11,16 +11,9 @@ #include "ppapi/c/pp_resource.h" struct PP_InputEvent; -struct PP_Var; -#define PPP_INSTANCE_INTERFACE_0_4 "PPP_Instance;0.4" #define PPP_INSTANCE_INTERFACE_0_5 "PPP_Instance;0.5" -#ifdef PPAPI_INSTANCE_REMOVE_SCRIPTING #define PPP_INSTANCE_INTERFACE PPP_INSTANCE_INTERFACE_0_5 -#else -#define PPP_INSTANCE_INTERFACE PPP_INSTANCE_INTERFACE_0_4 -#endif - /** * @file @@ -40,11 +33,7 @@ struct PP_Var; * events. */ -#ifdef PPAPI_INSTANCE_REMOVE_SCRIPTING struct PPP_Instance { -#else -struct PPP_Instance_0_5 { -#endif /** * DidCreate() is a creation handler that is called when a new instance is * created. This function is called for each instantiation on the page, @@ -231,35 +220,11 @@ struct PPP_Instance_0_5 { PP_Bool (*HandleDocumentLoad)(PP_Instance instance, PP_Resource url_loader); }; -#ifdef PPAPI_INSTANCE_REMOVE_SCRIPTING -struct PPP_Instance_0_4 { -#else -struct PPP_Instance { -#endif - PP_Bool (*DidCreate)(PP_Instance instance, - uint32_t argc, - const char* argn[], - const char* argv[]); - void (*DidDestroy)(PP_Instance instance); - void (*DidChangeView)(PP_Instance instance, - const struct PP_Rect* position, - const struct PP_Rect* clip); - void (*DidChangeFocus)(PP_Instance instance, PP_Bool has_focus); - PP_Bool (*HandleInputEvent)(PP_Instance instance, - const struct PP_InputEvent* event); - PP_Bool (*HandleDocumentLoad)(PP_Instance instance, PP_Resource url_loader); - struct PP_Var (*GetInstanceObject)(PP_Instance instance); -}; - /** * @} */ -#ifdef PPAPI_INSTANCE_REMOVE_SCRIPTING typedef struct PPP_Instance PPP_Instance_0_5; -#else -typedef struct PPP_Instance PPP_Instance_0_4; -#endif #endif /* PPAPI_C_PPP_INSTANCE_H_ */ diff --git a/ppapi/cpp/instance.cc b/ppapi/cpp/instance.cc index ea1e6d5..5cf4e35 100644 --- a/ppapi/cpp/instance.cc +++ b/ppapi/cpp/instance.cc @@ -78,37 +78,6 @@ void Instance::HandleMessage(const Var& /*message*/) { return; } -#ifndef PPAPI_INSTANCE_REMOVE_SCRIPTING -Var Instance::GetWindowObject() { - if (!has_interface<PPB_Instance>()) - return Var(); - return Var(Var::PassRef(), - get_interface<PPB_Instance>()->GetWindowObject(pp_instance())); -} - -Var Instance::GetOwnerElementObject() { - if (!has_interface<PPB_Instance>()) - return Var(); - return Var(Var::PassRef(), - get_interface<PPB_Instance>()->GetOwnerElementObject( - pp_instance())); -} - -Var Instance::ExecuteScript(const Var& script, Var* exception) { - if (!has_interface<PPB_Instance>()) - return Var(); - return Var(Var::PassRef(), - get_interface<PPB_Instance>()->ExecuteScript( - pp_instance(), - script.pp_var(), - Var::OutException(exception).get())); -} - -Var Instance::GetInstanceObject() { - return Var(); -} -#endif - bool Instance::BindGraphics(const Graphics2D& graphics) { if (!has_interface<PPB_Instance>()) return false; diff --git a/ppapi/cpp/instance.h b/ppapi/cpp/instance.h index 03c3259..a55660e 100644 --- a/ppapi/cpp/instance.h +++ b/ppapi/cpp/instance.h @@ -185,20 +185,6 @@ class Instance { /// @{ /// @name PPB_Instance methods for querying the browser: -#ifndef PPAPI_INSTANCE_REMOVE_SCRIPTING - /// See PPP_Instance.GetInstanceObject. - virtual Var GetInstanceObject(); - - /// See PPB_Instance.GetWindowObject. - Var GetWindowObject(); - - /// See PPB_Instance.GetOwnerElementObject. - Var GetOwnerElementObject(); - - /// See PPB_Instance.ExecuteScript. - Var ExecuteScript(const Var& script, Var* exception = NULL); -#endif - /// See PPB_Instance.BindGraphics. bool BindGraphics(const Graphics2D& graphics); diff --git a/ppapi/cpp/module.cc b/ppapi/cpp/module.cc index 412a38f..927710a 100644 --- a/ppapi/cpp/module.cc +++ b/ppapi/cpp/module.cc @@ -132,28 +132,13 @@ PP_Bool Instance_HandleDocumentLoad(PP_Instance pp_instance, return PP_FromBool(instance->HandleDocumentLoad(URLLoader(pp_url_loader))); } -#ifndef PPAPI_INSTANCE_REMOVE_SCRIPTING -PP_Var Instance_GetInstanceObject(PP_Instance pp_instance) { - Module* module_singleton = Module::Get(); - if (!module_singleton) - return Var().Detach(); - Instance* instance = module_singleton->InstanceForPPInstance(pp_instance); - if (!instance) - return Var().Detach(); - return instance->GetInstanceObject().Detach(); -} -#endif - static PPP_Instance instance_interface = { &Instance_DidCreate, &Instance_DidDestroy, &Instance_DidChangeView, &Instance_DidChangeFocus, &Instance_HandleInputEvent, - &Instance_HandleDocumentLoad, -#ifndef PPAPI_INSTANCE_REMOVE_SCRIPTING - &Instance_GetInstanceObject -#endif + &Instance_HandleDocumentLoad }; // PPP_Messaging implementation ------------------------------------------------ diff --git a/ppapi/cpp/private/instance_private.cc b/ppapi/cpp/private/instance_private.cc index 9bf8135..ad6e1a2 100644 --- a/ppapi/cpp/private/instance_private.cc +++ b/ppapi/cpp/private/instance_private.cc @@ -43,11 +43,9 @@ InstancePrivate::InstancePrivate(PP_Instance instance) : Instance(instance) { InstancePrivate::~InstancePrivate() {} -#ifdef PPAPI_INSTANCE_REMOVE_SCRIPTING Var InstancePrivate::GetInstanceObject() { return Var(); } -#endif VarPrivate InstancePrivate::GetWindowObject() { if (!has_interface<PPB_Instance_Private>()) diff --git a/ppapi/cpp/private/instance_private.h b/ppapi/cpp/private/instance_private.h index 2d7add8..d658f0b 100644 --- a/ppapi/cpp/private/instance_private.h +++ b/ppapi/cpp/private/instance_private.h @@ -28,10 +28,8 @@ class InstancePrivate : public Instance { // @{ /// @name PPP_Instance_Private methods for the plugin to override: -#ifdef PPAPI_INSTANCE_REMOVE_SCRIPTING /// See PPP_Instance_Private.GetInstanceObject. virtual Var GetInstanceObject(); -#endif // @} diff --git a/ppapi/cpp/var.cc b/ppapi/cpp/var.cc index bedd257..8df9b67 100644 --- a/ppapi/cpp/var.cc +++ b/ppapi/cpp/var.cc @@ -9,17 +9,12 @@ #include <algorithm> -#include "ppapi/c/dev/ppb_memory_dev.h" -#ifndef PPAPI_VAR_REMOVE_SCRIPTING -# include "ppapi/c/dev/ppb_var_deprecated.h" -#endif #include "ppapi/c/pp_var.h" #include "ppapi/c/ppb_var.h" #include "ppapi/cpp/instance.h" #include "ppapi/cpp/logging.h" #include "ppapi/cpp/module.h" #include "ppapi/cpp/module_impl.h" -#include "ppapi/cpp/dev/scriptable_object_deprecated.h" // Define equivalent to snprintf on Windows. #if defined(_MSC_VER) @@ -34,16 +29,6 @@ template <> const char* interface_name<PPB_Var>() { return PPB_VAR_INTERFACE; } -#ifdef PPAPI_VAR_REMOVE_SCRIPTING -typedef PPB_Var PPB_Var_Interface_Type; -#else -typedef PPB_Var_Deprecated PPB_Var_Interface_Type; - -template <> const char* interface_name<PPB_Var_Deprecated>() { - return PPB_VAR_DEPRECATED_INTERFACE; -} -#endif - // Technically you can call AddRef and Release on any Var, but it may involve // cross-process calls depending on the plugin. This is an optimization so we // only do refcounting on the necessary objects. @@ -53,8 +38,6 @@ inline bool NeedsRefcounting(const PP_Var& var) { } // namespace -using namespace deprecated; - Var::Var() { memset(&var_, 0, sizeof(var_)); var_.type = PP_VARTYPE_UNDEFINED; @@ -89,10 +72,10 @@ Var::Var(double d) { } Var::Var(const char* utf8_str) { - if (has_interface<PPB_Var_Interface_Type>()) { + if (has_interface<PPB_Var>()) { uint32_t len = utf8_str ? static_cast<uint32_t>(strlen(utf8_str)) : 0; - var_ = get_interface<PPB_Var_Interface_Type>()->VarFromUtf8( - Module::Get()->pp_module(), utf8_str, len); + var_ = get_interface<PPB_Var>()->VarFromUtf8(Module::Get()->pp_module(), + utf8_str, len); } else { var_.type = PP_VARTYPE_NULL; var_.padding = 0; @@ -101,8 +84,8 @@ Var::Var(const char* utf8_str) { } Var::Var(const std::string& utf8_str) { - if (has_interface<PPB_Var_Interface_Type>()) { - var_ = get_interface<PPB_Var_Interface_Type>()->VarFromUtf8( + if (has_interface<PPB_Var>()) { + var_ = get_interface<PPB_Var>()->VarFromUtf8( Module::Get()->pp_module(), utf8_str.c_str(), static_cast<uint32_t>(utf8_str.size())); @@ -116,9 +99,9 @@ Var::Var(const std::string& utf8_str) { Var::Var(const Var& other) { var_ = other.var_; if (NeedsRefcounting(var_)) { - if (has_interface<PPB_Var_Interface_Type>()) { + if (has_interface<PPB_Var>()) { needs_release_ = true; - get_interface<PPB_Var_Interface_Type>()->AddRef(var_); + get_interface<PPB_Var>()->AddRef(var_); } else { var_.type = PP_VARTYPE_NULL; needs_release_ = false; @@ -129,18 +112,18 @@ Var::Var(const Var& other) { } Var::~Var() { - if (needs_release_ && has_interface<PPB_Var_Interface_Type>()) - get_interface<PPB_Var_Interface_Type>()->Release(var_); + if (needs_release_ && has_interface<PPB_Var>()) + get_interface<PPB_Var>()->Release(var_); } Var& Var::operator=(const Var& other) { - if (needs_release_ && has_interface<PPB_Var_Interface_Type>()) - get_interface<PPB_Var_Interface_Type>()->Release(var_); + if (needs_release_ && has_interface<PPB_Var>()) + get_interface<PPB_Var>()->Release(var_); var_ = other.var_; if (NeedsRefcounting(var_)) { - if (has_interface<PPB_Var_Interface_Type>()) { + if (has_interface<PPB_Var>()) { needs_release_ = true; - get_interface<PPB_Var_Interface_Type>()->AddRef(var_); + get_interface<PPB_Var>()->AddRef(var_); } else { var_.type = PP_VARTYPE_NULL; needs_release_ = false; @@ -205,173 +188,13 @@ std::string Var::AsString() const { return std::string(); } - if (!has_interface<PPB_Var_Interface_Type>()) + if (!has_interface<PPB_Var>()) return std::string(); uint32_t len; - const char* str = - get_interface<PPB_Var_Interface_Type>()->VarToUtf8(var_, &len); + const char* str = get_interface<PPB_Var>()->VarToUtf8(var_, &len); return std::string(str, len); } -#ifndef PPAPI_VAR_REMOVE_SCRIPTING -Var::Var(Instance* instance, ScriptableObject* object) { - if (has_interface<PPB_Var_Deprecated>()) { - var_ = get_interface<PPB_Var_Deprecated>()->CreateObject( - instance->pp_instance(), object->GetClass(), object); - needs_release_ = true; - } else { - var_.type = PP_VARTYPE_NULL; - var_.padding = 0; - needs_release_ = false; - } -} - -ScriptableObject* Var::AsScriptableObject() const { - if (!is_object()) { - PP_NOTREACHED(); - } else if (has_interface<PPB_Var_Deprecated>()) { - void* object = NULL; - if (get_interface<PPB_Var_Deprecated>()->IsInstanceOf( - var_, ScriptableObject::GetClass(), &object)) { - return reinterpret_cast<ScriptableObject*>(object); - } - } - return NULL; -} - -bool Var::HasProperty(const Var& name, Var* exception) const { - if (!has_interface<PPB_Var_Deprecated>()) - return false; - return get_interface<PPB_Var_Deprecated>()->HasProperty( - var_, name.var_, OutException(exception).get()); -} - -bool Var::HasMethod(const Var& name, Var* exception) const { - if (!has_interface<PPB_Var_Deprecated>()) - return false; - return get_interface<PPB_Var_Deprecated>()->HasMethod( - var_, name.var_, OutException(exception).get()); -} - -Var Var::GetProperty(const Var& name, Var* exception) const { - if (!has_interface<PPB_Var_Deprecated>()) - return Var(); - return Var(PassRef(), get_interface<PPB_Var_Deprecated>()->GetProperty( - var_, name.var_, OutException(exception).get())); -} - -void Var::GetAllPropertyNames(std::vector<Var>* properties, - Var* exception) const { - if (!has_interface<PPB_Var_Deprecated>()) - return; - PP_Var* props = NULL; - uint32_t prop_count = 0; - get_interface<PPB_Var_Deprecated>()->GetAllPropertyNames( - var_, &prop_count, &props, OutException(exception).get()); - if (!prop_count) - return; - properties->resize(prop_count); - for (uint32_t i = 0; i < prop_count; ++i) { - Var temp(PassRef(), props[i]); - (*properties)[i] = temp; - } - const PPB_Memory_Dev* memory_if = static_cast<const PPB_Memory_Dev*>( - pp::Module::Get()->GetBrowserInterface(PPB_MEMORY_DEV_INTERFACE)); - memory_if->MemFree(props); -} - -void Var::SetProperty(const Var& name, const Var& value, Var* exception) { - if (!has_interface<PPB_Var_Deprecated>()) - return; - get_interface<PPB_Var_Deprecated>()->SetProperty( - var_, name.var_, value.var_, OutException(exception).get()); -} - -void Var::RemoveProperty(const Var& name, Var* exception) { - if (!has_interface<PPB_Var_Deprecated>()) - return; - get_interface<PPB_Var_Deprecated>()->RemoveProperty( - var_, name.var_, OutException(exception).get()); -} - -Var Var::Call(const Var& method_name, uint32_t argc, Var* argv, - Var* exception) { - if (!has_interface<PPB_Var_Deprecated>()) - return Var(); - if (argc > 0) { - std::vector<PP_Var> args; - args.reserve(argc); - for (size_t i = 0; i < argc; i++) - args.push_back(argv[i].var_); - return Var(PassRef(), get_interface<PPB_Var_Deprecated>()->Call( - var_, method_name.var_, argc, &args[0], OutException(exception).get())); - } else { - // Don't try to get the address of a vector if it's empty. - return Var(PassRef(), get_interface<PPB_Var_Deprecated>()->Call( - var_, method_name.var_, 0, NULL, OutException(exception).get())); - } -} - -Var Var::Construct(uint32_t argc, Var* argv, Var* exception) const { - if (!has_interface<PPB_Var_Deprecated>()) - return Var(); - if (argc > 0) { - std::vector<PP_Var> args; - args.reserve(argc); - for (size_t i = 0; i < argc; i++) - args.push_back(argv[i].var_); - return Var(PassRef(), get_interface<PPB_Var_Deprecated>()->Construct( - var_, argc, &args[0], OutException(exception).get())); - } else { - // Don't try to get the address of a vector if it's empty. - return Var(PassRef(), get_interface<PPB_Var_Deprecated>()->Construct( - var_, 0, NULL, OutException(exception).get())); - } -} - -Var Var::Call(const Var& method_name, Var* exception) { - if (!has_interface<PPB_Var_Deprecated>()) - return Var(); - return Var(PassRef(), get_interface<PPB_Var_Deprecated>()->Call( - var_, method_name.var_, 0, NULL, OutException(exception).get())); -} - -Var Var::Call(const Var& method_name, const Var& arg1, Var* exception) { - if (!has_interface<PPB_Var_Deprecated>()) - return Var(); - PP_Var args[1] = {arg1.var_}; - return Var(PassRef(), get_interface<PPB_Var_Deprecated>()->Call( - var_, method_name.var_, 1, args, OutException(exception).get())); -} - -Var Var::Call(const Var& method_name, const Var& arg1, const Var& arg2, - Var* exception) { - if (!has_interface<PPB_Var_Deprecated>()) - return Var(); - PP_Var args[2] = {arg1.var_, arg2.var_}; - return Var(PassRef(), get_interface<PPB_Var_Deprecated>()->Call( - var_, method_name.var_, 2, args, OutException(exception).get())); -} - -Var Var::Call(const Var& method_name, const Var& arg1, const Var& arg2, - const Var& arg3, Var* exception) { - if (!has_interface<PPB_Var_Deprecated>()) - return Var(); - PP_Var args[3] = {arg1.var_, arg2.var_, arg3.var_}; - return Var(PassRef(), get_interface<PPB_Var_Deprecated>()->Call( - var_, method_name.var_, 3, args, OutException(exception).get())); -} - -Var Var::Call(const Var& method_name, const Var& arg1, const Var& arg2, - const Var& arg3, const Var& arg4, Var* exception) { - if (!has_interface<PPB_Var_Deprecated>()) - return Var(); - PP_Var args[4] = {arg1.var_, arg2.var_, arg3.var_, arg4.var_}; - return Var(PassRef(), get_interface<PPB_Var_Deprecated>()->Call( - var_, method_name.var_, 4, args, OutException(exception).get())); -} -#endif - std::string Var::DebugString() const { char buf[256]; if (is_undefined()) { diff --git a/ppapi/cpp/var.h b/ppapi/cpp/var.h index 17bb0b8..a4dfb33 100644 --- a/ppapi/cpp/var.h +++ b/ppapi/cpp/var.h @@ -15,12 +15,6 @@ namespace pp { class Instance; -#ifndef PPAPI_VAR_REMOVE_SCRIPTING -namespace deprecated { -class ScriptableObject; -} -#endif - class Var { public: struct Null {}; // Special value passed to constructor to make NULL. @@ -100,37 +94,6 @@ class Var { // in debug mode, and return an empty string. std::string AsString() const; -#ifndef PPAPI_VAR_REMOVE_SCRIPTING - // Takes ownership of the given pointer. - Var(Instance* instance, deprecated::ScriptableObject* object); - - // This assumes the object is of type object. If it's not, it will assert in - // debug mode. If it is not an object or not a ScriptableObject type, returns - // NULL. - deprecated::ScriptableObject* AsScriptableObject() const; - - bool HasProperty(const Var& name, Var* exception = NULL) const; - bool HasMethod(const Var& name, Var* exception = NULL) const; - Var GetProperty(const Var& name, Var* exception = NULL) const; - void GetAllPropertyNames(std::vector<Var>* properties, - Var* exception = NULL) const; - void SetProperty(const Var& name, const Var& value, Var* exception = NULL); - void RemoveProperty(const Var& name, Var* exception = NULL); - Var Call(const Var& method_name, uint32_t argc, Var* argv, - Var* exception = NULL); - Var Construct(uint32_t argc, Var* argv, Var* exception = NULL) const; - - // Convenience functions for calling functions with small # of args. - Var Call(const Var& method_name, Var* exception = NULL); - Var Call(const Var& method_name, const Var& arg1, Var* exception = NULL); - Var Call(const Var& method_name, const Var& arg1, const Var& arg2, - Var* exception = NULL); - Var Call(const Var& method_name, const Var& arg1, const Var& arg2, - const Var& arg3, Var* exception = NULL); - Var Call(const Var& method_name, const Var& arg1, const Var& arg2, - const Var& arg3, const Var& arg4, Var* exception = NULL); -#endif // ifndef PPAPI_VAR_REMOVE_SCRIPTING - // Returns a const reference to the PP_Var managed by this Var object. const PP_Var& pp_var() const { return var_; diff --git a/ppapi/proxy/dispatcher.cc b/ppapi/proxy/dispatcher.cc index e9b57c3..69e16ac 100644 --- a/ppapi/proxy/dispatcher.cc +++ b/ppapi/proxy/dispatcher.cc @@ -139,7 +139,6 @@ InterfaceList::InterfaceList() { AddPPB(PPB_Graphics2D_Proxy::GetInfo()); AddPPB(PPB_ImageData_Proxy::GetInfo()); AddPPB(PPB_InputEvent_Proxy::GetInfo()); - AddPPB(PPB_Instance_Proxy::GetInfo0_4()); AddPPB(PPB_Instance_Proxy::GetInfo0_5()); AddPPB(PPB_Instance_Proxy::GetInfo1_0()); AddPPB(PPB_Instance_Proxy::GetInfoFullscreen()); @@ -166,7 +165,6 @@ InterfaceList::InterfaceList() { AddPPP(PPP_Graphics3D_Proxy::GetInfo()); AddPPP(PPP_InputEvent_Proxy::GetInfo()); AddPPP(PPP_Instance_Private_Proxy::GetInfo()); - AddPPP(PPP_Instance_Proxy::GetInfo0_4()); AddPPP(PPP_Instance_Proxy::GetInfo0_5()); } diff --git a/ppapi/proxy/ppapi_messages.h b/ppapi/proxy/ppapi_messages.h index 0eb8258..c516514 100644 --- a/ppapi/proxy/ppapi_messages.h +++ b/ppapi/proxy/ppapi_messages.h @@ -296,9 +296,6 @@ IPC_SYNC_MESSAGE_ROUTED2_1(PpapiMsg_PPPInstance_HandleDocumentLoad, PP_Instance /* instance */, pp::proxy::HostResource /* url_loader */, PP_Bool /* result */) -IPC_SYNC_MESSAGE_ROUTED1_1(PpapiMsg_PPPInstance_GetInstanceObject, - PP_Instance /* instance */, - pp::proxy::SerializedVar /* result */) // PPP_Instance_Private. IPC_SYNC_MESSAGE_ROUTED1_1(PpapiMsg_PPPInstancePrivate_GetInstanceObject, diff --git a/ppapi/proxy/ppapi_proxy_test.h b/ppapi/proxy/ppapi_proxy_test.h index 373f8e3..775b75c 100644 --- a/ppapi/proxy/ppapi_proxy_test.h +++ b/ppapi/proxy/ppapi_proxy_test.h @@ -137,6 +137,8 @@ class PluginProxyTest : public PluginProxyTestHarness, public testing::Test { // testing::Test implementation. virtual void SetUp(); virtual void TearDown(); + private: + MessageLoop message_loop_; }; class HostProxyTestHarness : public ProxyTestHarnessBase { @@ -191,6 +193,8 @@ class HostProxyTest : public HostProxyTestHarness, public testing::Test { // testing::Test implementation. virtual void SetUp(); virtual void TearDown(); + private: + MessageLoop message_loop_; }; // Use this base class to test both sides of a proxy. diff --git a/ppapi/proxy/ppb_instance_proxy.cc b/ppapi/proxy/ppb_instance_proxy.cc index 5a6158a..7bb6ba1 100644 --- a/ppapi/proxy/ppb_instance_proxy.cc +++ b/ppapi/proxy/ppb_instance_proxy.cc @@ -47,18 +47,6 @@ PPB_Instance_Proxy::~PPB_Instance_Proxy() { } // static -const InterfaceProxy::Info* PPB_Instance_Proxy::GetInfo0_4() { - static const Info info = { - ppapi::thunk::GetPPB_Instance_0_4_Thunk(), - PPB_INSTANCE_INTERFACE_0_4, - INTERFACE_ID_NONE, // 1_0 is the canonical one. - false, - &CreateInstanceProxy, - }; - return &info; -} - -// static const InterfaceProxy::Info* PPB_Instance_Proxy::GetInfo0_5() { static const Info info = { ppapi::thunk::GetPPB_Instance_1_0_Thunk(), @@ -87,7 +75,7 @@ const InterfaceProxy::Info* PPB_Instance_Proxy::GetInfoMessaging() { static const Info info = { ppapi::thunk::GetPPB_Messaging_Thunk(), PPB_MESSAGING_INTERFACE, - INTERFACE_ID_NONE, // 0_5 is the canonical one. + INTERFACE_ID_NONE, // 1_0 is the canonical one. false, &CreateInstanceProxy, }; @@ -99,7 +87,7 @@ const InterfaceProxy::Info* PPB_Instance_Proxy::GetInfoPrivate() { static const Info info = { ppapi::thunk::GetPPB_Instance_Private_Thunk(), PPB_INSTANCE_PRIVATE_INTERFACE, - INTERFACE_ID_NONE, // 0_5 is the canonical one. + INTERFACE_ID_NONE, // 1_0 is the canonical one. false, &CreateInstanceProxy, }; @@ -111,7 +99,7 @@ const InterfaceProxy::Info* PPB_Instance_Proxy::GetInfoFullscreen() { static const Info info = { ppapi::thunk::GetPPB_Fullscreen_Thunk(), PPB_FULLSCREEN_DEV_INTERFACE, - INTERFACE_ID_NONE, // 0_5 is the canonical one. + INTERFACE_ID_NONE, // 1_0 is the canonical one. false, &CreateInstanceProxy, }; diff --git a/ppapi/proxy/ppb_instance_proxy.h b/ppapi/proxy/ppb_instance_proxy.h index 9d045fb..fc2dac3 100644 --- a/ppapi/proxy/ppb_instance_proxy.h +++ b/ppapi/proxy/ppb_instance_proxy.h @@ -29,7 +29,6 @@ class PPB_Instance_Proxy : public InterfaceProxy, PPB_Instance_Proxy(Dispatcher* dispatcher, const void* target_interface); virtual ~PPB_Instance_Proxy(); - static const Info* GetInfo0_4(); static const Info* GetInfo0_5(); static const Info* GetInfo1_0(); static const Info* GetInfoMessaging(); diff --git a/ppapi/proxy/ppp_instance_proxy.cc b/ppapi/proxy/ppp_instance_proxy.cc index b09055d..99dcaab 100644 --- a/ppapi/proxy/ppp_instance_proxy.cc +++ b/ppapi/proxy/ppp_instance_proxy.cc @@ -112,24 +112,6 @@ PP_Bool HandleDocumentLoad(PP_Instance instance, return result; } -PP_Var GetInstanceObject(PP_Instance instance) { - Dispatcher* dispatcher = HostDispatcher::GetForInstance(instance); - ReceiveSerializedVarReturnValue result; - dispatcher->Send(new PpapiMsg_PPPInstance_GetInstanceObject( - INTERFACE_ID_PPP_INSTANCE, instance, &result)); - return result.Return(dispatcher); -} - -static const PPP_Instance_0_4 instance_interface_0_4 = { - &DidCreate, - &DidDestroy, - &DidChangeView, - &DidChangeFocus, - &HandleInputEvent, - &HandleDocumentLoad, - &GetInstanceObject -}; - static const PPP_Instance_0_5 instance_interface_0_5 = { &DidCreate, &DidDestroy, @@ -153,18 +135,6 @@ PPP_Instance_Proxy::~PPP_Instance_Proxy() { } // static -const InterfaceProxy::Info* PPP_Instance_Proxy::GetInfo0_4() { - static const Info info = { - &instance_interface_0_4, - PPP_INSTANCE_INTERFACE_0_4, - INTERFACE_ID_PPP_INSTANCE, - false, - &CreateInstanceProxy<PPP_Instance_0_4> - }; - return &info; -} - -// static const InterfaceProxy::Info* PPP_Instance_Proxy::GetInfo0_5() { static const Info info = { &instance_interface_0_5, @@ -191,8 +161,6 @@ bool PPP_Instance_Proxy::OnMessageReceived(const IPC::Message& msg) { OnMsgHandleInputEvent) IPC_MESSAGE_HANDLER(PpapiMsg_PPPInstance_HandleDocumentLoad, OnMsgHandleDocumentLoad) - IPC_MESSAGE_HANDLER(PpapiMsg_PPPInstance_GetInstanceObject, - OnMsgGetInstanceObject) IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() return handled; @@ -278,16 +246,5 @@ void PPP_Instance_Proxy::OnMsgHandleDocumentLoad(PP_Instance instance, PluginResourceTracker::GetInstance()->ReleaseResource(plugin_loader); } -void PPP_Instance_Proxy::OnMsgGetInstanceObject( - PP_Instance instance, - SerializedVarReturnValue result) { - // GetInstanceObject_0_4 can be null if we're talking to version 0.5 or later, - // however the host side of the proxy should never call this function on an - // 0.5 or later version. - DCHECK(combined_interface_->GetInstanceObject_0_4); - result.Return(dispatcher(), - combined_interface_->GetInstanceObject_0_4(instance)); -} - } // namespace proxy } // namespace pp diff --git a/ppapi/proxy/ppp_instance_proxy.h b/ppapi/proxy/ppp_instance_proxy.h index e4ef2ba..9448332 100644 --- a/ppapi/proxy/ppp_instance_proxy.h +++ b/ppapi/proxy/ppp_instance_proxy.h @@ -35,9 +35,6 @@ class PPP_Instance_Proxy : public InterfaceProxy { } virtual ~PPP_Instance_Proxy(); - // Return the info for the 0.4 version of the interface. - static const Info* GetInfo0_4(); - // Return the info for the 0.5 (latest, canonical) version of the interface. static const Info* GetInfo0_5(); @@ -66,8 +63,6 @@ class PPP_Instance_Proxy : public InterfaceProxy { void OnMsgHandleDocumentLoad(PP_Instance instance, const HostResource& url_loader, PP_Bool* result); - void OnMsgGetInstanceObject(PP_Instance instance, - SerializedVarReturnValue result); scoped_ptr< ::ppapi::PPP_Instance_Combined> combined_interface_; }; diff --git a/ppapi/proxy/ppp_instance_proxy_test.cc b/ppapi/proxy/ppp_instance_proxy_test.cc index b545dd7..00d776b 100644 --- a/ppapi/proxy/ppp_instance_proxy_test.cc +++ b/ppapi/proxy/ppp_instance_proxy_test.cc @@ -95,16 +95,6 @@ void ResetReceived() { memset(&received_event, 0, sizeof(received_event)); } -PPP_Instance_0_4 ppp_instance_0_4 = { - &DidCreate, - &DidDestroy, - &DidChangeView, - &DidChangeFocus, - &HandleInputEvent, - &HandleDocumentLoad, - &GetInstanceObject -}; - PPP_Instance_0_5 ppp_instance_0_5 = { &DidCreate, &DidDestroy, @@ -130,108 +120,6 @@ class PPP_Instance_ProxyTest : public TwoWayTest { } }; -TEST_F(PPP_Instance_ProxyTest, PPPInstance0_4) { - plugin().RegisterTestInterface(PPP_INSTANCE_INTERFACE_0_4, &ppp_instance_0_4); - host().RegisterTestInterface(PPB_FULLSCREEN_DEV_INTERFACE, - &ppb_fullscreen_dev); - - // Try requesting the 0.5 version, like the browser does. This should come - // back NULL, since we're not registering 0.5. But this ensures that the - // behavior through the proxy code reflects more closely what happens for a - // real plug-in. - const void* interface = - host().host_dispatcher()->GetProxiedInterface(PPP_INSTANCE_INTERFACE_0_5); - EXPECT_EQ(NULL, interface); - - // Grab the host-side proxy for the 0.4 interface. - const PPP_Instance_0_4* ppp_instance = static_cast<const PPP_Instance_0_4*>( - host().host_dispatcher()->GetProxiedInterface( - PPP_INSTANCE_INTERFACE_0_4)); - - // Call each function in turn, make sure we get the expected values and - // returns. - // - // We don't test DidDestroy, because it has the side-effect of removing the - // PP_Instance from the PluginDispatcher, which will cause a failure later - // when the test is torn down. - PP_Instance expected_instance = pp_instance(); - std::vector<std::string> expected_argn, expected_argv; - expected_argn.push_back("Hello"); - expected_argn.push_back("world."); - expected_argv.push_back("elloHay"); - expected_argv.push_back("orldway."); - std::vector<const char*> argn_to_pass, argv_to_pass; - CHECK(expected_argn.size() == expected_argv.size()); - for (size_t i = 0; i < expected_argn.size(); ++i) { - argn_to_pass.push_back(expected_argn[i].c_str()); - argv_to_pass.push_back(expected_argv[i].c_str()); - } - uint32_t expected_argc = expected_argn.size(); - bool_to_return = PP_TRUE; - ResetReceived(); - EXPECT_EQ(bool_to_return, ppp_instance->DidCreate(expected_instance, - expected_argc, - &argn_to_pass[0], - &argv_to_pass[0])); - EXPECT_EQ(received_instance, expected_instance); - EXPECT_EQ(received_argc, expected_argc); - EXPECT_EQ(received_argn, expected_argn); - EXPECT_EQ(received_argv, expected_argv); - - PP_Rect expected_position = { {1, 2}, {3, 4} }; - PP_Rect expected_clip = { {5, 6}, {7, 8} }; - ResetReceived(); - ppp_instance->DidChangeView(expected_instance, &expected_position, - &expected_clip); - did_change_view_called.Wait(); - EXPECT_EQ(received_instance, expected_instance); - // If I define operator== for PP_Rect, it has to come before gtest's template - // definitions in the translation unit, or else it's not found. So instead of - // defining operator== before the #include that brings in gtest, I compare the - // individual parts. - EXPECT_EQ(received_position.point.x, expected_position.point.x); - EXPECT_EQ(received_position.point.y, expected_position.point.y); - EXPECT_EQ(received_position.size.width, expected_position.size.width); - EXPECT_EQ(received_position.size.height, expected_position.size.height); - EXPECT_EQ(received_clip.point.x, expected_clip.point.x); - EXPECT_EQ(received_clip.point.y, expected_clip.point.y); - EXPECT_EQ(received_clip.size.width, expected_clip.size.width); - EXPECT_EQ(received_clip.size.height, expected_clip.size.height); - - PP_Bool expected_has_focus = PP_TRUE; - ResetReceived(); - ppp_instance->DidChangeFocus(expected_instance, expected_has_focus); - did_change_focus_called.Wait(); - EXPECT_EQ(received_instance, expected_instance); - EXPECT_EQ(received_has_focus, expected_has_focus); - - PP_InputEvent expected_event = { PP_INPUTEVENT_TYPE_KEYDOWN, // type - 0, // padding - 1.0, // time_stamp - { { 2, 3 } } }; // u (as PP_InputEvent_Key) - ResetReceived(); - EXPECT_EQ(bool_to_return, - ppp_instance->HandleInputEvent(expected_instance, &expected_event)); - EXPECT_EQ(received_instance, expected_instance); - ASSERT_EQ(received_event.type, expected_event.type); - // Ignore padding; it's okay if it's not serialized. - EXPECT_EQ(received_event.time_stamp, expected_event.time_stamp); - EXPECT_EQ(received_event.u.key.modifier, expected_event.u.key.modifier); - EXPECT_EQ(received_event.u.key.key_code, expected_event.u.key.key_code); - - // TODO(dmichael): Need to mock out a resource Tracker to be able to test - // HandleResourceLoad. It also requires - // PPB_Core.AddRefResource and for PPB_URLLoader to be - // registered. - - var_to_return = PP_MakeInt32(100); - ResetReceived(); - PP_Var result(ppp_instance->GetInstanceObject(expected_instance)); - ASSERT_EQ(var_to_return.type, result.type); - EXPECT_EQ(var_to_return.value.as_int, result.value.as_int); - EXPECT_EQ(received_instance, expected_instance); -} - TEST_F(PPP_Instance_ProxyTest, PPPInstance0_5) { plugin().RegisterTestInterface(PPP_INSTANCE_INTERFACE_0_5, &ppp_instance_0_5); host().RegisterTestInterface(PPB_FULLSCREEN_DEV_INTERFACE, diff --git a/ppapi/shared_impl/ppp_instance_combined.cc b/ppapi/shared_impl/ppp_instance_combined.cc index 8da13af..ce3d2c4 100644 --- a/ppapi/shared_impl/ppp_instance_combined.cc +++ b/ppapi/shared_impl/ppp_instance_combined.cc @@ -8,20 +8,7 @@ namespace ppapi { PPP_Instance_Combined::PPP_Instance_Combined( const PPP_Instance_0_5& instance_if) - : PPP_Instance_0_5(instance_if), - GetInstanceObject_0_4(NULL) { -} - -PPP_Instance_Combined::PPP_Instance_Combined( - const PPP_Instance_0_4& instance_if) - : PPP_Instance_0_5(), // Zero-initialize. - GetInstanceObject_0_4(instance_if.GetInstanceObject) { - DidCreate = instance_if.DidCreate; - DidDestroy = instance_if.DidDestroy; - DidChangeView = instance_if.DidChangeView; - DidChangeFocus = instance_if.DidChangeFocus; - HandleInputEvent = instance_if.HandleInputEvent; - HandleDocumentLoad = instance_if.HandleDocumentLoad; + : PPP_Instance_0_5(instance_if) { } } // namespace ppapi diff --git a/ppapi/shared_impl/ppp_instance_combined.h b/ppapi/shared_impl/ppp_instance_combined.h index a186c06..33548d5 100644 --- a/ppapi/shared_impl/ppp_instance_combined.h +++ b/ppapi/shared_impl/ppp_instance_combined.h @@ -13,9 +13,6 @@ namespace ppapi { struct PPP_Instance_Combined : public PPP_Instance_0_5 { public: explicit PPP_Instance_Combined(const PPP_Instance_0_5& instance_if); - explicit PPP_Instance_Combined(const PPP_Instance_0_4& instance_if); - - PP_Var (*const GetInstanceObject_0_4)(PP_Instance instance); DISALLOW_COPY_AND_ASSIGN(PPP_Instance_Combined); }; diff --git a/ppapi/thunk/ppb_instance_thunk.cc b/ppapi/thunk/ppb_instance_thunk.cc index 3d7ef60..a05f030 100644 --- a/ppapi/thunk/ppb_instance_thunk.cc +++ b/ppapi/thunk/ppb_instance_thunk.cc @@ -54,14 +54,6 @@ const PPB_Instance_1_0 g_ppb_instance_1_0_thunk = { &IsFullFrame }; -const PPB_Instance_0_4 g_ppb_instance_0_4_thunk = { - &GetWindowObject, - &GetOwnerElementObject, - &BindGraphics, - &IsFullFrame, - &ExecuteScript -}; - const PPB_Instance_Private g_ppb_instance_private_thunk = { &GetWindowObject, &GetOwnerElementObject, @@ -70,9 +62,6 @@ const PPB_Instance_Private g_ppb_instance_private_thunk = { } // namespace -const PPB_Instance_0_4* GetPPB_Instance_0_4_Thunk() { - return &g_ppb_instance_0_4_thunk; -} const PPB_Instance_1_0* GetPPB_Instance_1_0_Thunk() { return &g_ppb_instance_1_0_thunk; } diff --git a/ppapi/thunk/thunk.h b/ppapi/thunk/thunk.h index e03a8e1..91484e1 100644 --- a/ppapi/thunk/thunk.h +++ b/ppapi/thunk/thunk.h @@ -52,13 +52,7 @@ struct PPB_WheelInputEvent; struct PPB_Widget_Dev; struct PPB_Zoom_Dev; -#ifdef PPAPI_INSTANCE_REMOVE_SCRIPTING -struct PPB_Instance_0_4; typedef PPB_Instance PPB_Instance_1_0; -#else -struct PPB_Instance_1_0; -typedef PPB_Instance PPB_Instance_0_4; -#endif namespace ppapi { namespace thunk { @@ -92,7 +86,6 @@ const PPB_Graphics3D_Dev* GetPPB_Graphics3D_Thunk(); const PPB_InputEvent* GetPPB_InputEvent_Thunk(); const PPB_ImageData* GetPPB_ImageData_Thunk(); const PPB_ImageDataTrusted* GetPPB_ImageDataTrusted_Thunk(); -const PPB_Instance_0_4* GetPPB_Instance_0_4_Thunk(); const PPB_Instance_1_0* GetPPB_Instance_1_0_Thunk(); const PPB_Instance_Private* GetPPB_Instance_Private_Thunk(); const PPB_KeyboardInputEvent* GetPPB_KeyboardInputEvent_Thunk(); diff --git a/webkit/plugins/ppapi/plugin_module.cc b/webkit/plugins/ppapi/plugin_module.cc index 7af6f17..692ee5a 100644 --- a/webkit/plugins/ppapi/plugin_module.cc +++ b/webkit/plugins/ppapi/plugin_module.cc @@ -395,12 +395,6 @@ const void* GetInterface(const char* name) { if (strcmp(name, PPB_VAR_INTERFACE_0_5) == 0) return Var::GetInterface(); - // Support the 0.4 version of PPB_Instance that includes scripting, until it - // is no longer being used. - // TODO(dmichael): Remove this. - if (strcmp(name, PPB_INSTANCE_INTERFACE_0_4) == 0) - return ::ppapi::thunk::GetPPB_Instance_0_4_Thunk(); - // Support the dev interfaces for file io, fileref and file system // until relevant tests and examples are migrated over to non-dev interfaces // in order to prevent breaking the tests and examples. @@ -561,11 +555,6 @@ PluginInstance* PluginModule::CreateInstance(PluginDelegate* delegate) { const void* ppp_instance = GetPluginInterface(PPP_INSTANCE_INTERFACE_0_5); if (ppp_instance) { instance = PluginInstance::Create0_5(delegate, this, ppp_instance); - } else { - // If the 0.5 interface is not supported, try retrieving 0.4. - ppp_instance = GetPluginInterface(PPP_INSTANCE_INTERFACE_0_4); - if (ppp_instance) - instance = PluginInstance::Create0_4(delegate, this, ppp_instance); } if (!instance) { LOG(WARNING) << "Plugin doesn't support instance interface, failing."; diff --git a/webkit/plugins/ppapi/ppapi_plugin_instance.cc b/webkit/plugins/ppapi/ppapi_plugin_instance.cc index 72bece9..4b5db01 100644 --- a/webkit/plugins/ppapi/ppapi_plugin_instance.cc +++ b/webkit/plugins/ppapi/ppapi_plugin_instance.cc @@ -198,18 +198,6 @@ PluginInstance* PluginInstance::Create0_5(PluginDelegate* delegate, new ::ppapi::PPP_Instance_Combined(*interface)); } -// static -PluginInstance* PluginInstance::Create0_4(PluginDelegate* delegate, - PluginModule* module, - const void* ppp_instance_if_0_4) { - const PPP_Instance_0_4* interface = - static_cast<const PPP_Instance_0_4*>(ppp_instance_if_0_4); - return new PluginInstance( - delegate, - module, - new ::ppapi::PPP_Instance_Combined(*interface)); -} - PluginInstance::PluginInstance( PluginDelegate* delegate, PluginModule* module, @@ -502,14 +490,10 @@ PP_Var PluginInstance::GetInstanceObject() { // Keep a reference on the stack. See NOTE above. scoped_refptr<PluginInstance> ref(this); - // Try the private interface first. If it is not supported, we fall back to - // looking in the older version of the PPP_Instance interface for - // GetInstanceObject. If all that fails, return an undefined Var. - // TODO(dmichael): Remove support for PPP_Instance.GetInstanceObject + // If the plugin supports the private instance interface, try to retrieve its + // instance object. if (LoadPrivateInterface()) return plugin_private_interface_->GetInstanceObject(pp_instance()); - else if (instance_interface_->GetInstanceObject_0_4) - return instance_interface_->GetInstanceObject_0_4(pp_instance()); return PP_MakeUndefined(); } diff --git a/webkit/plugins/ppapi/ppapi_plugin_instance.h b/webkit/plugins/ppapi/ppapi_plugin_instance.h index da60ff1..d284580 100644 --- a/webkit/plugins/ppapi/ppapi_plugin_instance.h +++ b/webkit/plugins/ppapi/ppapi_plugin_instance.h @@ -91,12 +91,6 @@ class PluginInstance : public base::RefCounted<PluginInstance>, PluginModule* module, const void* ppp_instance_if_0_5); - // Create and return a PluginInstance object which supports the - // PPP_Instance_0_4 interface. - static PluginInstance* Create0_4(PluginDelegate* delegate, - PluginModule* module, - const void* ppp_instance_if_0_4); - // Delete should be called by the WebPlugin before this destructor. virtual ~PluginInstance(); |