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

Side by Side Diff: chrome/browser/sync/syncable/syncable.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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #include "chrome/browser/sync/syncable/syncable.h" 5 #include "chrome/browser/sync/syncable/syncable.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 8
9 #include <sys/stat.h> 9 #include <sys/stat.h>
10 #if defined(OS_POSIX) 10 #if defined(OS_POSIX)
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 ENUM_CASE(VACUUM_AFTER_SAVE); 83 ENUM_CASE(VACUUM_AFTER_SAVE);
84 ENUM_CASE(PURGE_ENTRIES); 84 ENUM_CASE(PURGE_ENTRIES);
85 ENUM_CASE(SYNCAPI); 85 ENUM_CASE(SYNCAPI);
86 }; 86 };
87 NOTREACHED(); 87 NOTREACHED();
88 return ""; 88 return "";
89 } 89 }
90 90
91 #undef ENUM_CASE 91 #undef ENUM_CASE
92 92
93 namespace {
94
95 DictionaryValue* EntryKernelMutationToValue( 93 DictionaryValue* EntryKernelMutationToValue(
96 const EntryKernelMutation& mutation) { 94 const EntryKernelMutation& mutation) {
97 DictionaryValue* dict = new DictionaryValue(); 95 DictionaryValue* dict = new DictionaryValue();
98 dict->Set("original", mutation.original.ToValue()); 96 dict->Set("original", mutation.original.ToValue());
99 dict->Set("mutated", mutation.mutated.ToValue()); 97 dict->Set("mutated", mutation.mutated.ToValue());
100 return dict; 98 return dict;
101 } 99 }
102 100
103 } // namespace
104
105 ListValue* EntryKernelMutationMapToValue( 101 ListValue* EntryKernelMutationMapToValue(
106 const EntryKernelMutationMap& mutations) { 102 const EntryKernelMutationMap& mutations) {
107 ListValue* list = new ListValue(); 103 ListValue* list = new ListValue();
108 for (EntryKernelMutationMap::const_iterator it = mutations.begin(); 104 for (EntryKernelMutationMap::const_iterator it = mutations.begin();
109 it != mutations.end(); ++it) { 105 it != mutations.end(); ++it) {
110 list->Append(EntryKernelMutationToValue(it->second)); 106 list->Append(EntryKernelMutationToValue(it->second));
111 } 107 }
112 return list; 108 return list;
113 } 109 }
114 110
(...skipping 1126 matching lines...) Expand 10 before | Expand all | Expand 10 after
1241 } 1237 }
1242 1238
1243 ModelTypeBitSet WriteTransaction::NotifyTransactionChangingAndEnding( 1239 ModelTypeBitSet WriteTransaction::NotifyTransactionChangingAndEnding(
1244 const ImmutableEntryKernelMutationMap& mutations) { 1240 const ImmutableEntryKernelMutationMap& mutations) {
1245 dirkernel_->transaction_mutex.AssertAcquired(); 1241 dirkernel_->transaction_mutex.AssertAcquired();
1246 DCHECK(!mutations.Get().empty()); 1242 DCHECK(!mutations.Get().empty());
1247 1243
1248 DirectoryChangeDelegate* const delegate = dirkernel_->delegate; 1244 DirectoryChangeDelegate* const delegate = dirkernel_->delegate;
1249 if (writer_ == syncable::SYNCAPI) { 1245 if (writer_ == syncable::SYNCAPI) {
1250 delegate->HandleCalculateChangesChangeEventFromSyncApi( 1246 delegate->HandleCalculateChangesChangeEventFromSyncApi(
1251 mutations.Get(), this); 1247 mutations, this);
1252 } else { 1248 } else {
1253 delegate->HandleCalculateChangesChangeEventFromSyncer( 1249 delegate->HandleCalculateChangesChangeEventFromSyncer(
1254 mutations.Get(), this); 1250 mutations, this);
1255 } 1251 }
1256 1252
1257 ModelTypeBitSet models_with_changes = 1253 ModelTypeBitSet models_with_changes =
1258 delegate->HandleTransactionEndingChangeEvent(this); 1254 delegate->HandleTransactionEndingChangeEvent(mutations, this);
1259 1255
1260 dirkernel_->observers->Notify( 1256 dirkernel_->observers->Notify(
1261 &TransactionObserver::OnTransactionMutate, 1257 &TransactionObserver::OnTransactionMutate,
1262 from_here_, writer_, mutations, models_with_changes); 1258 from_here_, writer_, mutations, models_with_changes);
1263 1259
1264 return models_with_changes; 1260 return models_with_changes;
1265 } 1261 }
1266 1262
1267 void WriteTransaction::NotifyTransactionComplete( 1263 void WriteTransaction::NotifyTransactionComplete(
1268 ModelTypeBitSet models_with_changes) { 1264 ModelTypeBitSet models_with_changes) {
(...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after
1941 CHECK(result); 1937 CHECK(result);
1942 for (iterator i = GetParentChildIndexLowerBound(lock, parent_id), 1938 for (iterator i = GetParentChildIndexLowerBound(lock, parent_id),
1943 end = GetParentChildIndexUpperBound(lock, parent_id); 1939 end = GetParentChildIndexUpperBound(lock, parent_id);
1944 i != end; ++i) { 1940 i != end; ++i) {
1945 DCHECK_EQ(parent_id, (*i)->ref(PARENT_ID)); 1941 DCHECK_EQ(parent_id, (*i)->ref(PARENT_ID));
1946 result->push_back((*i)->ref(META_HANDLE)); 1942 result->push_back((*i)->ref(META_HANDLE));
1947 } 1943 }
1948 } 1944 }
1949 1945
1950 } // namespace syncable 1946 } // namespace syncable
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698