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

Side by Side Diff: third_party/libjingle_xmpp/task_runner/taskparent.h

Issue 2694903005: Add a copy of webrtc's TaskRunner abstraction, which is going to be deleted in webrtc. (Closed)
Patch Set: Delete dependencies on webrtc's rtc_task_runner. Created 3 years, 10 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 /*
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11 #ifndef WEBRTC_BASE_TASKPARENT_H__
12 #define WEBRTC_BASE_TASKPARENT_H__
13
14 #include <memory>
15 #include <set>
16
17 #include "third_party/webrtc/base/checks.h"
18 #include "third_party/webrtc/base/constructormagic.h"
19
20 namespace rtc {
21
22 class Task;
23 class TaskRunner;
24
25 class TaskParent {
26 public:
27 TaskParent(Task *derived_instance, TaskParent *parent);
28 explicit TaskParent(TaskRunner *derived_instance);
29 virtual ~TaskParent();
30
31 TaskParent *GetParent() { return parent_; }
32 TaskRunner *GetRunner() { return runner_; }
33
34 bool AllChildrenDone();
35 bool AnyChildError();
36 #if RTC_DCHECK_IS_ON
37 bool IsChildTask(Task *task);
38 #endif
39
40 protected:
41 void OnStopped(Task *task);
42 void AbortAllChildren();
43 TaskParent *parent() {
44 return parent_;
45 }
46
47 private:
48 void Initialize();
49 void OnChildStopped(Task *child);
50 void AddChild(Task *child);
51
52 TaskParent *parent_;
53 TaskRunner *runner_;
54 bool child_error_;
55 typedef std::set<Task *> ChildSet;
56 std::unique_ptr<ChildSet> children_;
57 RTC_DISALLOW_COPY_AND_ASSIGN(TaskParent);
58 };
59
60
61 } // namespace rtc
62
63 #endif // WEBRTC_BASE_TASKPARENT_H__
OLDNEW
« no previous file with comments | « third_party/libjingle_xmpp/task_runner/task_unittest.cc ('k') | third_party/libjingle_xmpp/task_runner/taskparent.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698