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

Unified Diff: base/task_scheduler/scheduler_worker_thread_delegate.h

Issue 1864333002: TaskScheduler: Delegate instead of callbacks for SchedulerWorkerThread. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
Index: base/task_scheduler/scheduler_worker_thread_delegate.h
diff --git a/base/task_scheduler/scheduler_worker_thread_delegate.h b/base/task_scheduler/scheduler_worker_thread_delegate.h
new file mode 100644
index 0000000000000000000000000000000000000000..ceca7da3d4a082cc2a0eb8fed4468115faad705b
--- /dev/null
+++ b/base/task_scheduler/scheduler_worker_thread_delegate.h
@@ -0,0 +1,38 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef BASE_TASK_SCHEDULER_SCHEDULER_WORKER_THREAD_DELEGATE_H_
+#define BASE_TASK_SCHEDULER_SCHEDULER_WORKER_THREAD_DELEGATE_H_
+
+#include "base/memory/ref_counted.h"
+#include "base/task_scheduler/sequence.h"
+
+namespace base {
+namespace internal {
+
+class SchedulerWorkerThread;
robliao 2016/04/06 20:50:18 Remove forward declaration.
fdoray 2016/04/06 21:11:38 Done.
+
+// Delegate interface for SchedulerWorkerThread. The methods are always called
+// from the thread managed by the SchedulerWorkerThread instance.
+class SchedulerWorkerThreadDelegate {
+ public:
+ // Called when the main function of the SchedulerWorkerThread is entered.
+ virtual void OnMainEntry() = 0;
+
+ // Called when the main function of the SchedulerWorkerThread exits.
+ virtual void OnMainExit() = 0;
+
+ // Called by the SchedulerWorkerThread to get a Sequence from which to run a
+ // Task.
+ virtual scoped_refptr<Sequence> GetWork() = 0;
+
+ // Called after the SchedulerWorkerThread has tried to run a Task from
+ // |sequence| (a TaskTracker might have prevented the Task from running).
+ virtual void RanTaskFromSequence(scoped_refptr<Sequence> sequence) = 0;
+};
+
+} // namespace internal
+} // namespace base
+
+#endif // BASE_TASK_SCHEDULER_SCHEDULER_WORKER_THREAD_DELEGATE_H_

Powered by Google App Engine
This is Rietveld 408576698