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

Side by Side Diff: third_party/libjingle_xmpp/task_runner/task_unittest.cc

Issue 2803023002: Add calls to WrapCurrentThread and UnwrapCurrentThread. (Closed)
Patch Set: Created 3 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
« no previous file with comments | « no previous file | no next file » | 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 90
91 private: 91 private:
92 int time_to_perform_; 92 int time_to_perform_;
93 }; 93 };
94 94
95 // simple implementation of a task runner which uses Windows' 95 // simple implementation of a task runner which uses Windows'
96 // GetSystemTimeAsFileTime() to get the current clock ticks 96 // GetSystemTimeAsFileTime() to get the current clock ticks
97 97
98 class MyTaskRunner : public TaskRunner { 98 class MyTaskRunner : public TaskRunner {
99 public: 99 public:
100 MyTaskRunner() { ThreadManager::Instance()->WrapCurrentThread(); }
101 ~MyTaskRunner() { ThreadManager::Instance()->UnwrapCurrentThread(); }
102
100 virtual void WakeTasks() { RunTasks(); } 103 virtual void WakeTasks() { RunTasks(); }
101 virtual int64_t CurrentTime() { return GetCurrentTime(); } 104 virtual int64_t CurrentTime() { return GetCurrentTime(); }
102 105
103 bool timeout_change() const { 106 bool timeout_change() const {
104 return timeout_change_; 107 return timeout_change_;
105 } 108 }
106 109
107 void clear_timeout_change() { 110 void clear_timeout_change() {
108 timeout_change_ = false; 111 timeout_change_ = false;
109 } 112 }
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 // Do not start the task. 536 // Do not start the task.
534 // Note: this leaks memory, so don't do this. 537 // Note: this leaks memory, so don't do this.
535 // Instead, always run your tasks or delete them. 538 // Instead, always run your tasks or delete them.
536 new HappyTask(happy_task); 539 new HappyTask(happy_task);
537 540
538 // run the unblocked tasks 541 // run the unblocked tasks
539 task_runner.RunTasks(); 542 task_runner.RunTasks();
540 } 543 }
541 544
542 } // namespace rtc 545 } // namespace rtc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698