зеркало из https://github.com/mozilla/pjs.git
Small bookmark timer fix (I believe this was broken a while ago when repeating timers were implemented.)
This commit is contained in:
Родитель
13f903ac3a
Коммит
0933626f79
|
@ -1641,13 +1641,13 @@ protected:
|
||||||
nsIRDFDataSource* mInner;
|
nsIRDFDataSource* mInner;
|
||||||
PRBool mBookmarksAvailable;
|
PRBool mBookmarksAvailable;
|
||||||
PRBool mDirty;
|
PRBool mDirty;
|
||||||
nsCOMPtr<nsITimer> mTimer;
|
|
||||||
PRBool busySchedule;
|
PRBool busySchedule;
|
||||||
nsCOMPtr<nsIRDFResource> busyResource;
|
nsCOMPtr<nsIRDFResource> busyResource;
|
||||||
PRUint32 htmlSize;
|
PRUint32 htmlSize;
|
||||||
nsCOMPtr<nsISupportsArray> mObservers;
|
nsCOMPtr<nsISupportsArray> mObservers;
|
||||||
nsCOMPtr<nsIStringBundle> mBundle;
|
nsCOMPtr<nsIStringBundle> mBundle;
|
||||||
nsString mPersonalToolbarName;
|
nsString mPersonalToolbarName;
|
||||||
|
static nsCOMPtr<nsITimer> mTimer;
|
||||||
|
|
||||||
#ifdef XP_MAC
|
#ifdef XP_MAC
|
||||||
PRBool mIEFavoritesAvailable;
|
PRBool mIEFavoritesAvailable;
|
||||||
|
@ -1817,6 +1817,10 @@ public:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
nsCOMPtr<nsITimer> nsBookmarksService::mTimer;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
nsBookmarksService::nsBookmarksService()
|
nsBookmarksService::nsBookmarksService()
|
||||||
: mInner(nsnull), mBookmarksAvailable(PR_FALSE), mDirty(PR_FALSE)
|
: mInner(nsnull), mBookmarksAvailable(PR_FALSE), mDirty(PR_FALSE)
|
||||||
#ifdef XP_MAC
|
#ifdef XP_MAC
|
||||||
|
@ -2194,8 +2198,6 @@ nsBookmarksService::FireTimer(nsITimer* aTimer, void* aClosure)
|
||||||
nsBookmarksService *bmks = NS_STATIC_CAST(nsBookmarksService *, aClosure);
|
nsBookmarksService *bmks = NS_STATIC_CAST(nsBookmarksService *, aClosure);
|
||||||
if (!bmks) return;
|
if (!bmks) return;
|
||||||
|
|
||||||
bmks->mTimer = nsnull;
|
|
||||||
|
|
||||||
if ((bmks->mBookmarksAvailable == PR_TRUE) && (bmks->mDirty == PR_TRUE))
|
if ((bmks->mBookmarksAvailable == PR_TRUE) && (bmks->mDirty == PR_TRUE))
|
||||||
{
|
{
|
||||||
bmks->Flush();
|
bmks->Flush();
|
||||||
|
@ -2218,24 +2220,22 @@ nsBookmarksService::FireTimer(nsITimer* aTimer, void* aClosure)
|
||||||
nsCOMPtr<nsIURI> uri;
|
nsCOMPtr<nsIURI> uri;
|
||||||
if (NS_SUCCEEDED(rv = NS_NewURI(getter_AddRefs(uri), url)))
|
if (NS_SUCCEEDED(rv = NS_NewURI(getter_AddRefs(uri), url)))
|
||||||
{
|
{
|
||||||
#if 0
|
|
||||||
rv = NS_OpenURI(NS_STATIC_CAST(nsIStreamListener *, bmks), nsnull, uri, nsnull);
|
|
||||||
#else
|
|
||||||
nsCOMPtr<nsIChannel> channel;
|
nsCOMPtr<nsIChannel> channel;
|
||||||
if (NS_SUCCEEDED(rv = NS_OpenURI(getter_AddRefs(channel), uri, nsnull)))
|
if (NS_SUCCEEDED(rv = NS_OpenURI(getter_AddRefs(channel), uri, nsnull)))
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIHTTPChannel> httpChannel = do_QueryInterface(channel);
|
nsCOMPtr<nsIHTTPChannel> httpChannel = do_QueryInterface(channel);
|
||||||
if (httpChannel)
|
if (httpChannel)
|
||||||
{
|
{
|
||||||
bmks->busySchedule = PR_TRUE;
|
|
||||||
bmks->htmlSize = 0;
|
bmks->htmlSize = 0;
|
||||||
|
|
||||||
// httpChannel->SetRequestMethod(HM_GET);
|
// httpChannel->SetRequestMethod(HM_GET);
|
||||||
httpChannel->SetRequestMethod(HM_HEAD);
|
httpChannel->SetRequestMethod(HM_HEAD);
|
||||||
rv = channel->AsyncRead(bmks, nsnull);
|
if (NS_SUCCEEDED(rv = channel->AsyncRead(bmks, nsnull)))
|
||||||
|
{
|
||||||
|
bmks->busySchedule = TRUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2246,12 +2246,16 @@ else
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef REPEATING_TIMERS
|
#ifndef REPEATING_TIMERS
|
||||||
// reschedule the timer
|
if (mTimer)
|
||||||
nsresult rv = NS_NewTimer(getter_AddRefs(bmks->mTimer));
|
{
|
||||||
if (NS_FAILED(rv)) return;
|
mTimer->Cancel();
|
||||||
bmks->mTimer->Init(nsBookmarksService::FireTimer, bmks, /* repeat, */ BOOKMARK_TIMEOUT);
|
mTimer = nsnull;
|
||||||
// Note: don't addref "bmks" as we'll cancel the timer in the nsBookmarkService destructor
|
}
|
||||||
|
nsresult rv = NS_NewTimer(getter_AddRefs(mTimer));
|
||||||
|
if (NS_FAILED(rv) || (!mTimer)) return;
|
||||||
|
mTimer->Init(nsBookmarksService::FireTimer, bmks, BOOKMARK_TIMEOUT, NS_PRIORITY_LOWEST, NS_TYPE_REPEATING_SLACK);
|
||||||
|
// Note: don't addref "this" as we'll cancel the timer in the nsBookmarkService destructor
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче