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

Side by Side Diff: chrome/browser/sync/engine/syncer_thread_timed_stop.h

Issue 235010: Reverting 27117. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: 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
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 // A class to run the syncer on a thread. This guy is the closest chrome-based
6 // (as opposed to pthreads based) SyncerThread to the old pthread implementation
7 // in semantics, as it supports a timeout on Stop() -- It is just an override of
8 // two methods from SyncerThread: ThreadMain and Stop -- to provide this.
9 #ifndef CHROME_BROWSER_SYNC_ENGINE_SYNCER_THREAD_TIMED_STOP_H_
10 #define CHROME_BROWSER_SYNC_ENGINE_SYNCER_THREAD_TIMED_STOP_H_
11
12 #include <list>
13 #include <map>
14 #include <queue>
15 #include <vector>
16
17 #include "chrome/browser/sync/engine/syncer_thread.h"
18
19 namespace browser_sync {
20
21 class SyncerThreadTimedStop : public SyncerThread {
22 FRIEND_TEST(SyncerThreadTest, CalculateSyncWaitTime);
23 FRIEND_TEST(SyncerThreadTest, CalculatePollingWaitTime);
24 FRIEND_TEST(SyncerThreadWithSyncerTest, Polling);
25 FRIEND_TEST(SyncerThreadWithSyncerTest, Nudge);
26 friend class SyncerThreadWithSyncerTest;
27 friend class SyncerThreadFactory;
28 public:
29 virtual ~SyncerThreadTimedStop() {}
30
31 // Stop processing. This version comes with a supported max_wait.
32 // A max wait of at least 2*server RTT time is recommended.
33 // Returns true if we stopped, false otherwise.
34 virtual bool Stop(int max_wait);
35
36 private:
37 SyncerThreadTimedStop(ClientCommandChannel* command_channel,
38 syncable::DirectoryManager* mgr,
39 ServerConnectionManager* connection_manager, AllStatus* all_status,
40 ModelSafeWorker* model_safe_worker);
41 virtual void ThreadMain();
42
43 // We use this to track when our synthesized thread loop is active, so we can
44 // timed-wait for it to become false. For this and only this (temporary)
45 // implementation, we protect this variable using our parent lock_.
46 bool in_thread_main_loop_;
47
48 DISALLOW_COPY_AND_ASSIGN(SyncerThreadTimedStop);
49 };
50
51 } // namespace browser_sync
52
53 #endif // CHROME_BROWSER_SYNC_ENGINE_SYNCER_THREAD_TIMED_STOP_H_
OLDNEW
« no previous file with comments | « chrome/browser/sync/engine/syncer_thread_pthreads.cc ('k') | chrome/browser/sync/engine/syncer_thread_timed_stop.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698