Bug 913847 - stop needlessly including nsThreadUtils.h - r=ehsan

This commit is contained in:
Benoit Jacob 2013-09-19 09:54:39 -04:00
parent 31eb1565d0
commit ef57b5655b
41 changed files with 76 additions and 73 deletions

View File

@ -35,6 +35,7 @@
#include "mozilla/CheckedInt.h"
#include "mozilla/Preferences.h"
#include "mozilla/Attributes.h"
#include "nsThreadUtils.h"
#include "mozilla/dom/FileListBinding.h"
using namespace mozilla;

View File

@ -53,7 +53,6 @@
#include "pldhash.h"
#include "nsAttrAndChildArray.h"
#include "nsDOMAttributeMap.h"
#include "nsThreadUtils.h"
#include "nsIContentViewer.h"
#include "nsIDOMXPathNSResolver.h"
#include "nsIInterfaceRequestor.h"

View File

@ -18,7 +18,7 @@
#include "nsIDocShell.h"
#include "nsIDOMElement.h"
#include "nsCOMArray.h"
#include "nsThreadUtils.h"
#include "nsIRunnable.h"
#include "nsIGlobalObject.h"
#include "nsIScriptObjectPrincipal.h"
#include "nsWeakReference.h"

View File

@ -11,7 +11,6 @@
#include "MediaDecoderOwner.h"
#include "nsIChannel.h"
#include "nsIHttpChannel.h"
#include "nsThreadUtils.h"
#include "nsIDOMRange.h"
#include "nsCycleCollectionParticipant.h"
#include "nsILoadGroup.h"
@ -45,6 +44,7 @@ class MediaDecoder;
class nsITimer;
class nsRange;
class nsIRunnable;
namespace mozilla {
namespace dom {

View File

@ -18,7 +18,6 @@
#include "nsTArray.h"
#include "nsIURI.h"
#include "nsITimer.h"
#include "nsThreadUtils.h"
#include "MediaDecoder.h"
#include "DASHReader.h"

View File

@ -19,7 +19,6 @@
#define NAN std::numeric_limits<double>::quiet_NaN()
#endif
#include "nsThreadUtils.h"
#include "nsIDOMCameraManager.h"
#include "prlog.h"

View File

@ -15,6 +15,7 @@
#include "FileRequest.h"
#include "FileService.h"
#include "nsIRequest.h"
#include "nsThreadUtils.h"
USING_FILE_NAMESPACE
@ -209,3 +210,17 @@ FileHelper::Finish()
mRequest), "Subclass didn't call FileHelper::ReleaseObjects!");
}
void
FileHelper::OnStreamClose()
{
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
Finish();
}
void
FileHelper::OnStreamDestroy()
{
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
Finish();
}

View File

@ -10,7 +10,6 @@
#include "FileCommon.h"
#include "nsIRequestObserver.h"
#include "nsThreadUtils.h"
class nsIFileStorage;
@ -58,18 +57,10 @@ public:
OnStreamProgress(uint64_t aProgress, uint64_t aProgressMax);
void
OnStreamClose()
{
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
Finish();
}
OnStreamClose();
void
OnStreamDestroy()
{
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
Finish();
}
OnStreamDestroy();
static LockedFile*
GetCurrentLockedFile();

View File

@ -5,7 +5,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "FileInfo.h"
#include "nsThreadUtils.h"
#include "mozilla/dom/quota/QuotaManager.h"
USING_INDEXEDDB_NAMESPACE

View File

@ -9,8 +9,6 @@
#include "IndexedDatabase.h"
#include "nsThreadUtils.h"
#include "FileManager.h"
#include "IndexedDatabaseManager.h"

View File

@ -18,6 +18,7 @@
#include "nsIWindowMediator.h"
#include "nsIWinTaskbar.h"
#include "nsServiceManagerUtils.h"
#include "nsThreadUtils.h"
#include "WidgetUtils.h"

View File

