Bug 996133: Remove unnecessary NS_DISPATCH_NORMAL arguments to NS_DispatchToMainThread. r=ehsan

This commit is contained in:
Kyle Huey 2014-05-23 12:53:17 -07:00
Родитель 7af104c03a
Коммит 8c5cca136c
54 изменённых файлов: 98 добавлений и 105 удалений

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

@ -382,7 +382,7 @@ EventSource::OnStartRequest(nsIRequest *aRequest,
NS_NewRunnableMethod(this, &EventSource::AnnounceConnection);
NS_ENSURE_STATE(event);
rv = NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
rv = NS_DispatchToMainThread(event);
NS_ENSURE_SUCCESS(rv, rv);
mStatus = PARSE_STATE_BEGIN_OF_STREAM;
@ -484,7 +484,7 @@ EventSource::OnStopRequest(nsIRequest *aRequest,
NS_NewRunnableMethod(this, &EventSource::ReestablishConnection);
NS_ENSURE_STATE(event);
rv = NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
rv = NS_DispatchToMainThread(event);
NS_ENSURE_SUCCESS(rv, rv);
return healthOfRequestResult;
@ -1010,7 +1010,7 @@ EventSource::DispatchFailConnection()
NS_NewRunnableMethod(this, &EventSource::FailConnection);
NS_ENSURE_STATE(event);
return NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
return NS_DispatchToMainThread(event);
}
void
@ -1156,7 +1156,7 @@ EventSource::Thaw()
mGoingToDispatchAllMessages = true;
rv = NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
rv = NS_DispatchToMainThread(event);
NS_ENSURE_SUCCESS(rv, rv);
}
@ -1216,7 +1216,7 @@ EventSource::DispatchCurrentMessageEvent()
mGoingToDispatchAllMessages = true;
return NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
return NS_DispatchToMainThread(event);
}
return NS_OK;

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

@ -330,7 +330,7 @@ WebSocket::ScheduleConnectionCloseEvents(nsISupports* aContext,
nsresult aStatusCode,
bool sync)
{
NS_ABORT_IF_FALSE(NS_IsMainThread(), "Not running on main thread");
MOZ_ASSERT(NS_IsMainThread());
// no-op if some other code has already initiated close event
if (!mOnCloseScheduled) {
@ -351,8 +351,7 @@ WebSocket::ScheduleConnectionCloseEvents(nsISupports* aContext,
if (sync) {
DispatchConnectionCloseEvents();
} else {
NS_DispatchToMainThread(new CallDispatchConnectionCloseEvents(this),
NS_DISPATCH_NORMAL);
NS_DispatchToCurrentThread(new CallDispatchConnectionCloseEvents(this));
}
}

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

@ -154,7 +154,7 @@ public:
} else {
mEncodingCompleteEvent->SetMembers(imgData, imgSize, mType);
}
rv = NS_DispatchToMainThread(mEncodingCompleteEvent, NS_DISPATCH_NORMAL);
rv = NS_DispatchToMainThread(mEncodingCompleteEvent);
if (NS_FAILED(rv)) {
// Better to leak than to crash.
mEncodingCompleteEvent.forget();

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

@ -3267,7 +3267,7 @@ nsresult HTMLMediaElement::DispatchAsyncEvent(const nsAString& aName)
}
nsCOMPtr<nsIRunnable> event = new nsAsyncEventRunner(aName, this);
NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
NS_DispatchToMainThread(event);
return NS_OK;
}
@ -3459,7 +3459,7 @@ void HTMLMediaElement::DispatchAsyncSourceError(nsIContent* aSourceElement)
LOG_EVENT(PR_LOG_DEBUG, ("%p Queuing simple source error event", this));
nsCOMPtr<nsIRunnable> event = new nsSourceErrorEventRunner(this, aSourceElement);
NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
NS_DispatchToMainThread(event);
}
void HTMLMediaElement::NotifyAddedSource()

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

