diff --git a/browser/base/content/browser-places.js b/browser/base/content/browser-places.js index 467b30cf5103..482b23f59160 100644 --- a/browser/base/content/browser-places.js +++ b/browser/base/content/browser-places.js @@ -546,8 +546,6 @@ var PlacesMenuDNDController = { var timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer); timer.initWithCallback(new Callback(this, callback, args), delay, timer.TYPE_ONE_SHOT); - timer.QueryInterface(Ci.nsITimerInternal); - timer.idle = false; this._timers[id] = timer; }, diff --git a/browser/components/places/content/menu.xml b/browser/components/places/content/menu.xml index 8bd208c4b9aa..c6e0cf9ada3d 100755 --- a/browser/components/places/content/menu.xml +++ b/browser/components/places/content/menu.xml @@ -466,13 +466,8 @@ _closeMenuTimer: null, _setTimer: function TBV_DO_setTimer(time) { - // There is a problem in Windows where timers don't fire while the - // mouse is dragging. QI-ing the timer to nsITimerInternal and setting - // idle to false makes the timer fire. var timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer); timer.initWithCallback(this, time, timer.TYPE_ONE_SHOT); - timer.QueryInterface(Ci.nsITimerInternal); - timer.idle = false; return timer; }, diff --git a/browser/components/places/content/toolbar.xml b/browser/components/places/content/toolbar.xml index 3f2fec8d0f7f..6dbecf3f48d2 100755 --- a/browser/components/places/content/toolbar.xml +++ b/browser/components/places/content/toolbar.xml @@ -529,13 +529,8 @@ _ibTimer: null, _setTimer: function TBV_DO_setTimer(time) { - // There is a problem in Windows where timers don't fire while the - // mouse is dragging. QI-ing the timer to nsITimerInternal and setting - // idle to false makes the timer fire. var timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer); timer.initWithCallback(this, time, timer.TYPE_ONE_SHOT); - timer.QueryInterface(Ci.nsITimerInternal); - timer.idle = false; return timer; }, diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index 1fe07dd3192d..a4fe79560aeb 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -178,7 +178,6 @@ #include "nsIDOMHTMLAreaElement.h" #include "nsIDOMHTMLLinkElement.h" #include "nsITimer.h" -#include "nsITimerInternal.h" #ifdef ACCESSIBILITY #include "nsIAccessibilityService.h" #include "nsIAccessible.h" @@ -2970,9 +2969,6 @@ PresShell::InitialReflow(nscoord aWidth, nscoord aHeight) nsContentUtils::GetIntPref("nglayout.initialpaint.delay", PAINTLOCK_EVENT_DELAY); - nsCOMPtr ti = do_QueryInterface(mPaintSuppressionTimer); - ti->SetIdle(PR_FALSE); - mPaintSuppressionTimer->InitWithFuncCallback(sPaintSuppressionCallback, this, delay, nsITimer::TYPE_ONE_SHOT); diff --git a/layout/xul/base/src/nsMenuFrame.cpp b/layout/xul/base/src/nsMenuFrame.cpp index 1587971cfd49..59ee0892b118 100644 --- a/layout/xul/base/src/nsMenuFrame.cpp +++ b/layout/xul/base/src/nsMenuFrame.cpp @@ -81,7 +81,6 @@ #include "nsIStringBundle.h" #include "nsGUIEvent.h" #include "nsIEventStateManager.h" -#include "nsITimerInternal.h" #include "nsContentUtils.h" #include "nsDisplayList.h" @@ -511,10 +510,6 @@ nsMenuFrame::HandleEvent(nsPresContext* aPresContext, // We're a menu, we're built, we're closed, and no timer has been kicked off. mOpenTimer = do_CreateInstance("@mozilla.org/timer;1"); - - nsCOMPtr ti = do_QueryInterface(mOpenTimer); - ti->SetIdle(PR_FALSE); - mOpenTimer->InitWithCallback(mTimerMediator, menuDelay, nsITimer::TYPE_ONE_SHOT); } diff --git a/layout/xul/base/src/nsMenuPopupFrame.cpp b/layout/xul/base/src/nsMenuPopupFrame.cpp index d9efcd6854f2..ae13a601e3bc 100644 --- a/layout/xul/base/src/nsMenuPopupFrame.cpp +++ b/layout/xul/base/src/nsMenuPopupFrame.cpp @@ -71,7 +71,6 @@ #include "nsGUIEvent.h" #include "nsIRootBox.h" #include "nsIDocShellTreeItem.h" -#include "nsITimerInternal.h" #include "nsReadableUtils.h" #include "nsUnicharUtils.h" #include "nsCSSFrameConstructor.h" @@ -1404,8 +1403,6 @@ NS_IMETHODIMP nsMenuPopupFrame::SetCurrentMenuItem(nsIMenuFrame* aMenuItem) // Kick off the timer. mCloseTimer = do_CreateInstance("@mozilla.org/timer;1"); - nsCOMPtr ti = do_QueryInterface(mCloseTimer); - ti->SetIdle(PR_FALSE); mCloseTimer->InitWithCallback(mTimerMediator, menuDelay, nsITimer::TYPE_ONE_SHOT); mTimerMenu = mCurrentMenu; } diff --git a/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp b/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp index d6a76124fcb6..f90dfb7b1091 100644 --- a/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp +++ b/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp @@ -91,7 +91,6 @@ #include "nsIScrollableView.h" #include "nsITheme.h" #include "nsITimelineService.h" -#include "nsITimerInternal.h" #include "imgIRequest.h" #include "imgIContainer.h" #include "imgIContainerObserver.h" @@ -1693,13 +1692,8 @@ nsTreeBodyFrame::CreateTimer(const nsILookAndFeel::nsMetricID aID, // Zero value means that this feature is completely disabled. if (delay > 0) { timer = do_CreateInstance("@mozilla.org/timer;1"); - if (timer) { - nsCOMPtr timerInternal = do_QueryInterface(timer); - if (timerInternal) { - timerInternal->SetIdle(PR_FALSE); - } + if (timer) timer->InitWithFuncCallback(aFunc, this, delay, aType); - } } NS_IF_ADDREF(*aTimer = timer); diff --git a/xpcom/build/nsXPComInit.cpp b/xpcom/build/nsXPComInit.cpp index 19d20f0adc6d..3a0d8e253035 100644 --- a/xpcom/build/nsXPComInit.cpp +++ b/xpcom/build/nsXPComInit.cpp @@ -202,7 +202,6 @@ NS_DECL_CLASSINFO(nsConsoleService) NS_GENERIC_FACTORY_CONSTRUCTOR(nsAtomService) NS_GENERIC_FACTORY_CONSTRUCTOR(nsExceptionService) NS_GENERIC_FACTORY_CONSTRUCTOR(nsTimerImpl) -NS_GENERIC_FACTORY_CONSTRUCTOR(nsTimerManager) NS_GENERIC_FACTORY_CONSTRUCTOR(nsBinaryOutputStream) NS_GENERIC_FACTORY_CONSTRUCTOR(nsBinaryInputStream) NS_GENERIC_FACTORY_CONSTRUCTOR(nsStorageStream) @@ -378,7 +377,6 @@ static const nsModuleComponentInfo components[] = { COMPONENT(XPCOMPROXY, nsProxyObjectManager::Create), COMPONENT(TIMER, nsTimerImplConstructor), - COMPONENT(TIMERMANAGER, nsTimerManagerConstructor), #define COMPONENT_SUPPORTS(TYPE, Type) \ COMPONENT(SUPPORTS_##TYPE, nsSupports##Type##ImplConstructor) diff --git a/xpcom/threads/Makefile.in b/xpcom/threads/Makefile.in index f6d0018d9480..e63462340c2a 100644 --- a/xpcom/threads/Makefile.in +++ b/xpcom/threads/Makefile.in @@ -80,8 +80,6 @@ XPIDLSRCS = \ nsIThreadManager.idl \ nsIThreadPool.idl \ nsITimer.idl \ - nsITimerInternal.idl \ - nsITimerManager.idl \ nsIRunnable.idl \ nsIEnvironment.idl \ nsIProcess.idl \ diff --git a/xpcom/threads/nsITimerInternal.idl b/xpcom/threads/nsITimerInternal.idl deleted file mode 100644 index c334ae19d318..000000000000 --- a/xpcom/threads/nsITimerInternal.idl +++ /dev/null @@ -1,48 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2002 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * Alternatively, the contents of this file may be used under the terms of - * either of the GNU General Public License Version 2 or later (the "GPL"), - * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#include "nsISupports.idl" - - -[scriptable, uuid(6dd8f185-ceb8-4878-8e38-2d13edc2d079)] -interface nsITimerInternal : nsISupports -{ - attribute boolean idle; -}; - diff --git a/xpcom/threads/nsITimerManager.idl b/xpcom/threads/nsITimerManager.idl deleted file mode 100644 index f391d31373dd..000000000000 --- a/xpcom/threads/nsITimerManager.idl +++ /dev/null @@ -1,61 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2002 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * Stuart Parmenter - * - * Alternatively, the contents of this file may be used under the terms of - * either of the GNU General Public License Version 2 or later (the "GPL"), - * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#include "nsISupports.idl" - -[scriptable, uuid(8fce8c6a-1dd2-11b2-8352-8cdd2b965efc)] -interface nsITimerManager : nsISupports -{ - /** - * A flag that turns on the use of idle timers on the main thread. - * this should only be called once. - * - * By default, idle timers are off. - * - * One this is set to TRUE, you are expected to call hasIdleTimers/fireNextIdleTimer - * when you have time in your main loop. - */ - attribute boolean useIdleTimers; - - boolean hasIdleTimers(); - - // Fire next idle timers waiting on the current thread - void fireNextIdleTimer(); -}; diff --git a/xpcom/threads/nsTimerImpl.cpp b/xpcom/threads/nsTimerImpl.cpp index 4dc48c973eaa..2cf0b29e0f79 100644 --- a/xpcom/threads/nsTimerImpl.cpp +++ b/xpcom/threads/nsTimerImpl.cpp @@ -49,8 +49,6 @@ static PRInt32 gGenerator = 0; static TimerThread* gThread = nsnull; -static PRBool gFireOnIdle = PR_FALSE; -static nsTimerManager* gManager = nsnull; #ifdef DEBUG_TIMERS #include @@ -79,7 +77,7 @@ myNS_MeanAndStdDev(double n, double sumOfValues, double sumOfSquaredValues, } #endif -NS_IMPL_THREADSAFE_QUERY_INTERFACE2(nsTimerImpl, nsITimer, nsITimerInternal) +NS_IMPL_THREADSAFE_QUERY_INTERFACE1(nsTimerImpl, nsITimer) NS_IMPL_THREADSAFE_ADDREF(nsTimerImpl) NS_IMETHODIMP_(nsrefcnt) nsTimerImpl::Release(void) @@ -140,7 +138,6 @@ NS_IMETHODIMP_(nsrefcnt) nsTimerImpl::Release(void) nsTimerImpl::nsTimerImpl() : mClosure(nsnull), mCallbackType(CALLBACK_TYPE_UNKNOWN), - mIdle(PR_TRUE), mFiring(PR_FALSE), mArmed(PR_FALSE), mCanceled(PR_FALSE), @@ -200,8 +197,6 @@ void nsTimerImpl::Shutdown() gThread->Shutdown(); NS_RELEASE(gThread); - - gFireOnIdle = PR_FALSE; } @@ -347,18 +342,6 @@ NS_IMETHODIMP nsTimerImpl::GetCallback(nsITimerCallback **aCallback) } -NS_IMETHODIMP nsTimerImpl::GetIdle(PRBool *aIdle) -{ - *aIdle = mIdle; - return NS_OK; -} - -NS_IMETHODIMP nsTimerImpl::SetIdle(PRBool aIdle) -{ - mIdle = aIdle; - return NS_OK; -} - void nsTimerImpl::Fire() { if (mCanceled) @@ -470,17 +453,6 @@ NS_IMETHODIMP nsTimerEvent::Run() } #endif - if (gFireOnIdle) { - PRBool idle = PR_FALSE; - timer->GetIdle(&idle); - if (idle) { - NS_ASSERTION(gManager, "Global Thread Manager is null!"); - if (gManager) - gManager->AddIdleTimer(timer); - return NS_OK; - } - } - timer->Fire(); return NS_OK; @@ -542,93 +514,6 @@ void nsTimerImpl::SetDelayInternal(PRUint32 aDelay) #endif } -/** - * Timer Manager code - */ - -NS_IMPL_THREADSAFE_ISUPPORTS1(nsTimerManager, nsITimerManager) - -nsTimerManager::nsTimerManager() -{ - mLock = PR_NewLock(); - gManager = this; -} - -nsTimerManager::~nsTimerManager() -{ - gManager = nsnull; - PR_DestroyLock(mLock); - - nsTimerImpl *theTimer; - PRInt32 count = mIdleTimers.Count(); - - for (PRInt32 i = 0; i < count; i++) { - theTimer = NS_STATIC_CAST(nsTimerImpl*, mIdleTimers[i]); - NS_IF_RELEASE(theTimer); - } -} - -NS_IMETHODIMP nsTimerManager::SetUseIdleTimers(PRBool aUseIdleTimers) -{ - if (aUseIdleTimers == PR_FALSE && gFireOnIdle == PR_TRUE) - return NS_ERROR_FAILURE; - - gFireOnIdle = aUseIdleTimers; - - return NS_OK; -} - -NS_IMETHODIMP nsTimerManager::GetUseIdleTimers(PRBool *aUseIdleTimers) -{ - *aUseIdleTimers = gFireOnIdle; - return NS_OK; -} - -NS_IMETHODIMP nsTimerManager::HasIdleTimers(PRBool *aHasTimers) -{ - nsAutoLock lock (mLock); - PRUint32 count = mIdleTimers.Count(); - *aHasTimers = (count != 0); - return NS_OK; -} - -nsresult nsTimerManager::AddIdleTimer(nsITimer* timer) -{ - if (!timer) - return NS_ERROR_FAILURE; - nsAutoLock lock(mLock); - mIdleTimers.AppendElement(timer); - NS_ADDREF(timer); - return NS_OK; -} - -NS_IMETHODIMP nsTimerManager::FireNextIdleTimer() -{ - if (!gFireOnIdle || !NS_IsMainThread()) { - return NS_OK; - } - - nsTimerImpl *theTimer = nsnull; - - { - nsAutoLock lock (mLock); - PRUint32 count = mIdleTimers.Count(); - - if (count == 0) - return NS_OK; - - theTimer = NS_STATIC_CAST(nsTimerImpl*, mIdleTimers[0]); - mIdleTimers.RemoveElement(theTimer); - } - - theTimer->Fire(); - - NS_RELEASE(theTimer); - - return NS_OK; -} - - // NOT FOR PUBLIC CONSUMPTION! nsresult NS_NewTimer(nsITimer* *aResult, nsTimerCallbackFunc aCallback, void *aClosure, diff --git a/xpcom/threads/nsTimerImpl.h b/xpcom/threads/nsTimerImpl.h index 731de2c4d80f..5dcba79ec7a0 100644 --- a/xpcom/threads/nsTimerImpl.h +++ b/xpcom/threads/nsTimerImpl.h @@ -46,7 +46,6 @@ #include "nsITimer.h" #include "nsVoidArray.h" #include "nsIThread.h" -#include "nsITimerInternal.h" #include "nsIObserver.h" #include "nsCOMPtr.h" @@ -85,7 +84,7 @@ enum { // Is interval-time t less than u, even if t has wrapped PRIntervalTime? #define TIMER_LESS_THAN(t, u) ((t) - (u) > DELAY_INTERVAL_LIMIT) -class nsTimerImpl : public nsITimer, public nsITimerInternal +class nsTimerImpl : public nsITimer { public: @@ -102,7 +101,6 @@ public: NS_DECL_ISUPPORTS NS_DECL_NSITIMER - NS_DECL_NSITIMERINTERNAL PRInt32 GetGeneration() { return mGeneration; } @@ -130,7 +128,6 @@ private: // These members are set by Init (called from NS_NewTimer) and never reset. PRUint8 mCallbackType; - PRPackedBool mIdle; // These members are set by the initiating thread, when the timer's type is // changed and during the period where it fires on that thread. @@ -162,33 +159,4 @@ private: }; -#define NS_TIMERMANAGER_CONTRACTID "@mozilla.org/timer/manager;1" -#define NS_TIMERMANAGER_CLASSNAME "Timer Manager" -#define NS_TIMERMANAGER_CID \ -{ /* 4fe206fa-1dd2-11b2-8a0a-88bacbecc7d2 */ \ - 0x4fe206fa, \ - 0x1dd2, \ - 0x11b2, \ - {0x8a, 0x0a, 0x88, 0xba, 0xcb, 0xec, 0xc7, 0xd2} \ -} - -#include "nsITimerManager.h" - -class nsTimerManager : nsITimerManager -{ -public: - nsTimerManager(); - - NS_DECL_ISUPPORTS - NS_DECL_NSITIMERMANAGER - - nsresult AddIdleTimer(nsITimer* timer); -private: - ~nsTimerManager(); - - PRLock *mLock; - nsVoidArray mIdleTimers; -}; - - #endif /* nsTimerImpl_h___ */