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

Issue 2433563002: [Sync] Reimplement proto value conversions on top of field visitors. (Closed)

Created:
4 years, 2 months ago by Dmitry Skiba
Modified:
4 years, 2 months ago
Reviewers:
Nicolas Zea, pavely
CC:
chromium-reviews, sync-reviews_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

[Sync] Reimplement proto value conversions on top of field visitors. Sync component can allocate nontrivial amounts of memory, and browser memory team would like to add MemoryDumpProvider to track sync memory usage. While ~1/4 of all used memory comes from protobuf messages (see the bug), there is no easy way to get memory usage of a proto message. All we can do is to estimate on per-field basis. For that we need a way to enumerate fields of a given proto. Fortunately, proto_value_conversions.cc already has functions that go through fields for all sync protos. The only problem is that those functions (ProtoToValue) are tied to a specific purpose of generating base::DictionaryValues. This CL refactors field enumeration out of ProtoToValue functions so that next CL could use that to estimate proto memory usage. In particular, this CL: 1. Extracts field enumeration from ProtoToValue functions into VisitProtoFields(visitor, proto) function templates. 2. Implements ToValueVisitor that uses VisitProtoFields() to convert protos to base::DictionaryValues. ToValueVisitor also includes all logic from ProtoToValue functions. 3. Reimplements ProtoToValue() functions on top of ToValueVisitor. Additionally this CL renames functions that convert proto enums to strings to better play with templates. BUG=649065 Committed: https://crrev.com/05476f9a8e8c076a8752b549d14269a6eca006c1 Cr-Commit-Position: refs/heads/master@{#426655}

Patch Set 1 #

Patch Set 2 : Minor tweaks #

Patch Set 3 : Rebase #

Total comments: 2

Patch Set 4 : Address comments; fix MSVC build #

Patch Set 5 : Rebase; fix damage; regenerate test data #

Patch Set 6 : Remove temporary tests #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1362 lines, -1212 lines) Patch
M components/sync/BUILD.gn View 1 2 3 4 5 1 chunk +1 line, -0 lines 0 comments Download
M components/sync/driver/about_sync_util.cc View 1 chunk +1 line, -1 line 0 comments Download
M components/sync/engine/cycle/sync_cycle_snapshot.cc View 1 chunk +1 line, -2 lines 0 comments Download
M components/sync/engine/events/configure_get_updates_request_event.cc View 1 chunk +1 line, -1 line 0 comments Download
M components/sync/protocol/proto_enum_conversions.h View 1 2 1 chunk +22 lines, -22 lines 0 comments Download
M components/sync/protocol/proto_enum_conversions.cc View 1 2 22 chunks +22 lines, -26 lines 0 comments Download
M components/sync/protocol/proto_enum_conversions_unittest.cc View 1 2 1 chunk +13 lines, -23 lines 0 comments Download
M components/sync/protocol/proto_value_conversions.h View 1 2 3 4 7 chunks +1 line, -19 lines 0 comments Download
M components/sync/protocol/proto_value_conversions.cc View 1 2 3 4 1 chunk +287 lines, -1115 lines 0 comments Download
M components/sync/protocol/proto_value_conversions_unittest.cc View 1 2 5 chunks +70 lines, -3 lines 0 comments Download
A components/sync/protocol/proto_visitors.h View 1 2 3 4 1 chunk +943 lines, -0 lines 0 comments Download

Messages

Total messages: 24 (18 generated)
Dmitry Skiba
Guys please review. As stated there will be another CL (which will look like https://crrev.com/2382443006) ...
4 years, 2 months ago (2016-10-19 10:14:27 UTC) #9
pavely
lgtm https://codereview.chromium.org/2433563002/diff/40001/components/sync/protocol/proto_visitors.h File components/sync/protocol/proto_visitors.h (right): https://codereview.chromium.org/2433563002/diff/40001/components/sync/protocol/proto_visitors.h#newcode1 components/sync/protocol/proto_visitors.h:1: // Copyright 2016 The Chromium Authors. All rights ...
4 years, 2 months ago (2016-10-20 05:10:40 UTC) #12
Dmitry Skiba
Thanks for reviewing! I want to see all bots green, after that I'll remove temporary ...
4 years, 2 months ago (2016-10-20 18:31:19 UTC) #13
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2433563002/100001
4 years, 2 months ago (2016-10-20 22:30:44 UTC) #20
commit-bot: I haz the power
Committed patchset #6 (id:100001)
4 years, 2 months ago (2016-10-21 00:08:36 UTC) #22
commit-bot: I haz the power
4 years, 2 months ago (2016-10-21 13:24:51 UTC) #24
Message was sent while issue was closed.
Patchset 6 (id:??) landed as
https://crrev.com/05476f9a8e8c076a8752b549d14269a6eca006c1
Cr-Commit-Position: refs/heads/master@{#426655}

Powered by Google App Engine
This is Rietveld 408576698