Bug 550305 - Reduce round-trips by making some NPRuntime/scriptable methods async instead of RPC, r=bent

This commit is contained in:
Benjamin Smedberg 2010-03-04 16:20:14 -05:00
parent ba9e668372
commit 6989296175
10 changed files with 26 additions and 26 deletions

View File

@ -138,7 +138,7 @@ parent:
returns (nsCString username, nsCString password, NPError result);
both:
rpc PPluginScriptableObject();
async PPluginScriptableObject();
child:
/* NPP_NewStream */

View File

@ -65,7 +65,7 @@ rpc protocol PPluginScriptableObject
manager PPluginInstance;
both:
rpc __delete__();
async __delete__();
parent:
rpc NPN_Evaluate(nsCString aScript)
@ -118,8 +118,8 @@ both:
// are protected after an NPObject has been associated with the protocol
// object. Sending the protocol object as an argument to the other process
// temporarily protects the protocol object again for the duration of the call.
rpc Protect();
rpc Unprotect();
async Protect();
async Unprotect();
};
} // namespace plugins

View File

@ -1245,7 +1245,7 @@ PluginInstanceChild::DeallocPPluginScriptableObject(
}
bool
PluginInstanceChild::AnswerPPluginScriptableObjectConstructor(
PluginInstanceChild::RecvPPluginScriptableObjectConstructor(
PPluginScriptableObjectChild* aActor)
{
AssertPluginThread();
@ -1385,7 +1385,7 @@ PluginInstanceChild::GetActorForNPObject(NPObject* aObject)
}
actor = new PluginScriptableObjectChild(LocalObject);
if (!CallPPluginScriptableObjectConstructor(actor)) {
if (!SendPPluginScriptableObjectConstructor(actor)) {
NS_ERROR("Failed to send constructor message!");
return nsnull;
}

View File

@ -96,8 +96,8 @@ protected:
virtual bool
DeallocPPluginScriptableObject(PPluginScriptableObjectChild* aObject);
virtual bool
AnswerPPluginScriptableObjectConstructor(PPluginScriptableObjectChild* aActor);
NS_OVERRIDE virtual bool
RecvPPluginScriptableObjectConstructor(PPluginScriptableObjectChild* aActor);
virtual PBrowserStreamChild*
AllocPBrowserStream(const nsCString& url,

View File

@ -735,7 +735,7 @@ PluginInstanceParent::DeallocPPluginScriptableObject(
}
bool
PluginInstanceParent::AnswerPPluginScriptableObjectConstructor(
PluginInstanceParent::RecvPPluginScriptableObjectConstructor(
PPluginScriptableObjectParent* aActor)
{
// This is only called in response to the child process requesting the
@ -806,7 +806,7 @@ PluginInstanceParent::GetActorForNPObject(NPObject* aObject)
return nsnull;
}
if (!CallPPluginScriptableObjectConstructor(actor)) {
if (!SendPPluginScriptableObjectConstructor(actor)) {
NS_WARNING("Failed to send constructor message!");
return nsnull;
}

View File

@ -78,8 +78,8 @@ public:
virtual PPluginScriptableObjectParent*
AllocPPluginScriptableObject();
virtual bool
AnswerPPluginScriptableObjectConstructor(PPluginScriptableObjectParent* aActor);
NS_OVERRIDE virtual bool
RecvPPluginScriptableObjectConstructor(PPluginScriptableObjectParent* aActor);
virtual bool
DeallocPPluginScriptableObject(PPluginScriptableObjectParent* aObject);

View File

@ -550,7 +550,7 @@ PluginScriptableObjectChild::ResurrectProxyObject()
InitializeProxy();
NS_ASSERTION(mObject, "Initialize failed!");
CallProtect();
SendProtect();
return true;
}
@ -583,7 +583,7 @@ PluginScriptableObjectChild::Unprotect()
if (mType == LocalObject) {
if (--mProtectCount == 0) {
PluginScriptableObjectChild::Call__delete__(this);
PluginScriptableObjectChild::Send__delete__(this);
}
}
}
@ -600,7 +600,7 @@ PluginScriptableObjectChild::DropNPObject()
PluginModuleChild::current()->UnregisterActorForNPObject(mObject);
mObject = nsnull;
CallUnprotect();
SendUnprotect();
}
void
@ -1036,7 +1036,7 @@ PluginScriptableObjectChild::AnswerConstruct(const nsTArray<Variant>& aArgs,
}
bool
PluginScriptableObjectChild::AnswerProtect()
PluginScriptableObjectChild::RecvProtect()
{
NS_ASSERTION(mObject->_class != GetClass(), "Bad object type!");
NS_ASSERTION(mType == LocalObject, "Bad type!");
@ -1046,7 +1046,7 @@ PluginScriptableObjectChild::AnswerProtect()
}
bool
PluginScriptableObjectChild::AnswerUnprotect()
PluginScriptableObjectChild::RecvUnprotect()
{
NS_ASSERTION(mObject->_class != GetClass(), "Bad object type!");
NS_ASSERTION(mType == LocalObject, "Bad type!");

View File

@ -129,10 +129,10 @@ public:
bool* aSuccess);
virtual bool
AnswerProtect();
RecvProtect();
virtual bool
AnswerUnprotect();
RecvUnprotect();
NPObject*
GetObject(bool aCanResurrect);

View File

@ -668,7 +668,7 @@ PluginScriptableObjectParent::ResurrectProxyObject()
InitializeProxy();
NS_ASSERTION(mObject, "Initialize failed!");
if (!CallProtect()) {
if (!SendProtect()) {
NS_WARNING("Failed to send message!");
return false;
}
@ -705,7 +705,7 @@ PluginScriptableObjectParent::Unprotect()
if (mType == LocalObject) {
if (--mProtectCount == 0) {
PluginScriptableObjectParent::Call__delete__(this);
PluginScriptableObjectParent::Send__delete__(this);
}
}
}
@ -725,7 +725,7 @@ PluginScriptableObjectParent::DropNPObject()
instance->UnregisterNPObject(mObject);
mObject = nsnull;
(void) CallUnprotect();
(void) SendUnprotect();
}
bool
@ -1257,7 +1257,7 @@ PluginScriptableObjectParent::AnswerConstruct(const nsTArray<Variant>& aArgs,
}
bool
PluginScriptableObjectParent::AnswerProtect()
PluginScriptableObjectParent::RecvProtect()
{
NS_ASSERTION(mObject->_class != GetClass(), "Bad object type!");
NS_ASSERTION(mType == LocalObject, "Bad type!");
@ -1267,7 +1267,7 @@ PluginScriptableObjectParent::AnswerProtect()
}
bool
PluginScriptableObjectParent::AnswerUnprotect()
PluginScriptableObjectParent::RecvUnprotect()
{
NS_ASSERTION(mObject->_class != GetClass(), "Bad object type!");
NS_ASSERTION(mType == LocalObject, "Bad type!");

View File

@ -123,10 +123,10 @@ public:
bool* aSuccess);
virtual bool
AnswerProtect();
RecvProtect();
virtual bool
AnswerUnprotect();
RecvUnprotect();
static const NPClass*
GetClass()