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

Side by Side Diff: chrome/browser/sync/notifier/base/task_pump.cc

Issue 194065: Initial commit of sync engine code to browser/sync.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Fixes to gtest include path, reverted syncapi. Created 11 years, 3 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 | Annotate | Revision Log
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 // Copyright (c) 2009 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 #include "chrome/browser/sync/notifier/base/task_pump.h"
6
7 #include "chrome/browser/sync/notifier/base/time.h"
8 #include "talk/base/common.h"
9 #include "talk/base/thread.h"
10
11 namespace notifier {
12
13 // Don't add any messages because there are cleared and thrown away.
14 enum { MSG_WAKE_UP = 1, MSG_TIMED_WAKE_UP };
15
16 TaskPump::TaskPump() : timeout_change_count_(0), posted_(false) {
17 }
18
19 void TaskPump::OnMessage(talk_base::Message* msg) {
20 posted_ = false;
21 int initial_count = timeout_change_count_;
22
23 // If a task timed out, ensure that it is not blocked, so it will be deleted.
24 // This may result in a WakeTasks if a task is timed out.
25 PollTasks();
26
27 // Run tasks and handle timeouts.
28 RunTasks();
29 }
30
31 void TaskPump::WakeTasks() {
32 if (!posted_) {
33 // Do the requested wake up
34 talk_base::Thread::Current()->Post(this, MSG_WAKE_UP);
35 posted_ = true;
36 }
37 }
38
39 int64 TaskPump::CurrentTime() {
40 return GetCurrent100NSTime();
41 }
idana 2009/09/10 05:44:37 Missing blank line.
42 } // namespace notifier
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698