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

Unified Diff: sync/engine/sync_scheduler_impl.h

Issue 10825439: sync: remove buggy freshness condition in SyncSchedulerImpl add defensive DCHECKs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: FIX Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | sync/engine/sync_scheduler_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/engine/sync_scheduler_impl.h
diff --git a/sync/engine/sync_scheduler_impl.h b/sync/engine/sync_scheduler_impl.h
index 461455a4c379137717948a487d60b1193f33b2e6..cf5e24c519c2ac9f5920b2a1b850becfa4dfcdb5 100644
--- a/sync/engine/sync_scheduler_impl.h
+++ b/sync/engine/sync_scheduler_impl.h
@@ -5,6 +5,7 @@
#ifndef SYNC_ENGINE_SYNC_SCHEDULER_IMPL_H_
#define SYNC_ENGINE_SYNC_SCHEDULER_IMPL_H_
+#include <map>
#include <string>
#include "base/callback.h"
@@ -278,6 +279,12 @@ class SyncSchedulerImpl : public SyncScheduler {
// the client starts up and does not need to perform an initial sync.
void SendInitialSnapshot();
+ // This is used for histogramming and analysis of ScheduleNudge* APIs.
+ // SyncScheduler is the ultimate choke-point for all such invocations (with
+ // and without InvalidationState variants, all NudgeSources, etc) and as such
+ // is the most flexible place to do this bookkeeping.
+ void UpdateNudgeTimeRecords(const sessions::SyncSourceInfo& info);
+
virtual void OnActionableError(const sessions::SyncSessionSnapshot& snapshot);
base::WeakPtrFactory<SyncSchedulerImpl> weak_ptr_factory_;
@@ -313,10 +320,6 @@ class SyncSchedulerImpl : public SyncScheduler {
// The mode of operation.
Mode mode_;
- // TODO(tim): Bug 26339. This needs to track more than just time I think,
- // since the nudges could be for different types. Current impl doesn't care.
- base::TimeTicks last_sync_session_end_time_;
-
// The latest connection code we got while trying to connect.
HttpResponse::ServerConnectionCode connection_code_;
@@ -331,7 +334,20 @@ class SyncSchedulerImpl : public SyncScheduler {
// Invoked to run through the sync cycle.
scoped_ptr<Syncer> syncer_;
- sessions::SyncSessionContext *session_context_;
+ sessions::SyncSessionContext* session_context_;
+
+ // A map tracking LOCAL NudgeSource invocations of ScheduleNudge* APIs,
+ // organized by datatype. Each datatype that was part of the types requested
+ // in the call will have its TimeTicks value updated.
+ typedef std::map<ModelType, base::TimeTicks> ModelTypeTimeMap;
+ ModelTypeTimeMap last_local_nudges_by_model_type_;
+
+ // Used as an "anti-reentrancy defensive assertion".
+ // While true, it is illegal for any new scheduling activity to take place.
+ // Ensures that higher layers don't break this law in response to events that
+ // take place during a sync cycle. We call this out because such violations
+ // could result in tight sync loops hitting sync servers.
+ bool no_scheduling_allowed_;
DISALLOW_COPY_AND_ASSIGN(SyncSchedulerImpl);
};
« no previous file with comments | « no previous file | sync/engine/sync_scheduler_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698