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

Side by Side Diff: 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 | « sync/syncable/write_transaction_info.h ('k') | 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "sync/syncable/write_transaction_info.h"
6
7 #include <stddef.h>
8 #include <stdint.h>
9
10 #include "base/strings/string_number_conversions.h"
11
12 namespace syncer {
13 namespace syncable {
14
15 WriteTransactionInfo::WriteTransactionInfo(
16 int64_t id,
17 tracked_objects::Location location,
18 WriterTag writer,
19 ImmutableEntryKernelMutationMap mutations)
20 : id(id),
21 location_string(location.ToString()),
22 writer(writer),
23 mutations(mutations) {}
24
25 WriteTransactionInfo::WriteTransactionInfo()
26 : id(-1), writer(INVALID) {}
27
28 WriteTransactionInfo::WriteTransactionInfo(const WriteTransactionInfo& other) =
29 default;
30
31 WriteTransactionInfo::~WriteTransactionInfo() {}
32
33 base::DictionaryValue* WriteTransactionInfo::ToValue(
34 size_t max_mutations_size) const {
35 base::DictionaryValue* dict = new base::DictionaryValue();
36 dict->SetString("id", base::Int64ToString(id));
37 dict->SetString("location", location_string);
38 dict->SetString("writer", WriterTagToString(writer));
39 base::Value* mutations_value = NULL;
40 const size_t mutations_size = mutations.Get().size();
41 if (mutations_size <= max_mutations_size) {
42 mutations_value = EntryKernelMutationMapToValue(mutations.Get());
43 } else {
44 mutations_value =
45 new base::StringValue(
46 base::SizeTToString(mutations_size) + " mutations");
47 }
48 dict->Set("mutations", mutations_value);
49 return dict;
50 }
51
52 } // namespace syncable
53 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/syncable/write_transaction_info.h ('k') | sync/test/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698