@ -20,7 +20,6 @@
#include "nsAutoPtr.h"
#include "nsStringGlue.h"
#include "nsTArray.h"
#include "nsThreadUtils.h"
#include "prlog.h"
#include "nsHashKeys.h"
#ifdef MOZ_CRASHREPORTER

View File

@ -17,7 +17,6 @@
#include "nsClassHashtable.h"
#include "nsRefPtrHashtable.h"
#include "nsThreadUtils.h"
#include "ArrayCluster.h"
#include "Client.h"
@ -33,6 +32,7 @@ class nsIThread;
class nsITimer;
class nsIURI;
class nsPIDOMWindow;
class nsIRunnable;
BEGIN_QUOTA_NAMESPACE

View File

@ -15,7 +15,6 @@
#include "nsCycleCollectionParticipant.h"
#include "nsIDOMWindow.h"
#include "nsIScriptObjectPrincipal.h"
#include "nsThreadUtils.h"
#include "nsDOMEventTargetHelper.h"
#include "nsIDOMEvent.h"

View File

@ -25,7 +25,6 @@
#include "nsRect.h" // for nsIntRect
#include "nsSize.h" // for nsIntSize
#include "nsTArray.h" // for nsTArray
#include "nsThreadUtils.h" // for NS_IsMainThread
#include "mozilla/Atomics.h"
class nsMainThreadSurfaceRef;
@ -817,7 +816,6 @@ public:
virtual already_AddRefed<gfxASurface> GetAsSurface()
{
NS_ASSERTION(NS_IsMainThread(), "Must be main thread");
nsRefPtr<gfxASurface> surface = mSurface.get();
return surface.forget();
}

View File

@ -16,8 +16,6 @@
#include "nsITimer.h"
#include "nsCOMPtr.h"
#include "nsIRunnable.h"
#include "nsThreadUtils.h"
#include "nsComponentManagerUtils.h"
#include "nsTArray.h"
#include "nsAutoPtr.h"

View File

@ -18,6 +18,7 @@
#include "mozilla/Scoped.h"
#include "transportlayer.h"
#include "m_cpp_utils.h"
#include "nsAutoPtr.h"
// A stack of transport layers acts as a flow.
// Generally, one reads and writes to the top layer.

View File

@ -8,6 +8,7 @@
#include "logging.h"
#include "transportflow.h"
#include "transportlayer.h"
#include "nsThreadUtils.h"
// Logging context
namespace mozilla {
@ -46,4 +47,19 @@ void TransportLayer::SetState(State state) {
}
}
nsresult TransportLayer::RunOnThread(nsIRunnable *event) {
if (target_) {
nsIThread *thr;
DebugOnly<nsresult> rv = NS_GetCurrentThread(&thr);
MOZ_ASSERT(NS_SUCCEEDED(rv));
if (target_ != thr) {
return target_->Dispatch(event, NS_DISPATCH_SYNC);
}
}
return event->Run();
}
} // close namespace

View File

