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

Side by Side Diff: content/child/scheduler/worker_scheduler.h

Issue 1088933002: 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_CHILD_SCHEDULER_WORKER_SCHEDULER_H_
6 #define CONTENT_CHILD_SCHEDULER_WORKER_SCHEDULER_H_
7
8 #include "base/message_loop/message_loop.h"
9 #include "content/child/scheduler/single_thread_idle_task_runner.h"
10 #include "content/common/content_export.h"
11
12 namespace base {
13 class MessageLoop;
14 }
15
16 namespace content {
17
18 class CONTENT_EXPORT WorkerScheduler {
19 public:
20 virtual ~WorkerScheduler();
21 static scoped_ptr<WorkerScheduler> Create(base::MessageLoop* message_loop);
22
23 // Must be called before the scheduler can be used. Does any post construction
24 // initialization needed such as initializing idle period detection.
25 virtual void Init() = 0;
26
27 // Returns the default task runner.
28 virtual scoped_refptr<base::SingleThreadTaskRunner> DefaultTaskRunner() = 0;
29
30 // Returns the idle task runner. Tasks posted to this runner may be reordered
31 // relative to other task types and may be starved for an arbitrarily long
32 // time if no idle time is available.
33 virtual scoped_refptr<SingleThreadIdleTaskRunner> IdleTaskRunner() = 0;
34
35 // Returns true if a currently running idle task could exceed its deadline
36 // without impacting user experience too much. This should only be used if
37 // there is a task which cannot be pre-empted and is likely to take longer
38 // than the largest expected idle task deadline. It should NOT be polled to
39 // check whether more work can be performed on the current idle task after
40 // its deadline has expired - post a new idle task for the continuation of the
41 // work in this case.
42 // Must be called from the worker's thread.
43 virtual bool CanExceedIdleDeadlineIfRequired() const = 0;
44
45 // Adds or removes a task observer from the scheduler. The observer will be
46 // notified before and after every executed task. These functions can only be
47 // called on the main thread.
48 virtual void AddTaskObserver(
49 base::MessageLoop::TaskObserver* task_observer) = 0;
50 virtual void RemoveTaskObserver(
51 base::MessageLoop::TaskObserver* task_observer) = 0;
52
53 // Shuts down the scheduler by dropping any remaining pending work in the work
54 // queues. After this call any work posted to the task runners will be
55 // silently dropped.
56 virtual void Shutdown() = 0;
57
58 protected:
59 WorkerScheduler();
60 DISALLOW_COPY_AND_ASSIGN(WorkerScheduler);
61 };
62
63 } // namespace content
64
65 #endif // CONTENT_CHILD_SCHEDULER_WORKER_SCHEDULER_H_
OLDNEW
« no previous file with comments | « content/child/scheduler/webthread_impl_for_worker_scheduler_unittest.cc ('k') | content/child/scheduler/worker_scheduler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698