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

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

Issue 1956001: Moved XMPP notifier library from chrome/browser/sync to chrome/common.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 7 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
« no previous file with comments | « chrome/browser/sync/notifier/base/task_pump.h ('k') | chrome/browser/sync/notifier/base/time.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "chrome/browser/sync/notifier/base/time.h"
7 #include "talk/base/common.h"
8 #include "talk/base/thread.h"
9
10 namespace notifier {
11
12 // Don't add any messages because there are cleared and thrown away.
13 enum { MSG_WAKE_UP = 1, MSG_TIMED_WAKE_UP };
14
15 TaskPump::TaskPump() : timeout_change_count_(0), posted_(false) {
16 }
17
18 void TaskPump::OnMessage(talk_base::Message* msg) {
19 posted_ = false;
20
21 // If a task timed out, ensure that it is not blocked, so it will be deleted.
22 // This may result in a WakeTasks if a task is timed out.
23 PollTasks();
24
25 // Run tasks and handle timeouts.
26 RunTasks();
27 }
28
29 void TaskPump::WakeTasks() {
30 if (!posted_) {
31 // Do the requested wake up.
32 talk_base::Thread::Current()->Post(this, MSG_WAKE_UP);
33 posted_ = true;
34 }
35 }
36
37 int64 TaskPump::CurrentTime() {
38 return GetCurrent100NSTime();
39 }
40
41 } // namespace notifier
OLDNEW
« no previous file with comments | « chrome/browser/sync/notifier/base/task_pump.h ('k') | chrome/browser/sync/notifier/base/time.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698