summaryrefslogtreecommitdiffstats
path: root/sync/internal_api/public/sessions
diff options
context:
space:
mode:
authorrlarocque@chromium.org <rlarocque@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-29 22:33:34 +0000
committerrlarocque@chromium.org <rlarocque@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-29 22:33:34 +0000
commit66565693eca820d5b8e6510a02b7330a2fc2a2f5 (patch)
treecb5aedec5132f93c02bcef5e5e0f8d677c8dd8e0 /sync/internal_api/public/sessions
parent0e534402bcd0586a7d85cde515de4631b441f0f2 (diff)
downloadchromium_src-66565693eca820d5b8e6510a02b7330a2fc2a2f5.zip
chromium_src-66565693eca820d5b8e6510a02b7330a2fc2a2f5.tar.gz
chromium_src-66565693eca820d5b8e6510a02b7330a2fc2a2f5.tar.bz2
sync: Remove session member from SyncSessionJob
This change removes the SyncSession member of SyncSessionJob. The session had two very important responsibilities: 1. Tracking the source and notification hints for the current job. 2. Indicating whether or not a job had been abandoned. We now track the source of a job directly in SyncSessionJob. The debug_info_sources_list has been removed entirely. The investigation that triggered its addition has been put on hold for now and it is unliekly we will need this information in the future. Tracking abandoned jobs is a bit more difficult. The scheduler used to keep track of SyncSessions very carefully, since only a valid session would allow a job to actually proceed. This patch introduces a new approach for limiting the number of pending jobs. The scheduler now maintains a single scoped_ptr to a CancelableClosure. All scheduled tasks will be wrapped in a CancelableClosure that will be owned by this scoped_ptr. If a new task pre-empts an existing task, it will overwrite the scoped_ptr, which will prevent the old task from running. Therefore, only one task may be pending at any given time. This should help prevent issues like crbug.com/139723, though it also introduces new failure modes. BUG=175024 Review URL: https://chromiumcodereview.appspot.com/12942005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@191458 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sync/internal_api/public/sessions')
-rw-r--r--sync/internal_api/public/sessions/sync_session_snapshot.cc14
-rw-r--r--sync/internal_api/public/sessions/sync_session_snapshot.h3
-rw-r--r--sync/internal_api/public/sessions/sync_session_snapshot_unittest.cc9
3 files changed, 1 insertions, 25 deletions
diff --git a/sync/internal_api/public/sessions/sync_session_snapshot.cc b/sync/internal_api/public/sessions/sync_session_snapshot.cc
index b0e9fac..8c0c2b9 100644
--- a/sync/internal_api/public/sessions/sync_session_snapshot.cc
+++ b/sync/internal_api/public/sessions/sync_session_snapshot.cc
@@ -31,7 +31,6 @@ SyncSessionSnapshot::SyncSessionSnapshot(
int num_hierarchy_conflicts,
int num_server_conflicts,
const SyncSourceInfo& source,
- const std::vector<SyncSourceInfo>& debug_info_sources_list,
bool notifications_enabled,
size_t num_entries,
base::Time sync_start_time,
@@ -44,7 +43,6 @@ SyncSessionSnapshot::SyncSessionSnapshot(
num_hierarchy_conflicts_(num_hierarchy_conflicts),
num_server_conflicts_(num_server_conflicts),
source_(source),
- debug_info_sources_list_(debug_info_sources_list),
notifications_enabled_(notifications_enabled),
num_entries_(num_entries),
sync_start_time_(sync_start_time),
@@ -86,13 +84,6 @@ DictionaryValue* SyncSessionSnapshot::ToValue() const {
num_server_conflicts_);
value->SetInteger("numEntries", num_entries_);
value->Set("source", source_.ToValue());
- scoped_ptr<ListValue> sources_list(new ListValue());
- for (std::vector<SyncSourceInfo>::const_iterator i =
- debug_info_sources_list_.begin();
- i != debug_info_sources_list_.end(); ++i) {
- sources_list->Append(i->ToValue());
- }
- value->Set("sourcesList", sources_list.release());
value->SetBoolean("notificationsEnabled", notifications_enabled_);
scoped_ptr<DictionaryValue> counter_entries(new DictionaryValue());
@@ -147,11 +138,6 @@ SyncSourceInfo SyncSessionSnapshot::source() const {
return source_;
}
-const std::vector<SyncSourceInfo>&
-SyncSessionSnapshot::debug_info_sources_list() const {
- return debug_info_sources_list_;
-}
-
bool SyncSessionSnapshot::notifications_enabled() const {
return notifications_enabled_;
}
diff --git a/sync/internal_api/public/sessions/sync_session_snapshot.h b/sync/internal_api/public/sessions/sync_session_snapshot.h
index be29d35..3e1c20e 100644
--- a/sync/internal_api/public/sessions/sync_session_snapshot.h
+++ b/sync/internal_api/public/sessions/sync_session_snapshot.h
@@ -38,7 +38,6 @@ class SYNC_EXPORT SyncSessionSnapshot {
int num_hierarchy_conflicts,
int num_server_conflicts,
const SyncSourceInfo& source,
- const std::vector<SyncSourceInfo>& debug_info_sources_list,
bool notifications_enabled,
size_t num_entries,
base::Time sync_start_time,
@@ -61,7 +60,6 @@ class SYNC_EXPORT SyncSessionSnapshot {
int num_hierarchy_conflicts() const;
int num_server_conflicts() const;
SyncSourceInfo source() const;
- const std::vector<SyncSourceInfo>& debug_info_sources_list() const;
bool notifications_enabled() const;
size_t num_entries() const;
base::Time sync_start_time() const;
@@ -79,7 +77,6 @@ class SYNC_EXPORT SyncSessionSnapshot {
int num_hierarchy_conflicts_;
int num_server_conflicts_;
SyncSourceInfo source_;
- std::vector<SyncSourceInfo> debug_info_sources_list_;
bool notifications_enabled_;
size_t num_entries_;
base::Time sync_start_time_;
diff --git a/sync/internal_api/public/sessions/sync_session_snapshot_unittest.cc b/sync/internal_api/public/sessions/sync_session_snapshot_unittest.cc
index 9301ffd..1d9f198 100644
--- a/sync/internal_api/public/sessions/sync_session_snapshot_unittest.cc
+++ b/sync/internal_api/public/sessions/sync_session_snapshot_unittest.cc
@@ -47,11 +47,6 @@ TEST_F(SyncSessionSnapshotTest, SyncSessionSnapshotToValue) {
SyncSourceInfo source;
scoped_ptr<DictionaryValue> expected_source_value(source.ToValue());
- std::vector<SyncSourceInfo> debug_info_sources_list;
- debug_info_sources_list.push_back(source);
- scoped_ptr<ListValue> expected_sources_list_value(new ListValue());
- expected_sources_list_value->Append(source.ToValue());
-
SyncSessionSnapshot snapshot(model_neutral,
download_progress_markers,
kIsSilenced,
@@ -59,14 +54,13 @@ TEST_F(SyncSessionSnapshotTest, SyncSessionSnapshotToValue) {
kNumHierarchyConflicts,
kNumServerConflicts,
source,
- debug_info_sources_list,
false,
0,
base::Time::Now(),
std::vector<int>(MODEL_TYPE_COUNT,0),
std::vector<int>(MODEL_TYPE_COUNT, 0));
scoped_ptr<DictionaryValue> value(snapshot.ToValue());
- EXPECT_EQ(18u, value->size());
+ EXPECT_EQ(17u, value->size());
ExpectDictIntegerValue(model_neutral.num_successful_commits,
*value, "numSuccessfulCommits");
ExpectDictIntegerValue(model_neutral.num_successful_bookmark_commits,
@@ -93,7 +87,6 @@ TEST_F(SyncSessionSnapshotTest, SyncSessionSnapshotToValue) {
ExpectDictIntegerValue(kNumServerConflicts, *value,
"numServerConflicts");
ExpectDictDictionaryValue(*expected_source_value, *value, "source");
- ExpectDictListValue(*expected_sources_list_value, *value, "sourcesList");
ExpectDictBooleanValue(false, *value, "notificationsEnabled");
}