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

Unified Diff: chrome/browser/sync/internal_api/change_record.cc

Issue 7926001: [Sync] Move change-related methods out of SyncManager::Observer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix bug in async encryption, sync to head Created 9 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
Index: chrome/browser/sync/internal_api/change_record.cc
diff --git a/chrome/browser/sync/internal_api/change_record.cc b/chrome/browser/sync/internal_api/change_record.cc
index 414407b315558fe7fae9ebae4de7f0408acf1231..7518ecd966d7a99cd98bba6b7f1b3d79c48ef634 100644
--- a/chrome/browser/sync/internal_api/change_record.cc
+++ b/chrome/browser/sync/internal_api/change_record.cc
@@ -17,7 +17,8 @@ ChangeRecord::ChangeRecord()
ChangeRecord::~ChangeRecord() {}
-DictionaryValue* ChangeRecord::ToValue(const BaseTransaction* trans) const {
+DictionaryValue* ChangeRecord::ToValue(
+ const syncable::ImmutableEntryKernelMutationMap& mutations) const {
DictionaryValue* value = new DictionaryValue();
std::string action_str;
switch (action) {
@@ -36,27 +37,21 @@ DictionaryValue* ChangeRecord::ToValue(const BaseTransaction* trans) const {
break;
}
value->SetString("action", action_str);
- Value* node_value = NULL;
+ value->SetString("id", base::Int64ToString(id));
+ syncable::EntryKernelMutationMap::const_iterator it =
+ mutations.Get().find(id);
+ if (it != mutations.Get().end()) {
+ value->Set("mutation", syncable::EntryKernelMutationToValue(it->second));
+ } else {
+ value->SetString("mutation", "<none>");
+ }
if (action == ACTION_DELETE) {
- DictionaryValue* node_dict = new DictionaryValue();
- node_dict->SetString("id", base::Int64ToString(id));
- node_dict->Set("specifics",
- browser_sync::EntitySpecificsToValue(specifics));
if (extra.get()) {
- node_dict->Set("extra", extra->ToValue());
+ value->Set("extra", extra->ToValue());
}
- node_value = node_dict;
- } else {
- ReadNode node(trans);
- if (node.InitByIdLookup(id)) {
- node_value = node.GetDetailsAsValue();
- }
- }
- if (!node_value) {
- NOTREACHED();
- node_value = Value::CreateNullValue();
+ value->Set("specifics",
+ browser_sync::EntitySpecificsToValue(specifics));
}
- value->Set("node", node_value);
return value;
}

Powered by Google App Engine
This is Rietveld 408576698