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

Side by Side Diff: components/sync/syncable/write_transaction_info.cc

Issue 2130453004: [Sync] Move //sync to //components/sync. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 4 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
« no previous file with comments | « components/sync/syncable/write_transaction_info.h ('k') | components/sync/test/DEPS » ('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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/syncable/write_transaction_info.h" 5 #include "components/sync/syncable/write_transaction_info.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
11 11
12 namespace syncer { 12 namespace syncer {
13 namespace syncable { 13 namespace syncable {
14 14
15 WriteTransactionInfo::WriteTransactionInfo( 15 WriteTransactionInfo::WriteTransactionInfo(
16 int64_t id, 16 int64_t id,
17 tracked_objects::Location location, 17 tracked_objects::Location location,
18 WriterTag writer, 18 WriterTag writer,
19 ImmutableEntryKernelMutationMap mutations) 19 ImmutableEntryKernelMutationMap mutations)
20 : id(id), 20 : id(id),
21 location_string(location.ToString()), 21 location_string(location.ToString()),
22 writer(writer), 22 writer(writer),
23 mutations(mutations) {} 23 mutations(mutations) {}
24 24
25 WriteTransactionInfo::WriteTransactionInfo() 25 WriteTransactionInfo::WriteTransactionInfo() : id(-1), writer(INVALID) {}
26 : id(-1), writer(INVALID) {}
27 26
28 WriteTransactionInfo::WriteTransactionInfo(const WriteTransactionInfo& other) = 27 WriteTransactionInfo::WriteTransactionInfo(const WriteTransactionInfo& other) =
29 default; 28 default;
30 29
31 WriteTransactionInfo::~WriteTransactionInfo() {} 30 WriteTransactionInfo::~WriteTransactionInfo() {}
32 31
33 base::DictionaryValue* WriteTransactionInfo::ToValue( 32 base::DictionaryValue* WriteTransactionInfo::ToValue(
34 size_t max_mutations_size) const { 33 size_t max_mutations_size) const {
35 base::DictionaryValue* dict = new base::DictionaryValue(); 34 base::DictionaryValue* dict = new base::DictionaryValue();
36 dict->SetString("id", base::Int64ToString(id)); 35 dict->SetString("id", base::Int64ToString(id));
37 dict->SetString("location", location_string); 36 dict->SetString("location", location_string);
38 dict->SetString("writer", WriterTagToString(writer)); 37 dict->SetString("writer", WriterTagToString(writer));
39 base::Value* mutations_value = NULL; 38 base::Value* mutations_value = NULL;
40 const size_t mutations_size = mutations.Get().size(); 39 const size_t mutations_size = mutations.Get().size();
41 if (mutations_size <= max_mutations_size) { 40 if (mutations_size <= max_mutations_size) {
42 mutations_value = EntryKernelMutationMapToValue(mutations.Get()); 41 mutations_value = EntryKernelMutationMapToValue(mutations.Get());
43 } else { 42 } else {
44 mutations_value = 43 mutations_value = new base::StringValue(
45 new base::StringValue( 44 base::SizeTToString(mutations_size) + " mutations");
46 base::SizeTToString(mutations_size) + " mutations");
47 } 45 }
48 dict->Set("mutations", mutations_value); 46 dict->Set("mutations", mutations_value);
49 return dict; 47 return dict;
50 } 48 }
51 49
52 } // namespace syncable 50 } // namespace syncable
53 } // namespace syncer 51 } // namespace syncer
OLDNEW
« no previous file with comments | « components/sync/syncable/write_transaction_info.h ('k') | components/sync/test/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698