@ -1118,7 +1118,7 @@ void MediaDecoderStateMachine::UpdatePlaybackPositionInternal(int64_t aTime)
mEndTime = aTime;
nsCOMPtr<nsIRunnable> event =
NS_NewRunnableMethod(mDecoder, &MediaDecoder::DurationChanged);
NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
NS_DispatchToMainThread(event);
}
}
@ -1131,7 +1131,7 @@ void MediaDecoderStateMachine::UpdatePlaybackPosition(int64_t aTime)
mPositionChangeQueued = true;
nsCOMPtr<nsIRunnable> event =
NS_NewRunnableMethod(mDecoder, &MediaDecoder::PlaybackPositionChanged);
NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
NS_DispatchToMainThread(event);
}
mMetadataManager.DispatchMetadataIfNeeded(mDecoder, aTime);
@ -1227,7 +1227,7 @@ void MediaDecoderStateMachine::UpdateEstimatedDuration(int64_t aDuration)
SetDuration(aDuration);
nsCOMPtr<nsIRunnable> event =
NS_NewRunnableMethod(mDecoder, &MediaDecoder::DurationChanged);
NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
NS_DispatchToMainThread(event);
}
}
@ -1855,7 +1855,7 @@ nsresult MediaDecoderStateMachine::DecodeMetadata()
HasAudio(),
HasVideo(),
tags);
NS_DispatchToMainThread(metadataLoadedEvent, NS_DISPATCH_NORMAL);
NS_DispatchToMainThread(metadataLoadedEvent);
if (HasAudio()) {
RefPtr<nsIRunnable> decodeTask(
@ -1984,7 +1984,7 @@ void MediaDecoderStateMachine::DecodeSeek()
}
nsCOMPtr<nsIRunnable> event =
NS_NewRunnableMethod(mDecoder, &MediaDecoder::Invalidate);
NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
NS_DispatchToMainThread(event);
}
}
} else {
@ -2583,7 +2583,7 @@ void MediaDecoderStateMachine::UpdateReadyState() {
*/
nsCOMPtr<nsIRunnable> event;
event = NS_NewRunnableMethod(mDecoder, &MediaDecoder::UpdateReadyStateForData);
NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
NS_DispatchToMainThread(event);
}
bool MediaDecoderStateMachine::JustExitedQuickBuffering()

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

@ -57,7 +57,7 @@ namespace mozilla {
metadata->mHasAudio,
metadata->mHasVideo,
metadata->mTags.forget());
NS_DispatchToMainThread(metadataUpdatedEvent, NS_DISPATCH_NORMAL);
NS_DispatchToMainThread(metadataUpdatedEvent);
delete mMetadataQueue.popFirst();
metadata = mMetadataQueue.getFirst();
}

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

@ -631,8 +631,7 @@ MediaRecorder::RequestData(ErrorResult& aResult)
NS_DispatchToMainThread(
new CreateAndDispatchBlobEventRunnable(mSessions.LastElement()->GetEncodedData(),
this),
NS_DISPATCH_NORMAL);
this));
}
JSObject*

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

@ -971,7 +971,7 @@ ChannelMediaResource::CacheClientNotifyDataReceived()
mDataReceivedEvent =
NS_NewNonOwningRunnableMethod(this, &ChannelMediaResource::DoNotifyDataReceived);
NS_DispatchToMainThread(mDataReceivedEvent.get(), NS_DISPATCH_NORMAL);
NS_DispatchToMainThread(mDataReceivedEvent.get());
}
class DataEnded : public nsRunnable {
@ -990,12 +990,12 @@ private:
void
ChannelMediaResource::CacheClientNotifyDataEnded(nsresult aStatus)
{
NS_ASSERTION(NS_IsMainThread(), "Don't call on non-main thread");
MOZ_ASSERT(NS_IsMainThread());
// NOTE: this can be called with the media cache lock held, so don't
// block or do anything which might try to acquire a lock!
nsCOMPtr<nsIRunnable> event = new DataEnded(mDecoder, aStatus);
NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
NS_DispatchToCurrentThread(event);
}
void
@ -1316,7 +1316,7 @@ void FileMediaResource::EnsureSizeInitialized()
if (NS_SUCCEEDED(res) && size <= INT64_MAX) {
mSize = (int64_t)size;
nsCOMPtr<nsIRunnable> event = new DataEnded(mDecoder, NS_OK);
NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
NS_DispatchToMainThread(event);
}
}
@ -1664,7 +1664,7 @@ void BaseMediaResource::DispatchBytesConsumed(int64_t aNumBytes, int64_t aOffset
return;
}
RefPtr<nsIRunnable> event(new DispatchBytesConsumedEvent(mDecoder, aNumBytes, aOffset));
NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
NS_DispatchToMainThread(event);
}
} // namespace mozilla

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

@ -1054,7 +1054,7 @@ MediaStreamGraphImpl::PlayVideo(MediaStream* aStream)
nsCOMPtr<nsIRunnable> event =
NS_NewRunnableMethod(output, &VideoFrameContainer::Invalidate);
NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
NS_DispatchToMainThread(event);
}
if (!aStream->mNotifiedFinished) {
aStream->mLastPlayedVideoFrame = *frame;

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

@ -572,7 +572,7 @@ RtspMediaResource::OnConnected(uint8_t aTrackIdx,
// Give up, report error to media element.
nsCOMPtr<nsIRunnable> event =
NS_NewRunnableMethod(mDecoder, &MediaDecoder::DecodeError);
NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
NS_DispatchToMainThread(event);
return NS_ERROR_FAILURE;
}
uint64_t duration = 0;
@ -618,7 +618,7 @@ RtspMediaResource::OnConnected(uint8_t aTrackIdx,
// Give up, report error to media element.
nsCOMPtr<nsIRunnable> event =
NS_NewRunnableMethod(mDecoder, &MediaDecoder::DecodeError);
NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
NS_DispatchToMainThread(event);
return NS_ERROR_FAILURE;
} else {
mRealTime = true;

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

@ -165,7 +165,7 @@ NS_IMETHODIMP_(MozExternalRefCountType) SharedThreadPool::Release(void)
// Ensure that we only run on the main thread.
// Do this in an event so that if something holds the monitor we won't
// be deleting the monitor while it's held.
NS_DispatchToMainThread(new ShutdownPoolsEvent(), NS_DISPATCH_NORMAL);
NS_DispatchToMainThread(new ShutdownPoolsEvent());
}
return 0;
}

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

