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

Side by Side Diff: webrtc/base/task.h

Issue 1362503003: Use suffixed {uint,int}{8,16,32,64}_t types. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase + revert basictypes.h (to be landed separately just in case of a revert due to unexpected us… Created 5 years, 2 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
« no previous file with comments | « webrtc/base/systeminfo.cc ('k') | webrtc/base/task.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 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 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 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 // 88 //
89 89
90 namespace rtc { 90 namespace rtc {
91 91
92 // Executes a sequence of steps 92 // Executes a sequence of steps
93 class Task : public TaskParent { 93 class Task : public TaskParent {
94 public: 94 public:
95 Task(TaskParent *parent); 95 Task(TaskParent *parent);
96 ~Task() override; 96 ~Task() override;
97 97
98 int32 unique_id() { return unique_id_; } 98 int32_t unique_id() { return unique_id_; }
99 99
100 void Start(); 100 void Start();
101 void Step(); 101 void Step();
102 int GetState() const { return state_; } 102 int GetState() const { return state_; }
103 bool HasError() const { return (GetState() == STATE_ERROR); } 103 bool HasError() const { return (GetState() == STATE_ERROR); }
104 bool Blocked() const { return blocked_; } 104 bool Blocked() const { return blocked_; }
105 bool IsDone() const { return done_; } 105 bool IsDone() const { return done_; }
106 int64 ElapsedTime(); 106 int64_t ElapsedTime();
107 107
108 // Called from outside to stop task without any more callbacks 108 // Called from outside to stop task without any more callbacks
109 void Abort(bool nowake = false); 109 void Abort(bool nowake = false);
110 110
111 bool TimedOut(); 111 bool TimedOut();
112 112
113 int64 timeout_time() const { return timeout_time_; } 113 int64_t timeout_time() const { return timeout_time_; }
114 int timeout_seconds() const { return timeout_seconds_; } 114 int timeout_seconds() const { return timeout_seconds_; }
115 void set_timeout_seconds(int timeout_seconds); 115 void set_timeout_seconds(int timeout_seconds);
116 116
117 sigslot::signal0<> SignalTimeout; 117 sigslot::signal0<> SignalTimeout;
118 118
119 // Called inside the task to signal that the task may be unblocked 119 // Called inside the task to signal that the task may be unblocked
120 void Wake(); 120 void Wake();
121 121
122 protected: 122 protected:
123 123
124 enum { 124 enum {
125 STATE_BLOCKED = -1, 125 STATE_BLOCKED = -1,
126 STATE_INIT = 0, 126 STATE_INIT = 0,
127 STATE_START = 1, 127 STATE_START = 1,
128 STATE_DONE = 2, 128 STATE_DONE = 2,
129 STATE_ERROR = 3, 129 STATE_ERROR = 3,
130 STATE_RESPONSE = 4, 130 STATE_RESPONSE = 4,
131 STATE_NEXT = 5, // Subclasses which need more states start here and higher 131 STATE_NEXT = 5, // Subclasses which need more states start here and higher
132 }; 132 };
133 133
134 // Called inside to advise that the task should wake and signal an error 134 // Called inside to advise that the task should wake and signal an error
135 void Error(); 135 void Error();
136 136
137 int64 CurrentTime(); 137 int64_t CurrentTime();
138 138
139 virtual std::string GetStateName(int state) const; 139 virtual std::string GetStateName(int state) const;
140 virtual int Process(int state); 140 virtual int Process(int state);
141 virtual void Stop(); 141 virtual void Stop();
142 virtual int ProcessStart() = 0; 142 virtual int ProcessStart() = 0;
143 virtual int ProcessResponse(); 143 virtual int ProcessResponse();
144 144
145 void ResetTimeout(); 145 void ResetTimeout();
146 void ClearTimeout(); 146 void ClearTimeout();
147 147
148 void SuspendTimeout(); 148 void SuspendTimeout();
149 void ResumeTimeout(); 149 void ResumeTimeout();
150 150
151 protected: 151 protected:
152 virtual int OnTimeout(); 152 virtual int OnTimeout();
153 153
154 private: 154 private:
155 void Done(); 155 void Done();
156 156
157 int state_; 157 int state_;
158 bool blocked_; 158 bool blocked_;
159 bool done_; 159 bool done_;
160 bool aborted_; 160 bool aborted_;
161 bool busy_; 161 bool busy_;
162 bool error_; 162 bool error_;
163 int64 start_time_; 163 int64_t start_time_;
164 int64 timeout_time_; 164 int64_t timeout_time_;
165 int timeout_seconds_; 165 int timeout_seconds_;
166 bool timeout_suspended_; 166 bool timeout_suspended_;
167 int32 unique_id_; 167 int32_t unique_id_;
168 168
169 static int32 unique_id_seed_; 169 static int32_t unique_id_seed_;
170 }; 170 };
171 171
172 } // namespace rtc 172 } // namespace rtc
173 173
174 #endif // WEBRTC_BASE_TASK_H__ 174 #endif // WEBRTC_BASE_TASK_H__
OLDNEW
« no previous file with comments | « webrtc/base/systeminfo.cc ('k') | webrtc/base/task.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698