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

Unified Diff: chrome/browser/sync/glue/generic_change_processor.cc

Issue 215973007: [Sync] Add plumbing of context from client to server (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix compile Created 6 years, 9 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/directory_commit_contribution.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync/glue/generic_change_processor.cc
diff --git a/chrome/browser/sync/glue/generic_change_processor.cc b/chrome/browser/sync/glue/generic_change_processor.cc
index f90365d9fb8bd7132b13c78a60d412d861030c23..6bcf08d76d6cf2dfc7d58890b02825051fd2f464 100644
--- a/chrome/browser/sync/glue/generic_change_processor.cc
+++ b/chrome/browser/sync/glue/generic_change_processor.cc
@@ -26,6 +26,8 @@ namespace browser_sync {
namespace {
+const int kContextSizeLimit = 1024; // Datatype context size limit.
+
void SetNodeSpecifics(const sync_pb::EntitySpecifics& entity_specifics,
syncer::WriteNode* write_node) {
if (syncer::GetModelTypeFromSpecifics(entity_specifics) ==
@@ -170,7 +172,18 @@ syncer::SyncDataList GenericChangeProcessor::GetAllSyncData(
syncer::SyncError GenericChangeProcessor::UpdateDataTypeContext(
syncer::ModelType type,
const std::string& context) {
- NOTIMPLEMENTED();
+ if (context.size() > static_cast<size_t>(kContextSizeLimit)) {
+ return syncer::SyncError(FROM_HERE,
+ syncer::SyncError::DATATYPE_ERROR,
+ "Context size limit exceeded.",
+ type);
+ }
+
+ syncer::WriteTransaction trans(FROM_HERE, share_handle());
+ trans.SetDataTypeContext(type, context);
+
+ // TODO(zea): consider forcing a nudge? For we'll just use the context on
+ // the next organically triggered sync cycle.
return syncer::SyncError();
}
« no previous file with comments | « no previous file | sync/engine/directory_commit_contribution.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698