Bug 1186785 - Replace nsBaseHashtable::EnumerateRead() calls in toolkit/ with iterators. r=froydnj.

This commit is contained in:
Nicholas Nethercote
2015-10-19 15:46:46 -07:00
parent b9c33b1c31
commit c90ef7de34
5 changed files with 50 additions and 96 deletions

View File

@@ -1,3 +1,5 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* 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/. */
@@ -250,21 +252,6 @@ private:
nsCOMPtr<nsIThread> mWorkerThread;
};
/**
* An helper callback function used to print information about any
* pending watch when shutting down the nsINativeFileWatcher service.
*/
static PLDHashOperator
WatchedPathsInfoHashtableTraverser(nsVoidPtrHashKey::KeyType key,
WatchedResourceDescriptor* watchedResource,
void* userArg)
{
FILEWATCHERLOG("NativeFileWatcherIOTask::DeactivateRunnableMethod - "
"%S is still being watched.", watchedResource->mPath.get());
return PL_DHASH_NEXT;
}
/**
* This runnable is dispatched from the main thread to get the notifications of the
* changes in the watched resources by continuously calling the blocking function
@@ -855,8 +842,11 @@ NativeFileWatcherIOTask::DeactivateRunnableMethod()
"watches manually before quitting.");
// Log any pending watch.
(void)mWatchedResourcesByHandle.EnumerateRead(
&WatchedPathsInfoHashtableTraverser, nullptr);
for (auto it = mWatchedResourcesByHandle.Iter(); !it.Done(); it.Next()) {
FILEWATCHERLOG("NativeFileWatcherIOTask::DeactivateRunnableMethod - "
"%S is still being watched.", it.UserData()->mPath.get());
}
// We return immediately if |mShuttingDown| is true (see below for
// details about the shutdown protocol being followed).