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

Unified Diff: base/mac/libdispatch_task_runner.h

Issue 11547006: De-flake the LibDispatchTaskRunner tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove circular reference Created 8 years 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/mac/libdispatch_task_runner.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/mac/libdispatch_task_runner.h
diff --git a/base/mac/libdispatch_task_runner.h b/base/mac/libdispatch_task_runner.h
index 722b73d80f121ccd6bf5f963bb2ed1cfafca3937..b1d90e29acb191b054d54a690549c537d9988952 100644
--- a/base/mac/libdispatch_task_runner.h
+++ b/base/mac/libdispatch_task_runner.h
@@ -8,6 +8,7 @@
#include <dispatch/dispatch.h>
#include "base/single_thread_task_runner.h"
+#include "base/synchronization/waitable_event.h"
namespace base {
namespace mac {
@@ -48,16 +49,30 @@ class BASE_EXPORT LibDispatchTaskRunner : public base::SingleThreadTaskRunner {
const Closure& task,
base::TimeDelta delay) OVERRIDE;
+ // This blocks the calling thread until all work on the dispatch queue has
+ // been run and the queue has been destroyed. Destroying a queue requires
+ // ALL retained references to it to be released. Any new tasks posted to
+ // this thread after shutdown are dropped.
+ void Shutdown();
+
// Returns the dispatch queue associated with this task runner, for use with
// system APIs that take dispatch queues. The caller is responsible for
// retaining the result.
+ //
+ // All properties (context, finalizer, etc.) are managed by this class, and
+ // clients should only use the result of this for dispatch_async().
dispatch_queue_t GetDispatchQueue() const;
protected:
virtual ~LibDispatchTaskRunner();
private:
+ static void Finalizer(void* context);
+
dispatch_queue_t queue_;
+
+ // The event on which Shutdown waits until Finalizer runs.
+ base::WaitableEvent queue_finalized_;
};
} // namespace mac
« no previous file with comments | « no previous file | base/mac/libdispatch_task_runner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698