@ -15,7 +15,6 @@
#include "mozilla/RefPtr.h"
#include "nsCOMPtr.h"
#include "nsIEventTarget.h"
#include "nsThreadUtils.h"
#include "m_cpp_utils.h"
@ -62,20 +61,7 @@ class TransportLayer : public sigslot::has_slots<> {
// Dispatch a call onto our thread (or run on the same thread if
// thread is not set). This is always synchronous.
nsresult RunOnThread(nsIRunnable *event) {
if (target_) {
nsIThread *thr;
DebugOnly<nsresult> rv = NS_GetCurrentThread(&thr);
MOZ_ASSERT(NS_SUCCEEDED(rv));
if (target_ != thr) {
return target_->Dispatch(event, NS_DISPATCH_SYNC);
}
}
return event->Run();
}
nsresult RunOnThread(nsIRunnable *event);
// Get the state
State state() const { return state_; }

View File

@ -2,6 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsThreadUtils.h"
#include "nsAndroidHistory.h"
#include "AndroidBridge.h"
#include "Link.h"

View File

@ -9,7 +9,7 @@
#include "IHistory.h"
#include "nsDataHashtable.h"
#include "nsTPriorityQueue.h"
#include "nsThreadUtils.h"
#include "nsIRunnable.h"
#define NS_ANDROIDHISTORY_CID \
{0xCCAA4880, 0x44DD, 0x40A7, {0xA1, 0x3F, 0x61, 0x56, 0xFC, 0x88, 0x2C, 0x0B}}

View File

@ -10,6 +10,7 @@
#include "nsIDNSService.h"
#include "nsIThread.h"
#include "nsSocketTransport2.h"
#include "nsThreadUtils.h"
using mozilla::AutoSafeJSContext;
namespace mozilla {

View File

@ -8,6 +8,7 @@
#include "nsNetUtil.h"
#include "nsSocketTransportService2.h"
#include "nsThreadUtils.h"
#ifdef XP_WIN
#include <windows.h>

View File

@ -9,6 +9,7 @@
#include "nsServiceManagerUtils.h"
#include "prnetdb.h"
#include "Tickler.h"
#include "nsThreadUtils.h"
#ifdef MOZ_USE_WIFI_TICKLER

View File

@ -32,7 +32,6 @@
#include "nsAutoPtr.h"
#include "nsISupports.h"
#include "nsIThread.h"
#include "nsThreadUtils.h"
#include "nsITimer.h"
#include "nsWeakReference.h"

View File

@ -26,7 +26,7 @@
#include "prerr.h"
#include "NetworkActivityMonitor.h"
#include "mozilla/VisualEventTracer.h"
#include "nsThreadUtils.h"
#include "nsIServiceManager.h"
#include "nsISocketProviderService.h"
#include "nsISocketProvider.h"

View File

@ -24,6 +24,7 @@
#include "mozilla/Preferences.h"
#include "mozilla/Likely.h"
#include "mozilla/PublicSSL.h"
#include "nsThreadUtils.h"
using namespace mozilla;
using namespace mozilla::net;

View File

@ -8,7 +8,7 @@
#include "nsPISocketTransportService.h"
#include "nsIThreadInternal.h"
#include "nsThreadUtils.h"
#include "nsIRunnable.h"
#include "nsEventQueue.h"
#include "nsCOMPtr.h"
#include "pldhash.h"

View File

@ -10,6 +10,7 @@
#include "nsSocketTransportService2.h"
#include "mozilla/Mutex.h"
#include "nsIOutputStream.h"
#include "nsAutoPtr.h"
//-----------------------------------------------------------------------------

View File

@ -7,6 +7,7 @@
#include "nsISupports.h"
#include "mozilla/net/ChannelEventQueue.h"
#include "nsThreadUtils.h"
namespace mozilla {
namespace net {
@ -41,6 +42,21 @@ ChannelEventQueue::FlushQueue()
mFlushing = false;
}
void
ChannelEventQueue::Resume()
{
// Resuming w/o suspend: error in debug mode, ignore in build
MOZ_ASSERT(mSuspendCount > 0);
if (mSuspendCount <= 0) {
return;
}
if (!--mSuspendCount) {
nsRefPtr<nsRunnableMethod<ChannelEventQueue> > event =
NS_NewRunnableMethod(this, &ChannelEventQueue::CompleteResume);
NS_DispatchToCurrentThread(event);
}
}
}
}

View File

@ -10,7 +10,6 @@
#include <nsTArray.h>
#include <nsAutoPtr.h>
#include <nsThreadUtils.h>
class nsISupports;
@ -70,7 +69,7 @@ class ChannelEventQueue
inline void Suspend();
// Resume flushes the queue asynchronously, i.e. items in queue will be
// dispatched in a new event on the current thread.
inline void Resume();
void Resume();
private:
inline void MaybeFlushQueue();
@ -140,22 +139,6 @@ ChannelEventQueue::CompleteResume()
}
}
inline void
ChannelEventQueue::Resume()
{
// Resuming w/o suspend: error in debug mode, ignore in build
MOZ_ASSERT(mSuspendCount > 0);
if (mSuspendCount <= 0) {
return;
}
if (!--mSuspendCount) {
nsRefPtr<nsRunnableMethod<ChannelEventQueue> > event =
NS_NewRunnableMethod(this, &ChannelEventQueue::CompleteResume);
NS_DispatchToCurrentThread(event);
}
}
inline void
ChannelEventQueue::MaybeFlushQueue()
{

View File

@ -11,7 +11,6 @@
#include "nsHttpTransaction.h"
#include "nsInputStreamPump.h"
#include "nsThreadUtils.h"
#include "nsTArray.h"
#include "nsIHttpEventSink.h"

View File

@ -12,7 +12,6 @@
#include "nsIURL.h"
#include "nsParserCIID.h"
#include "nsITokenizer.h"
#include "nsThreadUtils.h"
#include "nsIContentSink.h"
#include "nsIRequest.h"
#include "nsIChannel.h"

View File

@ -10,10 +10,10 @@
#include "nscore.h"
#include "nsTArray.h"
#include "nsAutoPtr.h"
#include "nsThreadUtils.h"
#include "mozilla/Mutex.h"
#include "mozilla/TimeStamp.h"
#include "mozilla/Attributes.h"
#include "nsIRunnable.h"
#include "SQLiteMutex.h"
#include "mozIStoragePendingStatement.h"

View File

@ -21,7 +21,6 @@
#include "nsCategoryCache.h"
#include "nsNetCID.h"
#include "nsToolkitCompsCID.h"
#include "nsThreadUtils.h"
#include "nsURIHashKey.h"
#include "nsTHashtable.h"

View File

@ -13,9 +13,6 @@
#include "nsCOMPtr.h"
#include "nsCOMArray.h"
#include "nsIRunnable.h"
#include "nsIObserver.h"
#include "nsThreadUtils.h"
#include "AndroidJavaWrappers.h"
@ -38,6 +35,7 @@
class nsWindow;
class nsIDOMMozSmsMessage;
class nsIObserver;
/* See the comment in AndroidBridge about this function before using it */
extern "C" JNIEnv * GetJNIForThread();

View File

@ -20,7 +20,6 @@
#include "nsIJumpListItem.h"
#include "JumpListItem.h"
#include "nsIObserver.h"
#include "nsThreadUtils.h"
#include "mozilla/Attributes.h"
namespace mozilla {

View File

@ -27,6 +27,7 @@
#include "nsIChannel.h"
#include "nsIObserver.h"
#include "imgIEncoder.h"
#include "nsIThread.h"
#ifdef NS_ENABLE_TSF
#include <textstor.h>

View File

@ -15,7 +15,7 @@
#include "nsString.h"
#include "nsRegion.h"
#include "nsThreadUtils.h"
#include "nsIRunnable.h"
#include "nsICryptoHash.h"
#ifdef MOZ_PLACES
#include "nsIFaviconService.h"
@ -30,6 +30,7 @@ class nsWindow;
class nsWindowBase;
struct KeyPair;
struct nsIntRect;
class nsIThread;
namespace mozilla {
namespace widget {

View File

@ -24,6 +24,7 @@
#include "prmem.h"
#include "nsNativeCharsetUtils.h"
#include "nsThreadUtils.h"
#ifdef PR_LOGGING
PRLogModuleInfo* gWin32SoundLog = nullptr;

View File

@ -9,7 +9,9 @@
#include "nsISound.h"
#include "nsIStreamLoader.h"
#include "nsThreadUtils.h"
#include "nsCOMPtr.h"
class nsIThread;
class nsSound : public nsISound,
public nsIStreamLoaderObserver