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

Side by Side Diff: chromecast/public/task_runner.h

Issue 1257013003: Load CMA backend from shared library (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: DCHECK on posted task Created 5 years, 4 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 CHROMECAST_PUBLIC_TASK_RUNNER_H_
6 #define CHROMECAST_PUBLIC_TASK_RUNNER_H_
7
8 #include <stdint.h>
9
10 namespace chromecast {
11
12 // Provides a way for vendor libraries to run code on a specific thread.
13 // For example, cast_shell supplies an implementation of this interface through
14 // media APIs (see MediaPipelineDeviceParams) to allow media backends to
15 // schedule tasks to be run on the media thread.
16 class TaskRunner {
17 public:
18 // Subclass and implement 'Run' to supply code to be run by PostTask or
19 // PostDelayedTask. They both take ownership of the Task object passed in
20 // and will delete after running the Task.
21 class Task {
22 public:
23 virtual ~Task() {}
24 virtual void Run() = 0;
25 };
26
27 virtual ~TaskRunner() {}
byungchul 2015/07/30 17:19:06 Should it be protected since it won't be destroyed
halliwell 2015/07/30 18:20:18 Done.
28
29 // Posts a task to the thread's task queue. Delay of 0 could mean task
30 // runs immediately (within the call to PostTask, if it's called on the
31 // target thread) but there also could be some delay (the task could be added
32 // to target thread's task queue).
33 virtual bool PostTask(Task* task, uint64_t delay_milliseconds) = 0;
servolk 2015/07/30 17:44:18 We are using uint64_t values to represent number o
halliwell 2015/07/30 18:20:18 Disagree, task posting has always been done in mil
34 };
35
36 } // namespace chromecast
37
38 #endif // CHROMECAST_PUBLIC_TASK_RUNNER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698