Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(474)

Unified Diff: base/threading/sequenced_worker_pool.h

Issue 9689028: Move work signal count tracking from SequencedWorkerPool to the test file (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync to head Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | base/threading/sequenced_worker_pool.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/threading/sequenced_worker_pool.h
diff --git a/base/threading/sequenced_worker_pool.h b/base/threading/sequenced_worker_pool.h
index 961a532b5d9d152b60d51d6a00ada163ede2c743..ded2b0a5e730ed491bde3e7341357af4968da28a 100644
--- a/base/threading/sequenced_worker_pool.h
+++ b/base/threading/sequenced_worker_pool.h
@@ -122,6 +122,7 @@ class BASE_EXPORT SequencedWorkerPool : public TaskRunner {
class TestingObserver {
public:
virtual ~TestingObserver() {}
+ virtual void OnHasWork() = 0;
virtual void WillWaitForShutdown() = 0;
virtual void OnDestruct() = 0;
};
@@ -131,6 +132,12 @@ class BASE_EXPORT SequencedWorkerPool : public TaskRunner {
SequencedWorkerPool(size_t max_threads,
const std::string& thread_name_prefix);
+ // Like above, but with |observer| for testing. Does not take
+ // ownership of |observer|.
+ SequencedWorkerPool(size_t max_threads,
+ const std::string& thread_name_prefix,
+ TestingObserver* observer);
+
// Returns a unique token that can be used to sequence tasks posted to
// PostSequencedWorkerTask(). Valid tokens are alwys nonzero.
SequenceToken GetSequenceToken();
@@ -219,10 +226,7 @@ class BASE_EXPORT SequencedWorkerPool : public TaskRunner {
void FlushForTesting();
// Spuriously signal that there is work to be done.
- void TriggerSpuriousWorkSignalForTesting();
-
- // Get the number of times the work signal has been triggered.
- int GetWorkSignalCountForTesting() const;
+ void SignalHasWorkForTesting();
// Implements the worker pool shutdown. This should be called during app
// shutdown, and will discard/join with appropriate tasks before returning.
@@ -231,10 +235,6 @@ class BASE_EXPORT SequencedWorkerPool : public TaskRunner {
// Must be called from the same thread this object was constructed on.
void Shutdown();
- // Called by tests to set the testing observer. This is NULL by default
- // and ownership of the pointer is kept with the caller.
- void SetTestingObserver(TestingObserver* observer);
-
protected:
virtual ~SequencedWorkerPool();
« no previous file with comments | « no previous file | base/threading/sequenced_worker_pool.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698