mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-11 20:35:50 +00:00
Bug 1388464: Use SyncRunnable instead of DISPATCH_SYNC to actually block the main thread during the blocking preference file write. r=smaug
MozReview-Commit-ID: 6J1252Q3pBr --HG-- extra : rebase_source : a2ede1a9e5a9cf6f26139c747404f6a62318207e
This commit is contained in:
parent
d408f82c90
commit
90d1627382
@ -11,6 +11,7 @@
|
|||||||
#include "mozilla/Attributes.h"
|
#include "mozilla/Attributes.h"
|
||||||
#include "mozilla/HashFunctions.h"
|
#include "mozilla/HashFunctions.h"
|
||||||
#include "mozilla/ServoStyleSet.h"
|
#include "mozilla/ServoStyleSet.h"
|
||||||
|
#include "mozilla/SyncRunnable.h"
|
||||||
#include "mozilla/Telemetry.h"
|
#include "mozilla/Telemetry.h"
|
||||||
#include "mozilla/UniquePtrExtensions.h"
|
#include "mozilla/UniquePtrExtensions.h"
|
||||||
|
|
||||||
@ -1239,9 +1240,13 @@ Preferences::WritePrefFile(nsIFile* aFile, SaveMethod aSaveMethod)
|
|||||||
do_GetService(NS_STREAMTRANSPORTSERVICE_CONTRACTID, &rv);
|
do_GetService(NS_STREAMTRANSPORTSERVICE_CONTRACTID, &rv);
|
||||||
if (NS_SUCCEEDED(rv)) {
|
if (NS_SUCCEEDED(rv)) {
|
||||||
bool async = aSaveMethod == SaveMethod::Asynchronous;
|
bool async = aSaveMethod == SaveMethod::Asynchronous;
|
||||||
rv = target->Dispatch(new PWRunnable(aFile),
|
if (async) {
|
||||||
async ? nsIEventTarget::DISPATCH_NORMAL :
|
rv = target->Dispatch(new PWRunnable(aFile),
|
||||||
nsIEventTarget::DISPATCH_SYNC);
|
nsIEventTarget::DISPATCH_NORMAL);
|
||||||
|
} else {
|
||||||
|
// Note that we don't get the nsresult return value here
|
||||||
|
SyncRunnable::DispatchToThread(target, new PWRunnable(aFile), true);
|
||||||
|
}
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user