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

Side by Side Diff: sync/engine/sync_scheduler.h

Issue 10006046: Abort sync cycles when download step fails (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rearrange SetSyncerStepsForPurpose Created 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | sync/engine/sync_scheduler.cc » ('j') | sync/engine/sync_scheduler.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 // 4 //
5 // A class to schedule syncer tasks intelligently. 5 // A class to schedule syncer tasks intelligently.
6 #ifndef SYNC_ENGINE_SYNC_SCHEDULER_H_ 6 #ifndef SYNC_ENGINE_SYNC_SCHEDULER_H_
7 #define SYNC_ENGINE_SYNC_SCHEDULER_H_ 7 #define SYNC_ENGINE_SYNC_SCHEDULER_H_
8 #pragma once 8 #pragma once
9 9
10 #include <string> 10 #include <string>
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 linked_ptr<sessions::SyncSession> session; 172 linked_ptr<sessions::SyncSession> session;
173 bool is_canary_job; 173 bool is_canary_job;
174 174
175 // This is the location the job came from. Used for debugging. 175 // This is the location the job came from. Used for debugging.
176 // In case of multiple nudges getting coalesced this stores the 176 // In case of multiple nudges getting coalesced this stores the
177 // first location that came in. 177 // first location that came in.
178 tracked_objects::Location from_here; 178 tracked_objects::Location from_here;
179 }; 179 };
180 friend class SyncSchedulerTest; 180 friend class SyncSchedulerTest;
181 friend class SyncSchedulerWhiteboxTest; 181 friend class SyncSchedulerWhiteboxTest;
182 friend class SyncerTest;
182 183
183 FRIEND_TEST_ALL_PREFIXES(SyncSchedulerWhiteboxTest, 184 FRIEND_TEST_ALL_PREFIXES(SyncSchedulerWhiteboxTest,
184 DropNudgeWhileExponentialBackOff); 185 DropNudgeWhileExponentialBackOff);
185 FRIEND_TEST_ALL_PREFIXES(SyncSchedulerWhiteboxTest, SaveNudge); 186 FRIEND_TEST_ALL_PREFIXES(SyncSchedulerWhiteboxTest, SaveNudge);
186 FRIEND_TEST_ALL_PREFIXES(SyncSchedulerWhiteboxTest, 187 FRIEND_TEST_ALL_PREFIXES(SyncSchedulerWhiteboxTest,
187 SaveNudgeWhileTypeThrottled); 188 SaveNudgeWhileTypeThrottled);
188 FRIEND_TEST_ALL_PREFIXES(SyncSchedulerWhiteboxTest, ContinueNudge); 189 FRIEND_TEST_ALL_PREFIXES(SyncSchedulerWhiteboxTest, ContinueNudge);
189 FRIEND_TEST_ALL_PREFIXES(SyncSchedulerWhiteboxTest, DropPoll); 190 FRIEND_TEST_ALL_PREFIXES(SyncSchedulerWhiteboxTest, DropPoll);
190 FRIEND_TEST_ALL_PREFIXES(SyncSchedulerWhiteboxTest, ContinuePoll); 191 FRIEND_TEST_ALL_PREFIXES(SyncSchedulerWhiteboxTest, ContinuePoll);
191 FRIEND_TEST_ALL_PREFIXES(SyncSchedulerWhiteboxTest, ContinueConfiguration); 192 FRIEND_TEST_ALL_PREFIXES(SyncSchedulerWhiteboxTest, ContinueConfiguration);
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 241
241 // Configure jobs are saved only when backing off or throttling. So we 242 // Configure jobs are saved only when backing off or throttling. So we
242 // expose the pointer here. 243 // expose the pointer here.
243 scoped_ptr<SyncSessionJob> pending_configure_job; 244 scoped_ptr<SyncSessionJob> pending_configure_job;
244 }; 245 };
245 246
246 static const char* GetModeString(Mode mode); 247 static const char* GetModeString(Mode mode);
247 248
248 static const char* GetDecisionString(JobProcessDecision decision); 249 static const char* GetDecisionString(JobProcessDecision decision);
249 250
251 // Assign |start| and |end| to appropriate SyncerStep values for the
252 // specified |purpose|.
253 static void SetSyncerStepsForPurpose(
254 SyncSessionJob::SyncSessionJobPurpose purpose,
255 SyncerStep* start, SyncerStep* end);
Nicolas Zea 2012/04/09 19:09:14 have params on separate lines for consistency with
256
250 // Helpers that log before posting to |sync_loop_|. These will only post 257 // Helpers that log before posting to |sync_loop_|. These will only post
251 // the task in between calls to Start/Stop. 258 // the task in between calls to Start/Stop.
252 void PostTask(const tracked_objects::Location& from_here, 259 void PostTask(const tracked_objects::Location& from_here,
253 const char* name, 260 const char* name,
254 const base::Closure& task); 261 const base::Closure& task);
255 void PostDelayedTask(const tracked_objects::Location& from_here, 262 void PostDelayedTask(const tracked_objects::Location& from_here,
256 const char* name, 263 const char* name,
257 const base::Closure& task, 264 const base::Closure& task,
258 base::TimeDelta delay); 265 base::TimeDelta delay);
259 266
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 // Called when the root cause of the current connection error is fixed. 340 // Called when the root cause of the current connection error is fixed.
334 void OnServerConnectionErrorFixed(); 341 void OnServerConnectionErrorFixed();
335 342
336 // The pointer is owned by the caller. 343 // The pointer is owned by the caller.
337 browser_sync::sessions::SyncSession* CreateSyncSession( 344 browser_sync::sessions::SyncSession* CreateSyncSession(
338 const browser_sync::sessions::SyncSourceInfo& info); 345 const browser_sync::sessions::SyncSourceInfo& info);
339 346
340 // Creates a session for a poll and performs the sync. 347 // Creates a session for a poll and performs the sync.
341 void PollTimerCallback(); 348 void PollTimerCallback();
342 349
343 // Assign |start| and |end| to appropriate SyncerStep values for the
344 // specified |purpose|.
345 void SetSyncerStepsForPurpose(SyncSessionJob::SyncSessionJobPurpose purpose,
346 SyncerStep* start,
347 SyncerStep* end);
348
349 // Used to update |connection_code_|, see below. 350 // Used to update |connection_code_|, see below.
350 void UpdateServerConnectionManagerStatus( 351 void UpdateServerConnectionManagerStatus(
351 HttpResponse::ServerConnectionCode code); 352 HttpResponse::ServerConnectionCode code);
352 353
353 // Called once the first time thread_ is started to broadcast an initial 354 // Called once the first time thread_ is started to broadcast an initial
354 // session snapshot containing data like initial_sync_ended. Important when 355 // session snapshot containing data like initial_sync_ended. Important when
355 // the client starts up and does not need to perform an initial sync. 356 // the client starts up and does not need to perform an initial sync.
356 void SendInitialSnapshot(); 357 void SendInitialSnapshot();
357 358
358 virtual void OnActionableError(const sessions::SyncSessionSnapshot& snapshot); 359 virtual void OnActionableError(const sessions::SyncSessionSnapshot& snapshot);
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 scoped_ptr<Syncer> syncer_; 410 scoped_ptr<Syncer> syncer_;
410 411
411 scoped_ptr<sessions::SyncSessionContext> session_context_; 412 scoped_ptr<sessions::SyncSessionContext> session_context_;
412 413
413 DISALLOW_COPY_AND_ASSIGN(SyncScheduler); 414 DISALLOW_COPY_AND_ASSIGN(SyncScheduler);
414 }; 415 };
415 416
416 } // namespace browser_sync 417 } // namespace browser_sync
417 418
418 #endif // SYNC_ENGINE_SYNC_SCHEDULER_H_ 419 #endif // SYNC_ENGINE_SYNC_SCHEDULER_H_
OLDNEW
« no previous file with comments | « no previous file | sync/engine/sync_scheduler.cc » ('j') | sync/engine/sync_scheduler.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698