@ -172,7 +172,7 @@ TextTrackList::CreateAndDispatchChangeEvent()
event->SetTrusted(true);
nsCOMPtr<nsIRunnable> eventRunner = new TrackEventRunner(this, event);
NS_DispatchToMainThread(eventRunner, NS_DISPATCH_NORMAL);
NS_DispatchToMainThread(eventRunner);
}
void
@ -188,7 +188,7 @@ TextTrackList::CreateAndDispatchTrackEventRunner(TextTrack* aTrack,
// Dispatch the TrackEvent asynchronously.
nsCOMPtr<nsIRunnable> eventRunner = new TrackEventRunner(this, event);
NS_DispatchToMainThread(eventRunner, NS_DISPATCH_NORMAL);
NS_DispatchToMainThread(eventRunner);
}
HTMLMediaElement*

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

@ -354,7 +354,7 @@ MediaSource::QueueAsyncSimpleEvent(const char* aName)
{
MSE_DEBUG("%p Queuing event %s to MediaSource", this, aName);
nsCOMPtr<nsIRunnable> event = new AsyncEventRunner<MediaSource>(this, aName);
NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
NS_DispatchToMainThread(event);
}
void

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

@ -142,7 +142,7 @@ SourceBufferList::QueueAsyncSimpleEvent(const char* aName)
{
MSE_DEBUG("%p Queuing event %s to SourceBufferList", this, aName);
nsCOMPtr<nsIRunnable> event = new AsyncEventRunner<SourceBufferList>(this, aName);
NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
NS_DispatchToMainThread(event);
}
SourceBufferList::SourceBufferList(MediaSource* aMediaSource)

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

