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

Side by Side Diff: sync/internal_api/write_transaction.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, 8 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
« no previous file with comments | « sync/internal_api/public/write_transaction.h ('k') | sync/test/engine/mock_update_handler.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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 "sync/internal_api/public/write_transaction.h" 5 #include "sync/internal_api/public/write_transaction.h"
6 6
7 #include "sync/syncable/directory.h"
7 #include "sync/syncable/syncable_write_transaction.h" 8 #include "sync/syncable/syncable_write_transaction.h"
8 9
9 namespace syncer { 10 namespace syncer {
10 11
11 ////////////////////////////////////////////////////////////////////////// 12 //////////////////////////////////////////////////////////////////////////
12 // WriteTransaction member definitions 13 // WriteTransaction member definitions
13 WriteTransaction::WriteTransaction(const tracked_objects::Location& from_here, 14 WriteTransaction::WriteTransaction(const tracked_objects::Location& from_here,
14 UserShare* share) 15 UserShare* share)
15 : BaseTransaction(share), 16 : BaseTransaction(share),
16 transaction_(NULL) { 17 transaction_(NULL) {
(...skipping 12 matching lines...) Expand all
29 } 30 }
30 31
31 WriteTransaction::~WriteTransaction() { 32 WriteTransaction::~WriteTransaction() {
32 delete transaction_; 33 delete transaction_;
33 } 34 }
34 35
35 syncable::BaseTransaction* WriteTransaction::GetWrappedTrans() const { 36 syncable::BaseTransaction* WriteTransaction::GetWrappedTrans() const {
36 return transaction_; 37 return transaction_;
37 } 38 }
38 39
40 void WriteTransaction::SetDataTypeContext(ModelType type,
41 const std::string& context) {
42 sync_pb::DataTypeContext local_context;
43 GetDirectory()->GetDataTypeContext(transaction_,
44 type,
45 &local_context);
46 if (local_context.context() == context)
47 return;
48
49 if (!local_context.has_data_type_id()) {
50 local_context.set_data_type_id(
51 syncer::GetSpecificsFieldNumberFromModelType(type));
52 }
53 DCHECK_EQ(syncer::GetSpecificsFieldNumberFromModelType(type),
54 local_context.data_type_id());
55 DCHECK_GE(local_context.version(), 0);
56 local_context.set_version(local_context.version() + 1);
57 local_context.set_context(context);
58 GetDirectory()->SetDataTypeContext(transaction_,
59 type,
60 local_context);
61 }
62
39 } // namespace syncer 63 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/internal_api/public/write_transaction.h ('k') | sync/test/engine/mock_update_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698