Backed out changeset f73b7b8d1a2d (bug 829557) for failing to compile on Windows on a CLOSED TREE

This commit is contained in:
Ed Morley 2013-02-27 12:50:30 +00:00
Родитель ef9f78a601
Коммит 260d9da13c
9 изменённых файлов: 38 добавлений и 80 удалений

Просмотреть файл

@ -41,7 +41,6 @@ EXPORTS = \
nsPluginsCID.h \
nsNPAPIPluginInstance.h \
nsPluginsDir.h \
nsPluginSafety.h \
nsPluginTags.h \
nsPluginDirServiceProvider.h \
nsPluginHost.h \

Просмотреть файл

@ -186,9 +186,9 @@ enum eNPPStreamTypeInternal {
static NS_DEFINE_IID(kMemoryCID, NS_MEMORY_CID);
PRIntervalTime NS_NotifyBeginPluginCall(NSPluginCallReentry aReentryState)
PRIntervalTime NS_NotifyBeginPluginCall()
{
nsNPAPIPluginInstance::BeginPluginCall(aReentryState);
nsNPAPIPluginInstance::BeginPluginCall();
return PR_IntervalNow();
}
@ -196,9 +196,9 @@ PRIntervalTime NS_NotifyBeginPluginCall(NSPluginCallReentry aReentryState)
// registered to listen to the "experimental-notify-plugin-call" subject.
// Each "experimental-notify-plugin-call" notification carries with it the run
// time value in milliseconds that the call took to execute.
void NS_NotifyPluginCall(PRIntervalTime startTime, NSPluginCallReentry aReentryState)
void NS_NotifyPluginCall(PRIntervalTime startTime)
{
nsNPAPIPluginInstance::EndPluginCall(aReentryState);
nsNPAPIPluginInstance::EndPluginCall();
PRIntervalTime endTime = PR_IntervalNow() - startTime;
nsCOMPtr<nsIObserverService> notifyUIService =
@ -789,8 +789,7 @@ nsPluginThreadRunnable::Run()
if (mFunc) {
PluginDestructionGuard guard(mInstance);
NS_TRY_SAFE_CALL_VOID(mFunc(mUserData), nullptr,
NS_PLUGIN_CALL_UNSAFE_TO_REENTER_GECKO);
NS_TRY_SAFE_CALL_VOID(mFunc(mUserData), nullptr);
}
return NS_OK;

Просмотреть файл

@ -213,7 +213,7 @@ nsNPAPIPluginInstance::~nsNPAPIPluginInstance()
}
}
uint32_t nsNPAPIPluginInstance::gInUnsafePluginCalls = 0;
uint32_t nsNPAPIPluginInstance::gInPluginCalls = 0;
void
nsNPAPIPluginInstance::Destroy()
@ -317,8 +317,7 @@ nsresult nsNPAPIPluginInstance::Stop()
if (pluginFunctions->destroy) {
NPSavedData *sdata = 0;
NS_TRY_SAFE_CALL_RETURN(error, (*pluginFunctions->destroy)(&mNPP, &sdata), this,
NS_PLUGIN_CALL_UNSAFE_TO_REENTER_GECKO);
NS_TRY_SAFE_CALL_RETURN(error, (*pluginFunctions->destroy)(&mNPP, &sdata), this);
NPP_PLUGIN_LOG(PLUGIN_LOG_NORMAL,
("NPP Destroy called: this=%p, npp=%p, return=%d\n", this, &mNPP, error));
@ -583,8 +582,7 @@ nsresult nsNPAPIPluginInstance::SetWindow(NPWindow* window)
NPPAutoPusher nppPusher(&mNPP);
DebugOnly<NPError> error;
NS_TRY_SAFE_CALL_RETURN(error, (*pluginFunctions->setwindow)(&mNPP, (NPWindow*)window), this,
NS_PLUGIN_CALL_UNSAFE_TO_REENTER_GECKO);
NS_TRY_SAFE_CALL_RETURN(error, (*pluginFunctions->setwindow)(&mNPP, (NPWindow*)window), this);
mInPluginInitCall = oldVal;
@ -652,8 +650,7 @@ nsresult nsNPAPIPluginInstance::Print(NPPrint* platformPrint)
}
if (pluginFunctions->print)
NS_TRY_SAFE_CALL_VOID((*pluginFunctions->print)(&mNPP, thePrint), this,
NS_PLUGIN_CALL_UNSAFE_TO_REENTER_GECKO);
NS_TRY_SAFE_CALL_VOID((*pluginFunctions->print)(&mNPP, thePrint), this);
NPP_PLUGIN_LOG(PLUGIN_LOG_NORMAL,
("NPP PrintProc called: this=%p, pDC=%p, [x=%d,y=%d,w=%d,h=%d], clip[t=%d,b=%d,l=%d,r=%d]\n",
@ -691,8 +688,7 @@ nsresult nsNPAPIPluginInstance::HandleEvent(void* event, int16_t* result)
if (pluginFunctions->event) {
mCurrentPluginEvent = event;
#if defined(XP_WIN) || defined(XP_OS2)
NS_TRY_SAFE_CALL_RETURN(tmpResult, (*pluginFunctions->event)(&mNPP, event), this,
NS_PLUGIN_CALL_UNSAFE_TO_REENTER_GECKO);
NS_TRY_SAFE_CALL_RETURN(tmpResult, (*pluginFunctions->event)(&mNPP, event), this);
#else
MAIN_THREAD_JNI_REF_GUARD;
tmpResult = (*pluginFunctions->event)(&mNPP, event);
@ -722,8 +718,7 @@ nsresult nsNPAPIPluginInstance::GetValueFromPlugin(NPPVariable variable, void* v
PluginDestructionGuard guard(this);
NPError pluginError = NPERR_GENERIC_ERROR;
NS_TRY_SAFE_CALL_RETURN(pluginError, (*pluginFunctions->getvalue)(&mNPP, variable, value), this,
NS_PLUGIN_CALL_UNSAFE_TO_REENTER_GECKO);
NS_TRY_SAFE_CALL_RETURN(pluginError, (*pluginFunctions->getvalue)(&mNPP, variable, value), this);
NPP_PLUGIN_LOG(PLUGIN_LOG_NORMAL,
("NPP GetValue called: this=%p, npp=%p, var=%d, value=%d, return=%d\n",
this, &mNPP, variable, value, pluginError));
@ -1409,8 +1404,7 @@ nsNPAPIPluginInstance::PrivateModeStateChanged(bool enabled)
NPError error;
NPBool value = static_cast<NPBool>(enabled);
NS_TRY_SAFE_CALL_RETURN(error, (*pluginFunctions->setvalue)(&mNPP, NPNVprivateModeBool, &value), this,
NS_PLUGIN_CALL_UNSAFE_TO_REENTER_GECKO);
NS_TRY_SAFE_CALL_RETURN(error, (*pluginFunctions->setvalue)(&mNPP, NPNVprivateModeBool, &value), this);
return (error == NPERR_NO_ERROR) ? NS_OK : NS_ERROR_FAILURE;
}

Просмотреть файл

@ -50,18 +50,6 @@ const NPDrawingModel kDefaultDrawingModel = NPDrawingModelCoreGraphics;
const NPDrawingModel kDefaultDrawingModel = static_cast<NPDrawingModel>(0);
#endif
/**
* Used to indicate whether it's OK to reenter Gecko and repaint, flush frames,
* run scripts, etc, during this plugin call.
* When NS_PLUGIN_CALL_UNSAFE_TO_REENTER_GECKO is set, we try to avoid dangerous
* Gecko activities when the plugin spins a nested event loop, on a best-effort
* basis.
*/
enum NSPluginCallReentry {
NS_PLUGIN_CALL_SAFE_TO_REENTER_GECKO,
NS_PLUGIN_CALL_UNSAFE_TO_REENTER_GECKO
};
class nsNPAPITimer
{
public:
@ -285,19 +273,12 @@ public:
// Returns the contents scale factor of the screen the plugin is drawn on.
double GetContentsScaleFactor();
static bool InPluginCallUnsafeForReentry() { return gInUnsafePluginCalls > 0; }
static void BeginPluginCall(NSPluginCallReentry aReentryState)
static bool InPluginCall() { return gInPluginCalls > 0; }
static void BeginPluginCall() { ++gInPluginCalls; }
static void EndPluginCall()
{
if (aReentryState == NS_PLUGIN_CALL_UNSAFE_TO_REENTER_GECKO) {
++gInUnsafePluginCalls;
}
}
static void EndPluginCall(NSPluginCallReentry aReentryState)
{
if (aReentryState == NS_PLUGIN_CALL_UNSAFE_TO_REENTER_GECKO) {
NS_ASSERTION(gInUnsafePluginCalls > 0, "Must be in plugin call");
--gInUnsafePluginCalls;
}
NS_ASSERTION(InPluginCall(), "Must be in plugin call");
--gInPluginCalls;
}
protected:
@ -395,7 +376,7 @@ private:
// is this instance Java and affected by bug 750480?
bool mHaveJavaC2PJSObjectQuirk;
static uint32_t gInUnsafePluginCalls;
static uint32_t gInPluginCalls;
};
#endif // nsNPAPIPluginInstance_h_

Просмотреть файл

@ -235,8 +235,7 @@ nsNPAPIPluginStreamListener::CleanUpStream(NPReason reason)
NPPAutoPusher nppPusher(npp);
NPError error;
NS_TRY_SAFE_CALL_RETURN(error, (*pluginFunctions->destroystream)(npp, &mNPStreamWrapper->mNPStream, reason), mInst,
NS_PLUGIN_CALL_UNSAFE_TO_REENTER_GECKO);
NS_TRY_SAFE_CALL_RETURN(error, (*pluginFunctions->destroystream)(npp, &mNPStreamWrapper->mNPStream, reason), mInst);
NPP_PLUGIN_LOG(PLUGIN_LOG_NORMAL,
("NPP DestroyStream called: this=%p, npp=%p, reason=%d, return=%d, url=%s\n",
@ -274,8 +273,7 @@ nsNPAPIPluginStreamListener::CallURLNotify(NPReason reason)
NPP npp;
mInst->GetNPP(&npp);
NS_TRY_SAFE_CALL_VOID((*pluginFunctions->urlnotify)(npp, mNotifyURL, reason, mNPStreamWrapper->mNPStream.notifyData), mInst,
NS_PLUGIN_CALL_UNSAFE_TO_REENTER_GECKO);
NS_TRY_SAFE_CALL_VOID((*pluginFunctions->urlnotify)(npp, mNotifyURL, reason, mNPStreamWrapper->mNPStream.notifyData), mInst);
NPP_PLUGIN_LOG(PLUGIN_LOG_NORMAL,
("NPP URLNotify called: this=%p, npp=%p, notify=%p, reason=%d, url=%s\n",
@ -323,8 +321,7 @@ nsNPAPIPluginStreamListener::OnStartBinding(nsPluginStreamListenerPeer* streamPe
NPPAutoPusher nppPusher(npp);
NS_TRY_SAFE_CALL_RETURN(error, (*pluginFunctions->newstream)(npp, (char*)contentType, &mNPStreamWrapper->mNPStream, seekable, &streamType), mInst,
NS_PLUGIN_CALL_UNSAFE_TO_REENTER_GECKO);
NS_TRY_SAFE_CALL_RETURN(error, (*pluginFunctions->newstream)(npp, (char*)contentType, &mNPStreamWrapper->mNPStream, seekable, &streamType), mInst);
NPP_PLUGIN_LOG(PLUGIN_LOG_NORMAL,
("NPP NewStream called: this=%p, npp=%p, mime=%s, seek=%d, type=%d, return=%d, url=%s\n",
@ -566,8 +563,7 @@ nsNPAPIPluginStreamListener::OnDataAvailable(nsPluginStreamListenerPeer* streamP
if (pluginFunctions->writeready) {
NPPAutoPusher nppPusher(npp);
NS_TRY_SAFE_CALL_RETURN(numtowrite, (*pluginFunctions->writeready)(npp, &mNPStreamWrapper->mNPStream), mInst,
NS_PLUGIN_CALL_UNSAFE_TO_REENTER_GECKO);
NS_TRY_SAFE_CALL_RETURN(numtowrite, (*pluginFunctions->writeready)(npp, &mNPStreamWrapper->mNPStream), mInst);
NPP_PLUGIN_LOG(PLUGIN_LOG_NOISY,
("NPP WriteReady called: this=%p, npp=%p, "
"return(towrite)=%d, url=%s\n",
@ -616,8 +612,7 @@ nsNPAPIPluginStreamListener::OnDataAvailable(nsPluginStreamListenerPeer* streamP
NPPAutoPusher nppPusher(npp);
int32_t writeCount = 0; // bytes consumed by plugin instance
NS_TRY_SAFE_CALL_RETURN(writeCount, (*pluginFunctions->write)(npp, &mNPStreamWrapper->mNPStream, streamPosition, numtowrite, ptrStreamBuffer), mInst,
NS_PLUGIN_CALL_UNSAFE_TO_REENTER_GECKO);
NS_TRY_SAFE_CALL_RETURN(writeCount, (*pluginFunctions->write)(npp, &mNPStreamWrapper->mNPStream, streamPosition, numtowrite, ptrStreamBuffer), mInst);
NPP_PLUGIN_LOG(PLUGIN_LOG_NOISY,
("NPP Write called: this=%p, npp=%p, pos=%d, len=%d, "
@ -725,8 +720,7 @@ nsNPAPIPluginStreamListener::OnFileAvailable(nsPluginStreamListenerPeer* streamP
NPP npp;
mInst->GetNPP(&npp);
NS_TRY_SAFE_CALL_VOID((*pluginFunctions->asfile)(npp, &mNPStreamWrapper->mNPStream, fileName), mInst,
NS_PLUGIN_CALL_UNSAFE_TO_REENTER_GECKO);
NS_TRY_SAFE_CALL_VOID((*pluginFunctions->asfile)(npp, &mNPStreamWrapper->mNPStream, fileName), mInst);
NPP_PLUGIN_LOG(PLUGIN_LOG_NORMAL,
("NPP StreamAsFile called: this=%p, npp=%p, url=%s, file=%s\n",
@ -868,8 +862,7 @@ nsNPAPIPluginStreamListener::HandleRedirectNotification(nsIChannel *oldChannel,
NPP npp;
mInst->GetNPP(&npp);
#if defined(XP_WIN) || defined(XP_OS2)
NS_TRY_SAFE_CALL_VOID((*pluginFunctions->urlredirectnotify)(npp, spec.get(), static_cast<int32_t>(status), mNPStreamWrapper->mNPStream.notifyData), mInst,
NS_PLUGIN_CALL_UNSAFE_TO_REENTER_GECKO);
NS_TRY_SAFE_CALL_VOID((*pluginFunctions->urlredirectnotify)(npp, spec.get(), static_cast<int32_t>(status), mNPStreamWrapper->mNPStream.notifyData), mInst);
#else
MAIN_THREAD_JNI_REF_GUARD;
(*pluginFunctions->urlredirectnotify)(npp, spec.get(), static_cast<int32_t>(status), mNPStreamWrapper->mNPStream.notifyData);

Просмотреть файл

@ -173,8 +173,7 @@ static bool ProcessFlashMessageDelayed(nsPluginNativeWindowOS2 * aWin,
if (msg == sWM_FLASHBOUNCEMSG) {
// See PluginWindowEvent::Run() below.
NS_TRY_SAFE_CALL_VOID((aWin->GetWindowProc())(hWnd, WM_USER_FLASH, mp1, mp2),
inst,
NS_PLUGIN_CALL_UNSAFE_TO_REENTER_GECKO);
inst);
return TRUE;
}
@ -310,11 +309,9 @@ static MRESULT EXPENTRY PluginWndProc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM m
MRESULT res = (MRESULT)TRUE;
if (win->mPluginType == nsPluginType_Java_vm)
NS_TRY_SAFE_CALL_RETURN(res, ::WinDefWindowProc(hWnd, msg, mp1, mp2), inst,
NS_PLUGIN_CALL_UNSAFE_TO_REENTER_GECKO);
NS_TRY_SAFE_CALL_RETURN(res, ::WinDefWindowProc(hWnd, msg, mp1, mp2), inst);
else
NS_TRY_SAFE_CALL_RETURN(res, (win->GetWindowProc())(hWnd, msg, mp1, mp2), inst,
NS_PLUGIN_CALL_UNSAFE_TO_REENTER_GECKO);
NS_TRY_SAFE_CALL_RETURN(res, (win->GetWindowProc())(hWnd, msg, mp1, mp2), inst);
if (inst) {
// Popups are enabled (were enabled before the call to
@ -400,8 +397,7 @@ NS_IMETHODIMP PluginWindowEvent::Run()
// is more generic.
NS_TRY_SAFE_CALL_VOID((win->GetWindowProc())
(hWnd, GetMsg(), GetWParam(), GetLParam()),
inst,
NS_PLUGIN_CALL_UNSAFE_TO_REENTER_GECKO);
inst);
Clear();
return NS_OK;

Просмотреть файл

@ -18,23 +18,23 @@
#define MAIN_THREAD_JNI_REF_GUARD
#endif
PRIntervalTime NS_NotifyBeginPluginCall(NSPluginCallReentry aReentryState);
void NS_NotifyPluginCall(PRIntervalTime aTime, NSPluginCallReentry aReentryState);
PRIntervalTime NS_NotifyBeginPluginCall();
void NS_NotifyPluginCall(PRIntervalTime);
#define NS_TRY_SAFE_CALL_RETURN(ret, fun, pluginInst, pluginCallReentry) \
#define NS_TRY_SAFE_CALL_RETURN(ret, fun, pluginInst) \
PR_BEGIN_MACRO \
MAIN_THREAD_JNI_REF_GUARD; \
PRIntervalTime startTime = NS_NotifyBeginPluginCall(pluginCallReentry); \
PRIntervalTime startTime = NS_NotifyBeginPluginCall(); \
ret = fun; \
NS_NotifyPluginCall(startTime, pluginCallReentry); \
NS_NotifyPluginCall(startTime); \
PR_END_MACRO
#define NS_TRY_SAFE_CALL_VOID(fun, pluginInst, pluginCallReentry) \
#define NS_TRY_SAFE_CALL_VOID(fun, pluginInst) \
PR_BEGIN_MACRO \
MAIN_THREAD_JNI_REF_GUARD; \
PRIntervalTime startTime = NS_NotifyBeginPluginCall(pluginCallReentry); \
PRIntervalTime startTime = NS_NotifyBeginPluginCall(); \
fun; \
NS_NotifyPluginCall(startTime, pluginCallReentry); \
NS_NotifyPluginCall(startTime); \
PR_END_MACRO
#endif //nsPluginSafety_h_

Просмотреть файл

@ -820,7 +820,7 @@ nsRefreshDriver::Tick(int64_t aNowEpoch, TimeStamp aNowTime)
NS_PRECONDITION(!nsContentUtils::GetCurrentJSContext(),
"Shouldn't have a JSContext on the stack");
if (nsNPAPIPluginInstance::InPluginCallUnsafeForReentry()) {
if (nsNPAPIPluginInstance::InPluginCall()) {
NS_ERROR("Refresh driver should not run during plugin call!");
// Try to survive this by just ignoring the refresh tick.
return;

Просмотреть файл

@ -2071,8 +2071,6 @@ nsObjectFrame::HandleEvent(nsPresContext* aPresContext,
if (mInstanceOwner->SendNativeEvents() &&
NS_IS_PLUGIN_EVENT(anEvent)) {
*anEventStatus = mInstanceOwner->ProcessEvent(*anEvent);
// Due to plugin code reentering Gecko, this frame may be dead at this
// point.
return rv;
}
@ -2087,8 +2085,6 @@ nsObjectFrame::HandleEvent(nsPresContext* aPresContext,
anEvent->message == NS_WHEEL_WHEEL) &&
mInstanceOwner->GetEventModel() == NPEventModelCocoa) {
*anEventStatus = mInstanceOwner->ProcessEvent(*anEvent);
// Due to plugin code reentering Gecko, this frame may be dead at this
// point.
return rv;
}
#endif