@ -342,7 +342,7 @@ status_t AudioOffloadPlayer::SeekTo(int64_t aTimeUs, bool aDispatchSeekEvents)
if (mDispatchSeekEvents) {
nsCOMPtr<nsIRunnable> nsEvent = NS_NewRunnableMethod(mObserver,
&MediaDecoder::SeekingStarted);
NS_DispatchToMainThread(nsEvent, NS_DISPATCH_NORMAL);
NS_DispatchToCurrentThread(nsEvent);
}
if (mPlaying) {
@ -362,7 +362,7 @@ status_t AudioOffloadPlayer::SeekTo(int64_t aTimeUs, bool aDispatchSeekEvents)
AUDIO_OFFLOAD_LOG(PR_LOG_DEBUG, ("Fake seek complete during pause"));
nsCOMPtr<nsIRunnable> nsEvent = NS_NewRunnableMethod(mObserver,
&MediaDecoder::SeekingStopped);
NS_DispatchToMainThread(nsEvent, NS_DISPATCH_NORMAL);
NS_DispatchToCurrentThread(nsEvent);
}
}
@ -415,21 +415,21 @@ void AudioOffloadPlayer::NotifyAudioEOS()
{
nsCOMPtr<nsIRunnable> nsEvent = NS_NewRunnableMethod(mObserver,
&MediaDecoder::PlaybackEnded);
NS_DispatchToMainThread(nsEvent, NS_DISPATCH_NORMAL);
NS_DispatchToMainThread(nsEvent);
}
void AudioOffloadPlayer::NotifyPositionChanged()
{
nsCOMPtr<nsIRunnable> nsEvent = NS_NewRunnableMethod(mObserver,
&MediaOmxDecoder::PlaybackPositionChanged);
NS_DispatchToMainThread(nsEvent, NS_DISPATCH_NORMAL);
NS_DispatchToMainThread(nsEvent);
}
void AudioOffloadPlayer::NotifyAudioTearDown()
{
nsCOMPtr<nsIRunnable> nsEvent = NS_NewRunnableMethod(mObserver,
&MediaOmxDecoder::AudioOffloadTearDown);
NS_DispatchToMainThread(nsEvent, NS_DISPATCH_NORMAL);
NS_DispatchToMainThread(nsEvent);
}
// static
@ -536,7 +536,6 @@ size_t AudioOffloadPlayer::FillBuffer(void* aData, size_t aSize)
}
if (refreshSeekTime) {
if (mDispatchSeekEvents && !mSeekDuringPause) {
mDispatchSeekEvents = false;
AUDIO_OFFLOAD_LOG(PR_LOG_DEBUG, ("FillBuffer posting SEEK_COMPLETE"));

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

@ -322,7 +322,7 @@ ServeResourceEvent::Shutdown()
// To shutdown the current thread we need to first exit this event.
// The Shutdown event below is posted to the main thread to do this.
nsCOMPtr<nsIRunnable> event = new ShutdownThreadEvent(NS_GetCurrentThread());
NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
NS_DispatchToMainThread(event);
}
/*

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

@ -120,12 +120,11 @@ private:
mDecodeJob.OnFailure(aErrorCode);
} else {
// Take extra care to cleanup on the main thread
NS_DispatchToMainThread(NS_NewRunnableMethod(this, &MediaDecodeTask::Cleanup),
NS_DISPATCH_NORMAL);
NS_DispatchToMainThread(NS_NewRunnableMethod(this, &MediaDecodeTask::Cleanup));
nsCOMPtr<nsIRunnable> event =
new ReportResultTask(mDecodeJob, &WebAudioDecodeJob::OnFailure, aErrorCode);
NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
NS_DispatchToMainThread(event);
}
}
@ -438,7 +437,7 @@ MediaBufferDecoder::AsyncDecodeMedia(const char* aContentType, uint8_t* aBuffer,
new ReportResultTask(aDecodeJob,
&WebAudioDecodeJob::OnFailure,
WebAudioDecodeJob::UnknownContent);
NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
NS_DispatchToMainThread(event);
return;
}
@ -447,7 +446,7 @@ MediaBufferDecoder::AsyncDecodeMedia(const char* aContentType, uint8_t* aBuffer,
new ReportResultTask(aDecodeJob,
&WebAudioDecodeJob::OnFailure,
WebAudioDecodeJob::UnknownError);
NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
NS_DispatchToMainThread(event);
return;
}
@ -460,7 +459,7 @@ MediaBufferDecoder::AsyncDecodeMedia(const char* aContentType, uint8_t* aBuffer,
new ReportResultTask(aDecodeJob,
&WebAudioDecodeJob::OnFailure,
WebAudioDecodeJob::UnknownError);
NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
NS_DispatchToMainThread(event);
} else {
mThreadPool->Dispatch(task, nsIThreadPool::DISPATCH_NORMAL);
}

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

@ -158,7 +158,7 @@ void LoadMonitor::Shutdown()
nsRefPtr<LoadMonitorRemoveObserver> remObsRunner = new LoadMonitorRemoveObserver(this);
if (!NS_IsMainThread()) {
NS_DispatchToMainThread(remObsRunner, NS_DISPATCH_NORMAL);
NS_DispatchToMainThread(remObsRunner);
} else {
remObsRunner->Run();
}
@ -600,7 +600,7 @@ LoadMonitor::Init(nsRefPtr<LoadMonitor> &self)
}
nsRefPtr<LoadMonitorAddObserver> addObsRunner = new LoadMonitorAddObserver(self);
NS_DispatchToMainThread(addObsRunner, NS_DISPATCH_NORMAL);
NS_DispatchToMainThread(addObsRunner);
NS_NewNamedThread("Sys Load Info", getter_AddRefs(mLoadInfoThread));

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

@ -97,7 +97,7 @@ ArchiveReaderEvent::RunShare(nsresult aStatus)
mStatus = aStatus;
nsCOMPtr<nsIRunnable> event = NS_NewRunnableMethod(this, &ArchiveReaderEvent::ShareMainThread);
NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
NS_DispatchToMainThread(event);
return NS_OK;
}

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

@ -232,7 +232,7 @@ public:
AutoSyncLoopHolder syncLoop(mWorkerPrivate);
mSyncLoopTarget = syncLoop.EventTarget();
if (NS_FAILED(NS_DispatchToMainThread(this, NS_DISPATCH_NORMAL))) {
if (NS_FAILED(NS_DispatchToMainThread(this))) {
JS_ReportError(cx,
"Failed to dispatch to main thread for the Console API!");
return false;

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

@ -113,7 +113,7 @@ CameraPreviewMediaStream::SetCurrentFrame(const gfxIntSize& aIntrinsicSize, Imag
output->SetCurrentFrame(aIntrinsicSize, aImage, now);
nsCOMPtr<nsIRunnable> event =
NS_NewRunnableMethod(output, &VideoFrameContainer::Invalidate);
NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
NS_DispatchToMainThread(event);
}
if (mFrameCallback) {
@ -131,7 +131,7 @@ CameraPreviewMediaStream::ClearCurrentFrame()
output->ClearCurrentFrame();
nsCOMPtr<nsIRunnable> event =
NS_NewRunnableMethod(output, &VideoFrameContainer::Invalidate);
NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
NS_DispatchToMainThread(event);
}
}

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

@ -1070,7 +1070,7 @@ nsGonkCameraControl::StopRecordingImpl()
}
// notify DeviceStorage that the new video file is closed and ready
return NS_DispatchToMainThread(new RecordingComplete(mVideoFile), NS_DISPATCH_NORMAL);
return NS_DispatchToMainThread(new RecordingComplete(mVideoFile));
}
nsresult

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

@ -98,7 +98,7 @@ FileStreamWrapper::~FileStreamWrapper()
nsCOMPtr<nsIRunnable> runnable =
new DestroyRunnable(mFileHelper);
nsresult rv = NS_DispatchToMainThread(runnable, NS_DISPATCH_NORMAL);
nsresult rv = NS_DispatchToMainThread(runnable);
if (NS_FAILED(rv)) {
NS_WARNING("Failed to dispatch to the main thread!");
}
@ -131,7 +131,7 @@ FileInputStreamWrapper::Close()
if (mFlags & NOTIFY_CLOSE) {
nsCOMPtr<nsIRunnable> runnable = new CloseRunnable(mFileHelper);
if (NS_FAILED(NS_DispatchToMainThread(runnable, NS_DISPATCH_NORMAL))) {
if (NS_FAILED(NS_DispatchToMainThread(runnable))) {
NS_WARNING("Failed to dispatch to the main thread!");
}
}
@ -201,7 +201,7 @@ FileInputStreamWrapper::Read(char* aBuf, uint32_t aCount, uint32_t* _retval)
nsCOMPtr<nsIRunnable> runnable =
new ProgressRunnable(mFileHelper, mOffset, mLimit);
rv = NS_DispatchToMainThread(runnable, NS_DISPATCH_NORMAL);
rv = NS_DispatchToMainThread(runnable);
if (NS_FAILED(rv)) {
NS_WARNING("Failed to dispatch to the main thread!");
}
@ -258,7 +258,7 @@ FileOutputStreamWrapper::Close()
if (mFlags & NOTIFY_CLOSE) {
nsCOMPtr<nsIRunnable> runnable = new CloseRunnable(mFileHelper);
if (NS_FAILED(NS_DispatchToMainThread(runnable, NS_DISPATCH_NORMAL))) {
if (NS_FAILED(NS_DispatchToMainThread(runnable))) {
NS_WARNING("Failed to dispatch to the main thread!");
}
}
@ -318,7 +318,7 @@ FileOutputStreamWrapper::Write(const char* aBuf, uint32_t aCount,
nsCOMPtr<nsIRunnable> runnable =
new ProgressRunnable(mFileHelper, mOffset, mLimit);
NS_DispatchToMainThread(runnable, NS_DISPATCH_NORMAL);
NS_DispatchToMainThread(runnable);
}
return NS_OK;

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

@ -875,7 +875,7 @@ FinishHelper::Run()
mStream = nullptr;
}
return NS_DispatchToMainThread(this, NS_DISPATCH_NORMAL);
return NS_DispatchToMainThread(this);
}
nsresult

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

@ -360,7 +360,7 @@ AsyncConnectionHelper::Run()
"IDBRequest[%llu] DT Done", mRequest->GetSerialNumber(),
mResultCode);
return NS_DispatchToMainThread(this, NS_DISPATCH_NORMAL);
return NS_DispatchToMainThread(this);
}
NS_IMETHODIMP

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

@ -2308,7 +2308,7 @@ OpenDatabaseHelper::Run()
"IDBRequest[%llu] DT Done", mRequest->GetSerialNumber(),
mResultCode);
return NS_DispatchToMainThread(this, NS_DISPATCH_NORMAL);
return NS_DispatchToMainThread(this);
}
nsresult

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

@ -619,8 +619,7 @@ TransactionThreadPool::TransactionQueue::Run()
nsCOMPtr<nsIRunnable> finishTransactionRunnable =
new FinishTransactionRunnable(mTransaction, finishRunnable);
if (NS_FAILED(NS_DispatchToMainThread(finishTransactionRunnable,
NS_DISPATCH_NORMAL))) {
if (NS_FAILED(NS_DispatchToMainThread(finishTransactionRunnable))) {
NS_WARNING("Failed to dispatch finishTransactionRunnable!");
}

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

@ -604,7 +604,7 @@ private:
NS_WARNING("Available failed on this stream!");
}
nsresult rv = NS_DispatchToMainThread(this, NS_DISPATCH_NORMAL);
nsresult rv = NS_DispatchToMainThread(this);
NS_ENSURE_SUCCESS(rv, rv);
return NS_OK;

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

@ -95,7 +95,7 @@ FilePickerParent::FileSizeAndDateRunnable::Run()
}
// Dispatch ourselves back on the main thread.
if (NS_FAILED(NS_DispatchToMainThread(this, NS_DISPATCH_NORMAL))) {
if (NS_FAILED(NS_DispatchToMainThread(this))) {
// It's hard to see how we can recover gracefully in this case. The child
// process is waiting for an IPC, but that can only happen on the main
// thread.

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

@ -168,7 +168,7 @@ private:
mFD = fd;
if (NS_FAILED(NS_DispatchToMainThread(this, NS_DISPATCH_NORMAL))) {
if (NS_FAILED(NS_DispatchToMainThread(this))) {
NS_WARNING("Failed to dispatch to main thread!");
CloseFile();

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

@ -382,7 +382,7 @@ public:
mWindowID, mError.forget());
// event must always be released on mainthread due to the JS callbacks
// in the TracksAvailableCallback
NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
NS_DispatchToMainThread(event);
}
break;
@ -409,7 +409,7 @@ public:
mWindowID);
// event must always be released on mainthread due to the JS callbacks
// in the TracksAvailableCallback
NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
NS_DispatchToMainThread(event);
}
break;

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

@ -367,7 +367,7 @@ PluginHangUIParent::RecvUserResponse(const unsigned int& aResponse)
dontAskCode,
LastShowDurationMs(),
mTimeoutPrefMs);
NS_DispatchToMainThread(workItem, NS_DISPATCH_NORMAL);
NS_DispatchToMainThread(workItem);
return true;
}

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

@ -3551,7 +3551,7 @@ OriginClearRunnable::Run()
}
// Now dispatch back to the main thread.
if (NS_FAILED(NS_DispatchToMainThread(this, NS_DISPATCH_NORMAL))) {
if (NS_FAILED(NS_DispatchToMainThread(this))) {
NS_WARNING("Failed to dispatch to main thread!");
return NS_ERROR_FAILURE;
}
@ -3795,7 +3795,7 @@ AsyncUsageRunnable::Run()
ResetUsage();
}
if (NS_FAILED(NS_DispatchToMainThread(this, NS_DISPATCH_NORMAL))) {
if (NS_FAILED(NS_DispatchToMainThread(this))) {
NS_WARNING("Failed to dispatch to main thread!");
}
}

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

@ -2312,7 +2312,7 @@ nsSMILTimedElement::FireTimeEventAsync(uint32_t aMsg, int32_t aDetail)
nsCOMPtr<nsIRunnable> event =
new AsyncTimeEventRunner(mAnimationElement, aMsg, aDetail);
NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
NS_DispatchToMainThread(event);
}
const nsSMILInstanceTime*

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

@ -636,7 +636,7 @@ public:
mSyncLoopTarget = syncLoop.EventTarget();
MOZ_ASSERT(mSyncLoopTarget);
if (NS_FAILED(NS_DispatchToMainThread(this, NS_DISPATCH_NORMAL))) {
if (NS_FAILED(NS_DispatchToMainThread(this))) {
JS_ReportError(aCx, "Failed to dispatch to main thread!");
return false;
}

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

@ -282,7 +282,7 @@ private:
NS_NewRunnableMethod(this, &ScriptLoaderRunnable::CancelMainThread);
NS_ASSERTION(runnable, "This should never fail!");
if (NS_FAILED(NS_DispatchToMainThread(runnable, NS_DISPATCH_NORMAL))) {
if (NS_FAILED(NS_DispatchToMainThread(runnable))) {
JS_ReportError(aCx, "Failed to cancel script loader!");
return false;
}
@ -815,7 +815,7 @@ LoadAllScripts(JSContext* aCx, WorkerPrivate* aWorkerPrivate,
return false;
}
if (NS_FAILED(NS_DispatchToMainThread(loader, NS_DISPATCH_NORMAL))) {
if (NS_FAILED(NS_DispatchToMainThread(loader))) {
NS_ERROR("Failed to dispatch!");
aWorkerPrivate->RemoveFeature(aCx, loader);
@ -868,7 +868,7 @@ ChannelFromScriptURLWorkerThread(JSContext* aCx,
new ChannelGetterRunnable(aParent, syncLoop.EventTarget(), aScriptURL,
aChannel);
if (NS_FAILED(NS_DispatchToMainThread(getter, NS_DISPATCH_NORMAL))) {
if (NS_FAILED(NS_DispatchToMainThread(getter))) {
NS_ERROR("Failed to dispatch!");
return NS_ERROR_FAILURE;
}

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

@ -772,7 +772,7 @@ private:
nsRefPtr<MainThreadReleaseRunnable> runnable =
new MainThreadReleaseRunnable(doomed, hostObjectURIs);
if (NS_FAILED(NS_DispatchToMainThread(runnable, NS_DISPATCH_NORMAL))) {
if (NS_FAILED(NS_DispatchToMainThread(runnable))) {
NS_WARNING("Failed to dispatch, going to leak!");
}
@ -4294,7 +4294,7 @@ WorkerPrivate::ScheduleDeletion(WorkerRanOrNot aRanOrNot)
else {
nsRefPtr<TopLevelWorkerFinishedRunnable> runnable =
new TopLevelWorkerFinishedRunnable(this);
if (NS_FAILED(NS_DispatchToMainThread(runnable, NS_DISPATCH_NORMAL))) {
if (NS_FAILED(NS_DispatchToMainThread(runnable))) {
NS_WARNING("Failed to dispatch runnable!");
}
}

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

@ -530,7 +530,7 @@ public:
AutoSyncLoopHolder syncLoop(mWorkerPrivate);
mSyncLoopTarget = syncLoop.EventTarget();
if (NS_FAILED(NS_DispatchToMainThread(this, NS_DISPATCH_NORMAL))) {
if (NS_FAILED(NS_DispatchToMainThread(this))) {
JS_ReportError(aCx, "Failed to dispatch to main thread!");
return false;
}

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

@ -106,7 +106,7 @@ void
ScopedGfxFeatureReporter::WriteAppNote(char statusChar)
{
nsCOMPtr<nsIRunnable> r = new AppNoteWritingRunnable(statusChar, mFeature);
NS_DispatchToMainThread(r.get(), NS_DISPATCH_NORMAL);
NS_DispatchToMainThread(r);
}
} // end namespace mozilla

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

@ -78,7 +78,7 @@ AsyncFontInfoLoader::Run()
mFontInfo->Load();
// post a completion event that transfer the data to the fontlist
NS_DispatchToMainThread(mCompleteEvent, NS_DISPATCH_NORMAL);
NS_DispatchToMainThread(mCompleteEvent);
mFontInfo = nullptr;
return NS_OK;

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

@ -206,7 +206,7 @@ GonkDiskSpaceWatcher::DoStop()
// Dispatch the cleanup to the main thread.
nsCOMPtr<nsIRunnable> runnable = new DiskSpaceCleaner();
NS_DispatchToMainThread(runnable, NS_DISPATCH_NORMAL);
NS_DispatchToMainThread(runnable);
}
// We are called off the main thread, so we proxy first to the main thread
@ -219,7 +219,7 @@ GonkDiskSpaceWatcher::NotifyUpdate()
nsCOMPtr<nsIRunnable> runnable =
new DiskSpaceNotifier(mIsDiskFull, mFreeSpace);
NS_DispatchToMainThread(runnable, NS_DISPATCH_NORMAL);
NS_DispatchToMainThread(runnable);
}
void

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

@ -362,7 +362,7 @@ public:
// OK, we've got a new scaled image. Let's get the main thread to unlock and
// redraw it.
nsRefPtr<DrawRunner> runner = new DrawRunner(mScaleRequest.forget());
NS_DispatchToMainThread(runner, NS_DISPATCH_NORMAL);
NS_DispatchToMainThread(runner);
return NS_OK;
}

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

@ -1380,7 +1380,7 @@ ParentImpl::RequestMessageLoopRunnable::Run()
mMessageLoop = MessageLoop::current();
MOZ_ASSERT(mMessageLoop);
if (NS_FAILED(NS_DispatchToMainThread(this, NS_DISPATCH_NORMAL))) {
if (NS_FAILED(NS_DispatchToMainThread(this))) {
NS_WARNING("Failed to dispatch RequestMessageLoopRunnable to main thread!");
return NS_ERROR_FAILURE;
}
@ -1634,7 +1634,7 @@ ChildImpl::GetOrCreateForCurrentThread(
}
nsRefPtr<CreateActorRunnable> runnable = new CreateActorRunnable();
if (NS_FAILED(NS_DispatchToMainThread(runnable, NS_DISPATCH_NORMAL))) {
if (NS_FAILED(NS_DispatchToMainThread(runnable))) {
CRASH_IN_CHILD_PROCESS("Failed to dispatch to main thread!");
return false;
}

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

@ -154,7 +154,7 @@ MessagePump::ScheduleWork()
else {
// Some things (like xpcshell) don't use the app shell and so Run hasn't
// been called. We still need to wake up the main thread.
NS_DispatchToMainThread(mDoWorkEvent, NS_DISPATCH_NORMAL);
NS_DispatchToMainThread(mDoWorkEvent);
}
event_.Signal();
}

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

@ -420,7 +420,7 @@ public:
{
// release conduit on mainthread. Must use forget()!
nsresult rv = NS_DispatchToMainThread(new
ConduitDeleteEvent(conduit_.forget()), NS_DISPATCH_NORMAL);
ConduitDeleteEvent(conduit_.forget()));
MOZ_ASSERT(!NS_FAILED(rv),"Could not dispatch conduit shutdown to main");
if (NS_FAILED(rv)) {
MOZ_CRASH();
@ -577,7 +577,7 @@ class MediaPipelineReceiveAudio : public MediaPipelineReceive {
{
// release conduit on mainthread. Must use forget()!
nsresult rv = NS_DispatchToMainThread(new
ConduitDeleteEvent(conduit_.forget()), NS_DISPATCH_NORMAL);
ConduitDeleteEvent(conduit_.forget()));
MOZ_ASSERT(!NS_FAILED(rv),"Could not dispatch conduit shutdown to main");
if (NS_FAILED(rv)) {
MOZ_CRASH();

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

@ -788,7 +788,7 @@ Seer::EnsureInitStorage()
BeginTransaction();
nsRefPtr<SeerCommitTimerInitEvent> event = new SeerCommitTimerInitEvent();
NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
NS_DispatchToMainThread(event);
return NS_OK;
}

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

@ -145,8 +145,7 @@ void Tickler::MaybeStartTickler()
mLock.AssertCurrentThreadOwns();
if (!NS_IsMainThread()) {
NS_DispatchToMainThread(
NS_NewRunnableMethod(this, &Tickler::MaybeStartTicklerUnlocked),
NS_DISPATCH_NORMAL);
NS_NewRunnableMethod(this, &Tickler::MaybeStartTicklerUnlocked));
return;
}

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

@ -184,7 +184,7 @@ public:
mSetupPACData);
nsRefPtr<PACLoadComplete> runnable = new PACLoadComplete(mPACMan);
NS_DispatchToMainThread(runnable, NS_DISPATCH_NORMAL);
NS_DispatchToMainThread(runnable);
return NS_OK;
}
@ -226,7 +226,7 @@ PendingPACQuery::Complete(nsresult status, const nsCString &pacString)
nsRefPtr<ExecuteCallback> runnable = new ExecuteCallback(mCallback, status);
runnable->SetPACString(pacString);
if (mOnMainThreadOnly)
NS_DispatchToMainThread(runnable, NS_DISPATCH_NORMAL);
NS_DispatchToMainThread(runnable);
else
runnable->Run();
}
@ -240,7 +240,7 @@ PendingPACQuery::UseAlternatePACFile(const nsCString &pacURL)
nsRefPtr<ExecuteCallback> runnable = new ExecuteCallback(mCallback, NS_OK);
runnable->SetPACURL(pacURL);
if (mOnMainThreadOnly)
NS_DispatchToMainThread(runnable, NS_DISPATCH_NORMAL);
NS_DispatchToMainThread(runnable);
else
runnable->Run();
}
@ -272,7 +272,7 @@ nsPACMan::~nsPACMan()
}
else {
nsRefPtr<ShutdownThread> runnable = new ShutdownThread(mPACThread);
NS_DispatchToMainThread(runnable, NS_DISPATCH_NORMAL);
NS_DispatchToMainThread(runnable);
}
}

2
netwerk/cache/nsCacheService.cpp поставляемый
Просмотреть файл

@ -1520,7 +1520,7 @@ NS_IMETHODIMP nsCacheService::EvictEntries(nsCacheStoragePolicy storagePolicy)
if (!NS_IsMainThread()) {
nsCOMPtr<nsIRunnable> event = NS_NewRunnableMethod(this,
&nsCacheService::FireClearNetworkCacheStoredAnywhereNotification);
NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
NS_DispatchToMainThread(event);
} else {
// else you're already on main thread - notify observers
FireClearNetworkCacheStoredAnywhereNotification();

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

@ -1998,10 +1998,10 @@ nsFtpState::StopProcessing()
alertEvent = new nsFtpAsyncAlert(prompter,
NS_ConvertASCIItoUTF16(mResponseMsg));
}
NS_DispatchToMainThread(alertEvent, NS_DISPATCH_NORMAL);
NS_DispatchToMainThread(alertEvent);
}
}
nsresult broadcastErrorCode = mControlStatus;
if (NS_SUCCEEDED(broadcastErrorCode))
broadcastErrorCode = mInternalError;

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

@ -537,8 +537,7 @@ WebSocketChannelChild::SendBinaryStream(nsIInputStream *aStream,
if (!NS_IsMainThread()) {
MOZ_RELEASE_ASSERT(NS_GetCurrentThread() == mTargetThread);
return NS_DispatchToMainThread(new BinaryStreamEvent(this, stream, aLength),
NS_DISPATCH_NORMAL);
return NS_DispatchToMainThread(new BinaryStreamEvent(this, stream, aLength));
}
return SendBinaryStream(stream, aLength);
}

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

@ -523,7 +523,7 @@ public:
aDiscardedResult,
aOperation,
aOSError);
nsresult rv = NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
nsresult rv = NS_DispatchToMainThread(event);
if (NS_FAILED(rv)) {
// Last ditch attempt to release on the main thread - some of
// the members of event are not thread-safe, so letting the
@ -541,7 +541,7 @@ public:
nsRefPtr<SuccessEvent> event = new SuccessEvent(mOnSuccess.forget(),
mOnError.forget(),
aResult);
nsresult rv = NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
nsresult rv = NS_DispatchToMainThread(event);
if (NS_FAILED(rv)) {
// Last ditch attempt to release on the main thread - some of
// the members of event are not thread-safe, so letting the

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

@ -1069,7 +1069,7 @@ public:
nsCOMPtr<nsIRunnable> e =
NS_NewRunnableMethod(this, &nsFetchTelemetryData::MainThread);
NS_ENSURE_STATE(e);
NS_DispatchToMainThread(e, NS_DISPATCH_NORMAL);
NS_DispatchToMainThread(e);
return NS_OK;
}

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

@ -130,7 +130,7 @@ nsMemoryImpl::FlushMemory(const char16_t* aReason, bool aImmediate)
// Don't broadcast more than once every 1000ms to avoid being noisy
if (PR_IntervalToMicroseconds(now - sLastFlushTime) > 1000) {
sFlushEvent.mReason = aReason;
rv = NS_DispatchToMainThread(&sFlushEvent, NS_DISPATCH_NORMAL);
rv = NS_DispatchToMainThread(&sFlushEvent);
}
}