Backed out changeset 554bfe767519 (bug 913847) for leaking on a CLOSED TREE

This commit is contained in:
Wes Kocher 2013-09-18 17:21:02 -07:00
parent d67c764568
commit de3dfc4a8e
41 changed files with 73 additions and 76 deletions

View File

@ -35,7 +35,6 @@
#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,6 +53,7 @@
#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 "nsIRunnable.h"
#include "nsThreadUtils.h"
#include "nsIGlobalObject.h"
#include "nsIScriptObjectPrincipal.h"
#include "nsWeakReference.h"

View File

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

View File

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

View File

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

View File

@ -15,7 +15,6 @@
#include "FileRequest.h"
#include "FileService.h"
#include "nsIRequest.h"
#include "nsThreadUtils.h"
USING_FILE_NAMESPACE
@ -210,17 +209,3 @@ 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,6 +10,7 @@
#include "FileCommon.h"
#include "nsIRequestObserver.h"
#include "nsThreadUtils.h"
class nsIFileStorage;
@ -57,10 +58,18 @@ public:
OnStreamProgress(uint64_t aProgress, uint64_t aProgressMax);
void
OnStreamClose();
OnStreamClose()
{
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
Finish();
}
void
OnStreamDestroy();
OnStreamDestroy()
{
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
Finish();
}
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,6 +9,8 @@
#include "IndexedDatabase.h"
#include "nsThreadUtils.h"
#include "FileManager.h"
#include "IndexedDatabaseManager.h"

View File

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

View File

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

View File

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

View File

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

View File

@ -25,6 +25,7 @@
#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;
@ -816,6 +817,7 @@ 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,6 +16,8 @@
#include "nsITimer.h"
#include "nsCOMPtr.h"
#include "nsIRunnable.h"
#include "nsThreadUtils.h"
#include "nsComponentManagerUtils.h"
#include "nsTArray.h"
#include "nsAutoPtr.h"

View File

@ -18,7 +18,6 @@
#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,7 +8,6 @@
#include "logging.h"
#include "transportflow.h"
#include "transportlayer.h"
#include "nsThreadUtils.h"
// Logging context
namespace mozilla {
@ -47,19 +46,4 @@ 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,6 +15,7 @@
#include "mozilla/RefPtr.h"
#include "nsCOMPtr.h"
#include "nsIEventTarget.h"
#include "nsThreadUtils.h"
#include "m_cpp_utils.h"
@ -61,7 +62,20 @@ 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);
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();
}
// Get the state
State state() const { return state_; }

View File

@ -2,7 +2,6 @@
* 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 "nsIRunnable.h"
#include "nsThreadUtils.h"
#define NS_ANDROIDHISTORY_CID \
{0xCCAA4880, 0x44DD, 0x40A7, {0xA1, 0x3F, 0x61, 0x56, 0xFC, 0x88, 0x2C, 0x0B}}

View File

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

View File

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

View File

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

View File

@ -32,6 +32,7 @@
#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,7 +24,6 @@
#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 "nsIRunnable.h"
#include "nsThreadUtils.h"
#include "nsEventQueue.h"
#include "nsCOMPtr.h"
#include "pldhash.h"

View File

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

View File

@ -7,7 +7,6 @@
#include "nsISupports.h"
#include "mozilla/net/ChannelEventQueue.h"
#include "nsThreadUtils.h"
namespace mozilla {
namespace net {
@ -42,21 +41,6 @@ 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,6 +10,7 @@
#include <nsTArray.h>
#include <nsAutoPtr.h>
#include <nsThreadUtils.h>
class nsISupports;
@ -69,7 +70,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.
void Resume();
inline void Resume();
private:
inline void MaybeFlushQueue();
@ -139,6 +140,22 @@ 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,6 +11,7 @@
#include "nsHttpTransaction.h"
#include "nsInputStreamPump.h"
#include "nsThreadUtils.h"
#include "nsTArray.h"
#include "nsIHttpEventSink.h"

View File

@ -12,6 +12,7 @@
#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,6 +21,7 @@
#include "nsCategoryCache.h"
#include "nsNetCID.h"
#include "nsToolkitCompsCID.h"
#include "nsThreadUtils.h"
#include "nsURIHashKey.h"
#include "nsTHashtable.h"

View File

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

View File

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

View File

@ -27,7 +27,6 @@
#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 "nsIRunnable.h"
#include "nsThreadUtils.h"
#include "nsICryptoHash.h"
#ifdef MOZ_PLACES
#include "nsIFaviconService.h"
@ -30,7 +30,6 @@ class nsWindow;
class nsWindowBase;
struct KeyPair;
struct nsIntRect;
class nsIThread;
namespace mozilla {
namespace widget {

View File

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

View File

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