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

Unified Diff: content/child/scheduler/worker_scheduler_impl.h

Issue 1085863002: Revert of Revert of Add a WorkerScheduler and a WebThreadImplForWorker (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « content/child/scheduler/worker_scheduler.cc ('k') | content/child/scheduler/worker_scheduler_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/scheduler/worker_scheduler_impl.h
diff --git a/content/child/scheduler/worker_scheduler_impl.h b/content/child/scheduler/worker_scheduler_impl.h
new file mode 100644
index 0000000000000000000000000000000000000000..186d2bcb53ac0b3483c51560f676be9b040c4957
--- /dev/null
+++ b/content/child/scheduler/worker_scheduler_impl.h
@@ -0,0 +1,61 @@
+// Copyright 2015 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 CONTENT_CHILD_SCHEDULER_WORKER_SCHEDULER_IMPL_H_
+#define CONTENT_CHILD_SCHEDULER_WORKER_SCHEDULER_IMPL_H_
+
+#include "content/child/scheduler/worker_scheduler.h"
+#include "content/child/scheduler/scheduler_helper.h"
+
+namespace base {
+namespace trace_event {
+class ConvertableToTraceFormat;
+}
+}
+
+namespace content {
+
+class NestableSingleThreadTaskRunner;
+
+class CONTENT_EXPORT WorkerSchedulerImpl
+ : public WorkerScheduler,
+ public SchedulerHelper::SchedulerHelperDelegate {
+ public:
+ explicit WorkerSchedulerImpl(
+ scoped_refptr<NestableSingleThreadTaskRunner> main_task_runner);
+ ~WorkerSchedulerImpl() override;
+
+ // WorkerScheduler implementation:
+ scoped_refptr<base::SingleThreadTaskRunner> DefaultTaskRunner() override;
+ scoped_refptr<SingleThreadIdleTaskRunner> IdleTaskRunner() override;
+ bool CanExceedIdleDeadlineIfRequired() const override;
+ void AddTaskObserver(base::MessageLoop::TaskObserver* task_observer) override;
+ void RemoveTaskObserver(
+ base::MessageLoop::TaskObserver* task_observer) override;
+ void Init() override;
+ void Shutdown() override;
+
+ void SetTimeSourceForTesting(scoped_refptr<cc::TestNowSource> time_source);
+ void SetWorkBatchSizeForTesting(size_t work_batch_size);
+ base::TimeTicks CurrentIdleTaskDeadlineForTesting() const;
+
+ protected:
+ // SchedulerHelperDelegate implementation:
+ bool CanEnterLongIdlePeriod(
+ base::TimeTicks now,
+ base::TimeDelta* next_long_idle_period_delay_out) override;
+ void IsNotQuiescent() override {}
+
+ private:
+ void MaybeStartLongIdlePeriod();
+
+ SchedulerHelper helper_;
+ bool initialized_;
+
+ DISALLOW_COPY_AND_ASSIGN(WorkerSchedulerImpl);
+};
+
+} // namespace content
+
+#endif // CONTENT_CHILD_SCHEDULER_WORKER_SCHEDULER_IMPL_H_
« no previous file with comments | « content/child/scheduler/worker_scheduler.cc ('k') | content/child/scheduler/worker_scheduler_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698