mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-03 20:49:27 +00:00
Revert the RPC-style race resolution from bug 532208 in order to use the asynchronous delivery patches.
This commit is contained in:
parent
96bfcbf97c
commit
961a9e2c1e
@ -152,6 +152,16 @@ BrowserStreamChild::AnswerNPP_StreamAsFile(const nsCString& fname)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
BrowserStreamChild::Answer__delete__(const NPError& reason,
|
||||
const bool& artificial)
|
||||
{
|
||||
AssertPluginThread();
|
||||
if (!artificial)
|
||||
NPP_DestroyStream(reason);
|
||||
return true;
|
||||
}
|
||||
|
||||
NPError
|
||||
BrowserStreamChild::NPN_RequestRead(NPByteRange* aRangeList)
|
||||
{
|
||||
@ -170,31 +180,18 @@ BrowserStreamChild::NPN_RequestRead(NPByteRange* aRangeList)
|
||||
return result;
|
||||
}
|
||||
|
||||
bool
|
||||
BrowserStreamChild::AnswerNPP_DestroyStream(const NPReason& reason,
|
||||
NPError* err)
|
||||
void
|
||||
BrowserStreamChild::NPP_DestroyStream(NPError reason)
|
||||
{
|
||||
PLUGIN_LOG_DEBUG(("%s (reason=%i)", FULLFUNCTION, reason));
|
||||
|
||||
AssertPluginThread();
|
||||
|
||||
if (mClosed) {
|
||||
NS_WARNING("NPP_DestroyStream on a closed stream");
|
||||
return true;
|
||||
}
|
||||
if (mClosed)
|
||||
return;
|
||||
|
||||
*err = mInstance->mPluginIface->destroystream(&mInstance->mData,
|
||||
&mStream, reason);
|
||||
mInstance->mPluginIface->destroystream(&mInstance->mData, &mStream, reason);
|
||||
mClosed = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
BrowserStreamChild::Recv__delete__()
|
||||
{
|
||||
if (!mClosed)
|
||||
NS_WARNING("__delete__ on an open stream");
|
||||
return true;
|
||||
}
|
||||
|
||||
} /* namespace plugins */
|
||||
|
@ -81,12 +81,8 @@ public:
|
||||
int32_t* consumed);
|
||||
|
||||
virtual bool AnswerNPP_StreamAsFile(const nsCString& fname);
|
||||
|
||||
NS_OVERRIDE
|
||||
virtual bool AnswerNPP_DestroyStream(const NPReason& reason, NPError* err);
|
||||
|
||||
NS_OVERRIDE
|
||||
virtual bool Recv__delete__();
|
||||
virtual bool Answer__delete__(const NPError& reason,
|
||||
const bool& artificial);
|
||||
|
||||
|
||||
void EnsureCorrectInstance(PluginInstanceChild* i)
|
||||
|
@ -2,15 +2,6 @@
|
||||
|
||||
#include "BrowserStreamParent.h"
|
||||
#include "PluginInstanceParent.h"
|
||||
#include "PluginModuleParent.h"
|
||||
|
||||
template<>
|
||||
struct RunnableMethodTraits<mozilla::plugins::BrowserStreamParent>
|
||||
{
|
||||
typedef mozilla::plugins::BrowserStreamParent Cls;
|
||||
static void RetainCallee(Cls* obj) { }
|
||||
static void ReleaseCallee(Cls* obj) { }
|
||||
};
|
||||
|
||||
namespace mozilla {
|
||||
namespace plugins {
|
||||
@ -19,33 +10,12 @@ BrowserStreamParent::BrowserStreamParent(PluginInstanceParent* npp,
|
||||
NPStream* stream)
|
||||
: mNPP(npp)
|
||||
, mStream(stream)
|
||||
, mDeleteTask(nsnull)
|
||||
{
|
||||
mStream->pdata = static_cast<AStream*>(this);
|
||||
}
|
||||
|
||||
BrowserStreamParent::~BrowserStreamParent()
|
||||
{
|
||||
if (mDeleteTask) {
|
||||
mDeleteTask->Cancel();
|
||||
// MessageLoop::current() owns this
|
||||
mDeleteTask = nsnull;
|
||||
}
|
||||
}
|
||||
|
||||
NPError
|
||||
BrowserStreamParent::NPP_DestroyStream(NPReason reason)
|
||||
{
|
||||
PLUGIN_LOG_DEBUG(("%s (reason=%i)", FULLFUNCTION, reason));
|
||||
|
||||
if (!mDeleteTask) {
|
||||
mDeleteTask = NewRunnableMethod(this, &BrowserStreamParent::Delete);
|
||||
MessageLoop::current()->PostTask(FROM_HERE, mDeleteTask);
|
||||
}
|
||||
|
||||
NPError err = NPERR_NO_ERROR;
|
||||
CallNPP_DestroyStream(reason, &err);
|
||||
return err;
|
||||
}
|
||||
|
||||
bool
|
||||
@ -72,6 +42,15 @@ BrowserStreamParent::AnswerNPN_RequestRead(const IPCByteRanges& ranges,
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
BrowserStreamParent::Answer__delete__(const NPError& reason,
|
||||
const bool& artificial)
|
||||
{
|
||||
if (!artificial)
|
||||
NPN_DestroyStream(reason);
|
||||
return true;
|
||||
}
|
||||
|
||||
int32_t
|
||||
BrowserStreamParent::WriteReady()
|
||||
{
|
||||
@ -108,21 +87,12 @@ BrowserStreamParent::StreamAsFile(const char* fname)
|
||||
CallNPP_StreamAsFile(nsCString(fname));
|
||||
}
|
||||
|
||||
bool
|
||||
BrowserStreamParent::AnswerNPN_DestroyStream(const NPReason& reason,
|
||||
NPError* result)
|
||||
NPError
|
||||
BrowserStreamParent::NPN_DestroyStream(NPReason reason)
|
||||
{
|
||||
PLUGIN_LOG_DEBUG_FUNCTION;
|
||||
|
||||
*result = mNPP->mNPNIface->destroystream(mNPP->mNPP, mStream, reason);
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
BrowserStreamParent::Delete()
|
||||
{
|
||||
PBrowserStreamParent::Send__delete__(this);
|
||||
// |this| just got deleted
|
||||
return mNPP->mNPNIface->destroystream(mNPP->mNPP, mStream, reason);
|
||||
}
|
||||
|
||||
} // namespace plugins
|
||||
|
@ -44,7 +44,6 @@
|
||||
namespace mozilla {
|
||||
namespace plugins {
|
||||
|
||||
class PluginModuleParent;
|
||||
class PluginInstanceParent;
|
||||
|
||||
class BrowserStreamParent : public PBrowserStreamParent, public AStream
|
||||
@ -57,25 +56,23 @@ public:
|
||||
NPStream* stream);
|
||||
virtual ~BrowserStreamParent();
|
||||
|
||||
NPError NPP_DestroyStream(NPReason reason);
|
||||
|
||||
NS_OVERRIDE virtual bool IsBrowserStream() { return true; }
|
||||
|
||||
virtual bool AnswerNPN_RequestRead(const IPCByteRanges& ranges,
|
||||
NPError* result);
|
||||
|
||||
virtual bool AnswerNPN_DestroyStream(const NPReason& reason, NPError* result);
|
||||
virtual bool
|
||||
Answer__delete__(const NPError& reason, const bool& artificial);
|
||||
|
||||
int32_t WriteReady();
|
||||
int32_t Write(int32_t offset, int32_t len, void* buffer);
|
||||
void StreamAsFile(const char* fname);
|
||||
|
||||
private:
|
||||
void Delete();
|
||||
NPError NPN_DestroyStream(NPError reason);
|
||||
|
||||
PluginInstanceParent* mNPP;
|
||||
NPStream* mStream;
|
||||
CancelableTask* mDeleteTask;
|
||||
};
|
||||
|
||||
} // namespace plugins
|
||||
|
@ -66,17 +66,17 @@ child:
|
||||
|
||||
rpc NPP_StreamAsFile(nsCString fname);
|
||||
|
||||
rpc NPP_DestroyStream(NPReason reason)
|
||||
returns (NPError error);
|
||||
|
||||
async __delete__();
|
||||
|
||||
parent:
|
||||
rpc NPN_RequestRead(IPCByteRanges ranges)
|
||||
returns (NPError result);
|
||||
|
||||
rpc NPN_DestroyStream(NPReason reason)
|
||||
returns (NPError error);
|
||||
both:
|
||||
/**
|
||||
* ~PBrowserStream is for both NPN_DestroyStream and NPP_DestroyStream.
|
||||
* @param artificial True when the stream is closed as a by-product of
|
||||
* some other call (such as a failure in NPP_Write).
|
||||
*/
|
||||
rpc __delete__(NPReason reason, bool artificial);
|
||||
};
|
||||
|
||||
} // namespace plugins
|
||||
|
@ -612,7 +612,7 @@ PluginInstanceParent::NPP_NewStream(NPMIMEType type, NPStream* stream,
|
||||
return NPERR_GENERIC_ERROR;
|
||||
|
||||
if (NPERR_NO_ERROR != err)
|
||||
bs->NPP_DestroyStream(NPERR_GENERIC_ERROR);
|
||||
PBrowserStreamParent::Call__delete__(bs, NPERR_GENERIC_ERROR, true);
|
||||
|
||||
return err;
|
||||
}
|
||||
@ -630,7 +630,8 @@ PluginInstanceParent::NPP_DestroyStream(NPStream* stream, NPReason reason)
|
||||
if (sp->mNPP != this)
|
||||
NS_RUNTIMEABORT("Mismatched plugin data");
|
||||
|
||||
return sp->NPP_DestroyStream(reason);
|
||||
PBrowserStreamParent::Call__delete__(sp, reason, false);
|
||||
return NPERR_NO_ERROR;
|
||||
}
|
||||
else {
|
||||
PluginStreamParent* sp =
|
||||
|
@ -898,9 +898,7 @@ _destroystream(NPP aNPP,
|
||||
if (s->IsBrowserStream()) {
|
||||
BrowserStreamChild* bs = static_cast<BrowserStreamChild*>(s);
|
||||
bs->EnsureCorrectInstance(p);
|
||||
NPError err = NPERR_NO_ERROR;
|
||||
bs->CallNPN_DestroyStream(aReason, &err);
|
||||
return err;
|
||||
PBrowserStreamChild::Call__delete__(bs, aReason, false);
|
||||
}
|
||||
else {
|
||||
PluginStreamChild* ps = static_cast<PluginStreamChild*>(s);
|
||||
|
Loading…
x
Reference in New Issue
Block a user