summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlipalani@chromium.org <lipalani@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-01 16:05:16 +0000
committerlipalani@chromium.org <lipalani@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-01 16:05:16 +0000
commit00b1a06d7d0b2d1205bd913bb97d341d3e5ae4fb (patch)
tree3c9fd25cc3b9fed17e62f2b2a41b768fe7e28406
parentb35b1dd3737b7d6bc9aeca0666772c9a9aded78a (diff)
downloadchromium_src-00b1a06d7d0b2d1205bd913bb97d341d3e5ae4fb.zip
chromium_src-00b1a06d7d0b2d1205bd913bb97d341d3e5ae4fb.tar.gz
chromium_src-00b1a06d7d0b2d1205bd913bb97d341d3e5ae4fb.tar.bz2
Show the location where the nudges are triggered from.
BUG=77006 TEST= Review URL: http://codereview.chromium.org/6689013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@80166 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/sync/engine/syncapi.cc16
-rw-r--r--chrome/browser/sync/engine/syncapi.h3
-rw-r--r--chrome/browser/sync/engine/syncer_thread2.cc46
-rw-r--r--chrome/browser/sync/engine/syncer_thread2.h12
-rw-r--r--chrome/browser/sync/engine/syncer_thread_adapter.cc19
-rw-r--r--chrome/browser/sync/engine/syncer_thread_adapter.h10
-rw-r--r--chrome/browser/sync/glue/sync_backend_host.cc14
-rw-r--r--chrome/browser/sync/glue/sync_backend_host.h4
8 files changed, 78 insertions, 46 deletions
diff --git a/chrome/browser/sync/engine/syncapi.cc b/chrome/browser/sync/engine/syncapi.cc
index e1f35f0..89a9ded 100644
--- a/chrome/browser/sync/engine/syncapi.cc
+++ b/chrome/browser/sync/engine/syncapi.cc
@@ -1641,14 +1641,15 @@ bool SyncManager::RequestResume() {
return false;
}
-void SyncManager::RequestNudge() {
+void SyncManager::RequestNudge(const tracked_objects::Location& location) {
if (data_->syncer_thread())
- data_->syncer_thread()->NudgeSyncer(0, SyncerThread::kLocal);
+ data_->syncer_thread()->NudgeSyncer(0, SyncerThread::kLocal, location);
}
void SyncManager::RequestClearServerData() {
if (data_->syncer_thread())
- data_->syncer_thread()->NudgeSyncer(0, SyncerThread::kClearPrivateData);
+ data_->syncer_thread()->NudgeSyncer(0, SyncerThread::kClearPrivateData,
+ FROM_HERE);
}
void SyncManager::RequestConfig(const syncable::ModelTypeBitSet& types) {
@@ -1952,7 +1953,7 @@ void SyncManager::SyncInternal::SetPassphrase(
// Nudge the syncer so that encrypted datatype updates that were waiting for
// this passphrase get applied as soon as possible.
- sync_manager_->RequestNudge();
+ sync_manager_->RequestNudge(FROM_HERE);
} else {
VLOG(1) << "No pending keys, adding provided passphrase.";
WriteNode node(&trans);
@@ -2191,7 +2192,7 @@ void SyncManager::SyncInternal::OnIPAddressChangedImpl() {
// TODO(akalin): CheckServerReachable() can block, which may cause
// jank if we try to shut down sync. Fix this.
connection_manager()->CheckServerReachable();
- sync_manager_->RequestNudge();
+ sync_manager_->RequestNudge(FROM_HERE);
}
// Listen to model changes, filter out ones initiated by the sync API, and
@@ -2337,7 +2338,8 @@ void SyncManager::SyncInternal::HandleCalculateChangesChangeEventFromSyncApi(
syncer_thread()->NudgeSyncerWithDataTypes(
nudge_delay,
SyncerThread::kLocal,
- model_types);
+ model_types,
+ FROM_HERE);
}
}
@@ -2664,7 +2666,7 @@ void SyncManager::SyncInternal::OnIncomingNotification(
syncer_thread()->NudgeSyncerWithPayloads(
kSyncerThreadDelayMsec,
SyncerThread::kNotification,
- type_payloads);
+ type_payloads, FROM_HERE);
}
allstatus_.IncrementNotificationsReceived();
UpdateNotificationInfo(type_payloads);
diff --git a/chrome/browser/sync/engine/syncapi.h b/chrome/browser/sync/engine/syncapi.h
index 241411c..56b779f 100644
--- a/chrome/browser/sync/engine/syncapi.h
+++ b/chrome/browser/sync/engine/syncapi.h
@@ -46,6 +46,7 @@
#include "base/callback.h"
#include "base/gtest_prod_util.h"
#include "base/memory/scoped_ptr.h"
+#include "base/tracked_objects.h"
#include "build/build_config.h"
#include "chrome/browser/sync/protocol/password_specifics.pb.h"
#include "chrome/browser/sync/syncable/autofill_migration.h"
@@ -940,7 +941,7 @@ class SyncManager {
// Request a nudge of the syncer, which will cause the syncer thread
// to run at the next available opportunity.
- void RequestNudge();
+ void RequestNudge(const tracked_objects::Location& nudge_location);
// Request a clearing of all data on the server
void RequestClearServerData();
diff --git a/chrome/browser/sync/engine/syncer_thread2.cc b/chrome/browser/sync/engine/syncer_thread2.cc
index 639f518..e94215e 100644
--- a/chrome/browser/sync/engine/syncer_thread2.cc
+++ b/chrome/browser/sync/engine/syncer_thread2.cc
@@ -47,6 +47,11 @@ struct SyncerThread::SyncSessionJob {
SyncSessionJobPurpose purpose;
base::TimeTicks scheduled_start;
linked_ptr<sessions::SyncSession> session;
+
+ // This is the location the nudge came from. used for debugging purpose.
+ // In case of multiple nudges getting coalesced this stores the first nudge
+ // that came in.
+ tracked_objects::Location nudge_location;
};
SyncerThread::DelayProvider::DelayProvider() {}
@@ -225,7 +230,8 @@ void SyncerThread::ScheduleClearUserData() {
}
void SyncerThread::ScheduleNudge(const TimeDelta& delay,
- NudgeSource source, const ModelTypeBitSet& types) {
+ NudgeSource source, const ModelTypeBitSet& types,
+ const tracked_objects::Location& nudge_location) {
if (!thread_.IsRunning()) {
NOTREACHED();
return;
@@ -235,11 +241,12 @@ void SyncerThread::ScheduleNudge(const TimeDelta& delay,
syncable::ModelTypePayloadMapFromBitSet(types, std::string());
thread_.message_loop()->PostTask(FROM_HERE, NewRunnableMethod(
this, &SyncerThread::ScheduleNudgeImpl, delay, source,
- types_with_payloads));
+ types_with_payloads, nudge_location));
}
void SyncerThread::ScheduleNudgeWithPayloads(const TimeDelta& delay,
- NudgeSource source, const ModelTypePayloadMap& types_with_payloads) {
+ NudgeSource source, const ModelTypePayloadMap& types_with_payloads,
+ const tracked_objects::Location& nudge_location) {
if (!thread_.IsRunning()) {
NOTREACHED();
return;
@@ -247,7 +254,7 @@ void SyncerThread::ScheduleNudgeWithPayloads(const TimeDelta& delay,
thread_.message_loop()->PostTask(FROM_HERE, NewRunnableMethod(
this, &SyncerThread::ScheduleNudgeImpl, delay, source,
- types_with_payloads));
+ types_with_payloads, nudge_location));
}
void SyncerThread::ScheduleClearUserDataImpl() {
@@ -255,11 +262,13 @@ void SyncerThread::ScheduleClearUserDataImpl() {
SyncSession* session = new SyncSession(session_context_.get(), this,
SyncSourceInfo(), ModelSafeRoutingInfo(),
std::vector<ModelSafeWorker*>());
- ScheduleSyncSessionJob(TimeDelta::FromSeconds(0), CLEAR_USER_DATA, session);
+ ScheduleSyncSessionJob(TimeDelta::FromSeconds(0), CLEAR_USER_DATA, session,
+ FROM_HERE);
}
void SyncerThread::ScheduleNudgeImpl(const TimeDelta& delay,
- NudgeSource source, const ModelTypePayloadMap& types_with_payloads) {
+ NudgeSource source, const ModelTypePayloadMap& types_with_payloads,
+ const tracked_objects::Location& nudge_location) {
DCHECK_EQ(MessageLoop::current(), thread_.message_loop());
TimeTicks rough_start = TimeTicks::Now() + delay;
if (!ShouldRunJob(NUDGE, rough_start)) {
@@ -286,6 +295,7 @@ void SyncerThread::ScheduleNudgeImpl(const TimeDelta& delay,
return;
pending_nudge_->session->Coalesce(*session.get());
+
if (!IsBackingOff()) {
return;
} else {
@@ -296,7 +306,7 @@ void SyncerThread::ScheduleNudgeImpl(const TimeDelta& delay,
pending_nudge_.reset();
}
}
- ScheduleSyncSessionJob(delay, NUDGE, session.release());
+ ScheduleSyncSessionJob(delay, NUDGE, session.release(), nudge_location);
}
// Helper to extract the routing info and workers corresponding to types in
@@ -357,20 +367,24 @@ void SyncerThread::ScheduleConfigImpl(const ModelSafeRoutingInfo& routing_info,
syncable::ModelTypePayloadMapFromRoutingInfo(
routing_info, std::string())),
routing_info, workers);
- ScheduleSyncSessionJob(TimeDelta::FromSeconds(0), CONFIGURATION, session);
+ ScheduleSyncSessionJob(TimeDelta::FromSeconds(0), CONFIGURATION, session,
+ FROM_HERE);
}
void SyncerThread::ScheduleSyncSessionJob(const base::TimeDelta& delay,
- SyncSessionJobPurpose purpose, sessions::SyncSession* session) {
+ SyncSessionJobPurpose purpose, sessions::SyncSession* session,
+ const tracked_objects::Location& nudge_location) {
DCHECK_EQ(MessageLoop::current(), thread_.message_loop());
+
SyncSessionJob job = {purpose, TimeTicks::Now() + delay,
- make_linked_ptr(session)};
+ make_linked_ptr(session), nudge_location};
if (purpose == NUDGE) {
DCHECK(!pending_nudge_.get() || pending_nudge_->session.get() == session);
pending_nudge_.reset(new SyncSessionJob(job));
}
MessageLoop::current()->PostDelayedTask(FROM_HERE, NewRunnableMethod(this,
- &SyncerThread::DoSyncSessionJob, job), delay.InMilliseconds());
+ &SyncerThread::DoSyncSessionJob, job),
+ delay.InMilliseconds());
}
void SyncerThread::SetSyncerStepsForPurpose(SyncSessionJobPurpose purpose,
@@ -506,7 +520,7 @@ void SyncerThread::ScheduleNextSync(const SyncSessionJob& old_job) {
// We weren't continuing and we aren't in backoff. Schedule a normal
// continuation.
ScheduleNudgeImpl(TimeDelta::FromSeconds(0), NUDGE_SOURCE_CONTINUATION,
- old_job.session->source().types);
+ old_job.session->source().types, FROM_HERE);
}
}
@@ -543,7 +557,7 @@ void SyncerThread::HandleConsecutiveContinuationError(
wait_interval_.reset(new WaitInterval(WaitInterval::EXPONENTIAL_BACKOFF,
length));
SyncSessionJob job = {NUDGE, TimeTicks::Now() + length,
- make_linked_ptr(s)};
+ make_linked_ptr(s), FROM_HERE};
pending_nudge_.reset(new SyncSessionJob(job));
wait_interval_->timer.Start(length, this, &SyncerThread::DoCanaryJob);
}
@@ -581,9 +595,7 @@ void SyncerThread::Stop() {
void SyncerThread::DoCanaryJob() {
DCHECK(pending_nudge_.get());
wait_interval_->had_nudge = false;
- SyncSessionJob copy = {pending_nudge_->purpose,
- pending_nudge_->scheduled_start,
- pending_nudge_->session};
+ SyncSessionJob copy = *pending_nudge_;
DoSyncSessionJob(copy);
}
@@ -597,7 +609,7 @@ void SyncerThread::PollTimerCallback() {
syncable::ModelTypePayloadMapFromRoutingInfo(r, std::string());
SyncSourceInfo info(GetUpdatesCallerInfo::PERIODIC, types_with_payloads);
SyncSession* s = new SyncSession(session_context_.get(), this, info, r, w);
- ScheduleSyncSessionJob(TimeDelta::FromSeconds(0), POLL, s);
+ ScheduleSyncSessionJob(TimeDelta::FromSeconds(0), POLL, s, FROM_HERE);
}
void SyncerThread::Unthrottle() {
diff --git a/chrome/browser/sync/engine/syncer_thread2.h b/chrome/browser/sync/engine/syncer_thread2.h
index 3768456..3fbdd7f 100644
--- a/chrome/browser/sync/engine/syncer_thread2.h
+++ b/chrome/browser/sync/engine/syncer_thread2.h
@@ -68,10 +68,12 @@ class SyncerThread : public sessions::SyncSession::Delegate,
// The meat and potatoes.
void ScheduleNudge(const base::TimeDelta& delay, NudgeSource source,
- const syncable::ModelTypeBitSet& types);
+ const syncable::ModelTypeBitSet& types,
+ const tracked_objects::Location& nudge_location);
void ScheduleNudgeWithPayloads(
const base::TimeDelta& delay, NudgeSource source,
- const syncable::ModelTypePayloadMap& types_with_payloads);
+ const syncable::ModelTypePayloadMap& types_with_payloads,
+ const tracked_objects::Location& nudge_location);
void ScheduleConfig(const syncable::ModelTypeBitSet& types);
void ScheduleClearUserData();
@@ -136,7 +138,8 @@ class SyncerThread : public sessions::SyncSession::Delegate,
// Helper to assemble a job and post a delayed task to sync.
void ScheduleSyncSessionJob(const base::TimeDelta& delay,
SyncSessionJobPurpose purpose,
- sessions::SyncSession* session);
+ sessions::SyncSession* session,
+ const tracked_objects::Location& nudge_location);
// Invoke the Syncer to perform a sync.
void DoSyncSessionJob(const SyncSessionJob& job);
@@ -170,7 +173,8 @@ class SyncerThread : public sessions::SyncSession::Delegate,
void ScheduleNudgeImpl(
const base::TimeDelta& delay,
NudgeSource source,
- const syncable::ModelTypePayloadMap& types_with_payloads);
+ const syncable::ModelTypePayloadMap& types_with_payloads,
+ const tracked_objects::Location& nudge_location);
void ScheduleConfigImpl(const ModelSafeRoutingInfo& routing_info,
const std::vector<ModelSafeWorker*>& workers);
void ScheduleClearUserDataImpl();
diff --git a/chrome/browser/sync/engine/syncer_thread_adapter.cc b/chrome/browser/sync/engine/syncer_thread_adapter.cc
index 0383b47..8a513e9 100644
--- a/chrome/browser/sync/engine/syncer_thread_adapter.cc
+++ b/chrome/browser/sync/engine/syncer_thread_adapter.cc
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include "base/time.h"
+#include "base/tracked.h"
#include "chrome/browser/sync/engine/syncer_thread_adapter.h"
#include "chrome/browser/sync/syncable/model_type.h"
@@ -77,7 +78,8 @@ s3::NudgeSource LegacyToNewSyncerThreadSource(SyncerThread::NudgeSource s) {
}
void SyncerThreadAdapter::NudgeSyncer(int milliseconds_from_now,
- SyncerThread::NudgeSource source) {
+ SyncerThread::NudgeSource source,
+ const tracked_objects::Location& nudge_location) {
if (using_new_impl_) {
if (source == SyncerThread::kClearPrivateData) {
new_impl_->ScheduleClearUserData();
@@ -85,7 +87,8 @@ void SyncerThreadAdapter::NudgeSyncer(int milliseconds_from_now,
}
new_impl_->ScheduleNudge(
TimeDelta::FromMilliseconds(milliseconds_from_now),
- LegacyToNewSyncerThreadSource(source), ModelTypeBitSet());
+ LegacyToNewSyncerThreadSource(source), ModelTypeBitSet(),
+ nudge_location);
} else {
legacy_->NudgeSyncer(milliseconds_from_now, source);
}
@@ -94,12 +97,14 @@ void SyncerThreadAdapter::NudgeSyncer(int milliseconds_from_now,
void SyncerThreadAdapter::NudgeSyncerWithDataTypes(
int milliseconds_from_now,
SyncerThread::NudgeSource source,
- const syncable::ModelTypeBitSet& model_types) {
+ const syncable::ModelTypeBitSet& model_types,
+ const tracked_objects::Location& nudge_location) {
DCHECK_NE(SyncerThread::kClearPrivateData, source);
if (using_new_impl_) {
new_impl_->ScheduleNudge(
TimeDelta::FromMilliseconds(milliseconds_from_now),
- LegacyToNewSyncerThreadSource(source), model_types);
+ LegacyToNewSyncerThreadSource(source), model_types,
+ nudge_location);
} else {
legacy_->NudgeSyncerWithDataTypes(milliseconds_from_now, source,
model_types);
@@ -109,12 +114,14 @@ void SyncerThreadAdapter::NudgeSyncerWithDataTypes(
void SyncerThreadAdapter::NudgeSyncerWithPayloads(
int milliseconds_from_now,
SyncerThread::NudgeSource source,
- const syncable::ModelTypePayloadMap& model_types_with_payloads) {
+ const syncable::ModelTypePayloadMap& model_types_with_payloads,
+ const tracked_objects::Location& nudge_location) {
DCHECK_NE(SyncerThread::kClearPrivateData, source);
if (using_new_impl_) {
new_impl_->ScheduleNudgeWithPayloads(
TimeDelta::FromMilliseconds(milliseconds_from_now),
- LegacyToNewSyncerThreadSource(source), model_types_with_payloads);
+ LegacyToNewSyncerThreadSource(source), model_types_with_payloads,
+ nudge_location);
} else {
legacy_->NudgeSyncerWithPayloads(milliseconds_from_now, source,
model_types_with_payloads);
diff --git a/chrome/browser/sync/engine/syncer_thread_adapter.h b/chrome/browser/sync/engine/syncer_thread_adapter.h
index 5cae8e2..6b234e9 100644
--- a/chrome/browser/sync/engine/syncer_thread_adapter.h
+++ b/chrome/browser/sync/engine/syncer_thread_adapter.h
@@ -7,6 +7,7 @@
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
+#include "base/tracked.h"
#include "chrome/browser/sync/engine/net/server_connection_manager.h"
#include "chrome/browser/sync/engine/syncer_thread.h"
#include "chrome/browser/sync/engine/syncer_thread2.h"
@@ -29,15 +30,18 @@ class SyncerThreadAdapter {
bool RequestPause();
bool RequestResume();
void NudgeSyncer(int milliseconds_from_now,
- SyncerThread::NudgeSource source);
+ SyncerThread::NudgeSource source,
+ const tracked_objects::Location& nudge_location);
void NudgeSyncerWithDataTypes(
int milliseconds_from_now,
SyncerThread::NudgeSource source,
- const syncable::ModelTypeBitSet& model_types);
+ const syncable::ModelTypeBitSet& model_types,
+ const tracked_objects::Location& nudge_location);
void NudgeSyncerWithPayloads(
int milliseconds_from_now,
SyncerThread::NudgeSource source,
- const syncable::ModelTypePayloadMap& model_types_with_payloads);
+ const syncable::ModelTypePayloadMap& model_types_with_payloads,
+ const tracked_objects::Location& nudge_location);
void SetNotificationsEnabled(bool enabled);
void CreateSyncer(const std::string& dirname);
diff --git a/chrome/browser/sync/glue/sync_backend_host.cc b/chrome/browser/sync/glue/sync_backend_host.cc
index 302724f..a69a12c 100644
--- a/chrome/browser/sync/glue/sync_backend_host.cc
+++ b/chrome/browser/sync/glue/sync_backend_host.cc
@@ -456,7 +456,7 @@ void SyncBackendHost::FinishConfigureDataTypesOnFrontendLoop() {
// TODO(tim): Remove this when we get rid of the old syncer thread.
if (request_nudge) {
CHECK(!using_new_syncer_thread_);
- RequestNudge();
+ RequestNudge(FROM_HERE);
}
pending_config_mode_state_.reset();
@@ -475,9 +475,10 @@ void SyncBackendHost::EncryptDataTypes(
encrypted_types));
}
-void SyncBackendHost::RequestNudge() {
+void SyncBackendHost::RequestNudge(const tracked_objects::Location& location) {
core_thread_.message_loop()->PostTask(FROM_HERE,
- NewRunnableMethod(core_.get(), &SyncBackendHost::Core::DoRequestNudge));
+ NewRunnableMethod(core_.get(), &SyncBackendHost::Core::DoRequestNudge,
+ location));
}
void SyncBackendHost::RequestConfig(
@@ -780,7 +781,7 @@ void SyncBackendHost::Core::DoStartSyncing() {
DCHECK(MessageLoop::current() == host_->core_thread_.message_loop());
syncapi_->StartSyncing();
if (deferred_nudge_for_cleanup_requested_)
- syncapi_->RequestNudge();
+ syncapi_->RequestNudge(FROM_HERE);
deferred_nudge_for_cleanup_requested_ = false;
}
@@ -1095,8 +1096,9 @@ void SyncBackendHost::Core::StartSavingChanges() {
this, &Core::SaveChanges);
}
-void SyncBackendHost::Core::DoRequestNudge() {
- syncapi_->RequestNudge();
+void SyncBackendHost::Core::DoRequestNudge(
+ const tracked_objects::Location& nudge_location) {
+ syncapi_->RequestNudge(nudge_location);
}
void SyncBackendHost::Core::DoRequestClearServerData() {
diff --git a/chrome/browser/sync/glue/sync_backend_host.h b/chrome/browser/sync/glue/sync_backend_host.h
index a6e6acf..b53ed05 100644
--- a/chrome/browser/sync/glue/sync_backend_host.h
+++ b/chrome/browser/sync/glue/sync_backend_host.h
@@ -336,7 +336,7 @@ class SyncBackendHost : public browser_sync::ModelSafeWorkerRegistrar {
// Called on the SyncBackendHost core_thread_ to nudge/pause/resume the
// syncer.
- void DoRequestNudge();
+ void DoRequestNudge(const tracked_objects::Location& location);
void DoRequestPause();
void DoRequestResume();
void DoRequestClearServerData();
@@ -522,7 +522,7 @@ class SyncBackendHost : public browser_sync::ModelSafeWorkerRegistrar {
virtual void HandleInitializationCompletedOnFrontendLoop();
// Posts a nudge request on the core thread.
- virtual void RequestNudge();
+ virtual void RequestNudge(const tracked_objects::Location& location);
// Posts a config request on the core thread.
virtual void RequestConfig(const syncable::ModelTypeBitSet& added_types);