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

Issue 10825137: FYI: Control Data + Per-Device Metadata (Closed)

Created:
8 years, 4 months ago by rlarocque
Modified:
8 years ago
CC:
chromium-reviews, Raghu Simha, ncarter (slow), akalin, tim (not reviewing)
Visibility:
Public.

Description

This is a squashed stack of patches to split the nigori node. My current plan is to split it up into three patches: 1. Remove WITH_NIGORI/WITHOUT_NIGORI flags. 2. Implement support for "Control Data" types and make NIGORI one of these types. 3. Add the Per-Device Info type and re-enable DeviceInfo tracking. A fourth patch to support a "flags" type has yet to be written. I also need to write (or have someone on the server team write) a patch to add support for these new data types. I've posted this patch here so we can keep an eye on the big picture as we review the individual patches. BUG=122825, 111297

Patch Set 1 #

Total comments: 1

Patch Set 2 : Update + add PER_DEVICE_METADATA type #

Patch Set 3 : Add PER_USER_METADATA, refactor some encryption code #

Total comments: 20
Unified diffs Side-by-side diffs Delta from patch set Stats (+1579 lines, -880 lines) Patch
M chrome/browser/sync/glue/backend_data_type_configurer.h View 1 2 chunks +0 lines, -5 lines 0 comments Download
M chrome/browser/sync/glue/data_type_manager_impl.h View 1 3 chunks +2 lines, -8 lines 0 comments Download
M chrome/browser/sync/glue/data_type_manager_impl.cc View 1 8 chunks +10 lines, -18 lines 0 comments Download
M chrome/browser/sync/glue/data_type_manager_impl_unittest.cc View 1 7 chunks +19 lines, -21 lines 0 comments Download
M chrome/browser/sync/glue/model_association_manager.cc View 1 2 1 chunk +2 lines, -0 lines 0 comments Download
M chrome/browser/sync/glue/sync_backend_host.h View 1 2 3 chunks +7 lines, -8 lines 0 comments Download
M chrome/browser/sync/glue/sync_backend_host.cc View 1 2 8 chunks +21 lines, -33 lines 1 comment Download
M chrome/browser/sync/glue/sync_backend_host_unittest.cc View 1 2 15 chunks +27 lines, -38 lines 0 comments Download
M chrome/browser/sync/glue/sync_backend_registrar.cc View 5 chunks +14 lines, -2 lines 1 comment Download
M chrome/browser/sync/glue/sync_backend_registrar_unittest.cc View 3 chunks +4 lines, -4 lines 0 comments Download
M chrome/browser/sync/profile_sync_service.cc View 1 2 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/sync/profile_sync_service_unittest.cc View 1 2 1 chunk +0 lines, -43 lines 1 comment Download
M chrome/browser/sync/sync_prefs.cc View 1 1 chunk +2 lines, -2 lines 0 comments Download
M chrome/browser/sync/sync_prefs_unittest.cc View 1 5 chunks +18 lines, -18 lines 0 comments Download
M chrome/browser/sync/test_profile_sync_service.cc View 1 2 2 chunks +15 lines, -2 lines 1 comment Download
M chrome/browser/sync/user_selectable_sync_type.h View 1 2 1 chunk +2 lines, -0 lines 0 comments Download
A sync/engine/apply_control_data_updates.h View 1 chunk +23 lines, -0 lines 0 comments Download
A sync/engine/apply_control_data_updates.cc View 1 chunk +139 lines, -0 lines 1 comment Download
A sync/engine/apply_control_data_updates_unittest.cc View 1 2 1 chunk +329 lines, -0 lines 1 comment Download
M sync/engine/apply_updates_command.cc View 1 chunk +5 lines, -0 lines 1 comment Download
M sync/engine/apply_updates_command_unittest.cc View 10 chunks +8 lines, -350 lines 1 comment Download
M sync/engine/conflict_resolver.h View 1 chunk +0 lines, -4 lines 1 comment Download
M sync/engine/conflict_resolver.cc View 5 chunks +6 lines, -83 lines 0 comments Download
M sync/engine/model_changing_syncer_command_unittest.cc View 1 chunk +2 lines, -1 line 0 comments Download
M sync/engine/resolve_conflicts_command.cc View 1 chunk +7 lines, -1 line 0 comments Download
M sync/engine/sync_scheduler_impl.cc View 1 chunk +1 line, -0 lines 0 comments Download
M sync/engine/sync_scheduler_unittest.cc View 1 chunk +2 lines, -1 line 0 comments Download
M sync/engine/sync_scheduler_whitebox_unittest.cc View 1 1 chunk +2 lines, -1 line 0 comments Download
M sync/engine/syncer.cc View 2 chunks +4 lines, -0 lines 0 comments Download
M sync/engine/syncer_unittest.cc View 1 2 6 chunks +13 lines, -6 lines 0 comments Download
M sync/engine/syncer_util.h View 1 chunk +13 lines, -0 lines 0 comments Download
M sync/engine/syncer_util.cc View 2 chunks +33 lines, -45 lines 0 comments Download
M sync/internal_api/base_node.cc View 1 2 1 chunk +10 lines, -0 lines 0 comments Download
M sync/internal_api/public/base/model_type.h View 1 2 2 chunks +15 lines, -1 line 2 comments Download
M sync/internal_api/public/base_node.h View 1 2 2 chunks +13 lines, -3 lines 2 comments Download
A sync/internal_api/public/engine/control_model_worker.h View 1 chunk +40 lines, -0 lines 1 comment Download
A sync/internal_api/public/engine/control_model_worker.cc View 1 chunk +29 lines, -0 lines 0 comments Download
M sync/internal_api/public/engine/model_safe_worker.h View 1 chunk +2 lines, -0 lines 1 comment Download
M sync/internal_api/public/engine/model_safe_worker.cc View 1 chunk +4 lines, -2 lines 0 comments Download
M sync/internal_api/public/sync_manager.h View 1 2 1 chunk +2 lines, -14 lines 0 comments Download
M sync/internal_api/public/test/fake_sync_manager.h View 1 2 1 chunk +3 lines, -2 lines 0 comments Download
M sync/internal_api/public/write_node.h View 1 2 2 chunks +12 lines, -2 lines 0 comments Download
M sync/internal_api/sync_manager_impl.h View 1 2 2 chunks +25 lines, -15 lines 0 comments Download
M sync/internal_api/sync_manager_impl.cc View 1 2 5 chunks +73 lines, -54 lines 1 comment Download
M sync/internal_api/sync_manager_impl_unittest.cc View 1 2 14 chunks +116 lines, -39 lines 0 comments Download
M sync/internal_api/test/fake_sync_manager.cc View 1 2 1 chunk +3 lines, -2 lines 0 comments Download
M sync/internal_api/write_node.cc View 1 2 1 chunk +14 lines, -0 lines 0 comments Download
M sync/protocol/nigori_specifics.proto View 1 2 2 chunks +2 lines, -19 lines 0 comments Download
A sync/protocol/per_device_specifics.proto View 1 1 chunk +37 lines, -0 lines 1 comment Download
A sync/protocol/per_user_specifics.proto View 1 2 1 chunk +20 lines, -0 lines 0 comments Download
M sync/protocol/proto_value_conversions.h View 1 2 3 chunks +9 lines, -1 line 0 comments Download
M sync/protocol/proto_value_conversions.cc View 1 2 3 chunks +15 lines, -1 line 0 comments Download
M sync/protocol/proto_value_conversions_unittest.cc View 1 2 5 chunks +15 lines, -4 lines 0 comments Download
M sync/protocol/sync.proto View 1 2 2 chunks +9 lines, -5 lines 0 comments Download
M sync/protocol/sync_proto.gyp View 1 2 1 chunk +3 lines, -1 line 0 comments Download
M sync/sessions/sync_session.cc View 1 chunk +4 lines, -2 lines 0 comments Download
M sync/sessions/sync_session_unittest.cc View 11 chunks +24 lines, -2 lines 0 comments Download
M sync/sync.gyp View 1 2 4 chunks +7 lines, -0 lines 0 comments Download
M sync/syncable/model_type.cc View 1 2 10 chunks +61 lines, -0 lines 1 comment Download
M sync/syncable/nigori_util.cc View 1 2 1 chunk +3 lines, -1 line 1 comment Download
M sync/test/engine/syncer_command_test.h View 1 chunk +13 lines, -0 lines 0 comments Download
M sync/test/engine/syncer_command_test.cc View 2 chunks +4 lines, -0 lines 1 comment Download
A sync/test/test_entry_factory.h View 1 chunk +72 lines, -0 lines 0 comments Download
A sync/test/test_entry_factory.cc View 1 chunk +168 lines, -0 lines 0 comments Download
M sync/tools/sync_client.cc View 1 1 chunk +1 line, -1 line 0 comments Download
M sync/util/cryptographer.cc View 1 2 1 chunk +2 lines, -2 lines 0 comments Download
M sync/util/cryptographer_unittest.cc View 1 2 7 chunks +12 lines, -12 lines 0 comments Download
M sync/util/data_type_histogram.h View 1 2 1 chunk +6 lines, -0 lines 0 comments Download

Messages

Total messages: 2 (0 generated)
rlarocque
Here's a rebased version of the control data patch. I won't try to have it ...
8 years, 4 months ago (2012-08-01 20:07:20 UTC) #1
rlarocque
8 years, 4 months ago (2012-08-11 01:31:52 UTC) #2
Here's a big update.

It introduces the syncer::EncryptableTypes() concept.  Only types returned by
this function are eligible for encryption.  Some types (PER_DEVICE_METADATA and
PER_USER_METADATA) can never be encrypted.

It also introduces the PER_USER_METADATA type, though we have no flags to put in
it at the moment.

http://codereview.chromium.org/10825137/diff/5001/chrome/browser/sync/glue/sy...
File chrome/browser/sync/glue/sync_backend_host.cc (right):

http://codereview.chromium.org/10825137/diff/5001/chrome/browser/sync/glue/sy...
chrome/browser/sync/glue/sync_backend_host.cc:1319:
syncer::ModelTypeSet(syncer::ControlTypes()),
ControlTypes was intended to be a group of types that do not undergo regular
update application and conflict resolution.  All currently defined control types
are expected to be downloaded early, but there's no guarantee that will always
be the case.  Maybe I should define a separate group, the EarlyDownloadTypes(),
which are independent from the control types.

http://codereview.chromium.org/10825137/diff/5001/chrome/browser/sync/glue/sy...
File chrome/browser/sync/glue/sync_backend_registrar.cc (right):

http://codereview.chromium.org/10825137/diff/5001/chrome/browser/sync/glue/sy...
chrome/browser/sync/glue/sync_backend_registrar.cc:74:
workers_[syncer::GROUP_CONTROL] = new syncer::ControlModelWorker(sync_loop_);
There's a DCHECK in the PassiveModelWorker that prevents us from reusing it
here.

http://codereview.chromium.org/10825137/diff/5001/chrome/browser/sync/profile...
File chrome/browser/sync/profile_sync_service_unittest.cc (left):

http://codereview.chromium.org/10825137/diff/5001/chrome/browser/sync/profile...
chrome/browser/sync/profile_sync_service_unittest.cc:320:
TEST_F(ProfileSyncServiceTest, TestStartupWithOldSyncData) {
This test is not very useful anymore.  I think the tests I added when fixing the
dir corruption issue should cover this scenario.

It uses a set of flags in StartSyncServiceAndSetInitialSyncEnded that don't make
sense now that it's impossible to return from backend init without having
downloaded the nigori node and metadata.  I don't know how we could fix it.

http://codereview.chromium.org/10825137/diff/5001/chrome/browser/sync/test_pr...
File chrome/browser/sync/test_profile_sync_service.cc (right):

http://codereview.chromium.org/10825137/diff/5001/chrome/browser/sync/test_pr...
chrome/browser/sync/test_profile_sync_service.cc:127: if
(!directory->initial_sync_ended_for_type(PER_DEVICE_METADATA)) {
These if statements are probably not required...

http://codereview.chromium.org/10825137/diff/5001/sync/engine/apply_control_d...
File sync/engine/apply_control_data_updates.cc (right):

http://codereview.chromium.org/10825137/diff/5001/sync/engine/apply_control_d...
sync/engine/apply_control_data_updates.cc:30: }
TODO: Should manually apply PER_DEVICE_METADATA and PER_USER_METADATA here. 
There is no need for conflict resolution or UpdateApplicators, we just need to
overwrite the LOCAL_ fields with SERVER_ fields.

http://codereview.chromium.org/10825137/diff/5001/sync/engine/apply_control_d...
File sync/engine/apply_control_data_updates_unittest.cc (right):

http://codereview.chromium.org/10825137/diff/5001/sync/engine/apply_control_d...
sync/engine/apply_control_data_updates_unittest.cc:328: 
TODO: Test application of metadata updates.

http://codereview.chromium.org/10825137/diff/5001/sync/engine/apply_updates_c...
File sync/engine/apply_updates_command.cc (right):

http://codereview.chromium.org/10825137/diff/5001/sync/engine/apply_updates_c...
sync/engine/apply_updates_command.cc:40: // The INTERNAL types are special. 
They have their own update routines,
s/INTERNAL/CONTROL

http://codereview.chromium.org/10825137/diff/5001/sync/engine/apply_updates_c...
File sync/engine/apply_updates_command_unittest.cc (left):

http://codereview.chromium.org/10825137/diff/5001/sync/engine/apply_updates_c...
sync/engine/apply_updates_command_unittest.cc:516:
TEST_F(ApplyUpdatesCommandTest, NigoriUpdate) {
These have been moved to ApplyControlDataUpdatesTest

http://codereview.chromium.org/10825137/diff/5001/sync/engine/conflict_resolv...
File sync/engine/conflict_resolver.h (left):

http://codereview.chromium.org/10825137/diff/5001/sync/engine/conflict_resolv...
sync/engine/conflict_resolver.h:68: void
IgnoreLocalChanges(syncable::MutableEntry* entry);
Moved to syncer_util.h

http://codereview.chromium.org/10825137/diff/5001/sync/internal_api/public/ba...
File sync/internal_api/public/base/model_type.h (right):

http://codereview.chromium.org/10825137/diff/5001/sync/internal_api/public/ba...
sync/internal_api/public/base/model_type.h:87: PER_DEVICE_METADATA,
Maybe this should be named PER_CLIENT_METADATA?  Would that be more clear?

http://codereview.chromium.org/10825137/diff/5001/sync/internal_api/public/ba...
sync/internal_api/public/base/model_type.h:89: PER_USER_METADATA,
Rename to PER_ACCOUNT_METADATA?

http://codereview.chromium.org/10825137/diff/5001/sync/internal_api/public/ba...
File sync/internal_api/public/base_node.h (right):

http://codereview.chromium.org/10825137/diff/5001/sync/internal_api/public/ba...
sync/internal_api/public/base_node.h:175: // Can only be called if
GetModelType() == PER_USERMETADATA.
FIXME: typo.

http://codereview.chromium.org/10825137/diff/5001/sync/internal_api/public/ba...
sync/internal_api/public/base_node.h:176: const sync_pb::PerUserSpecifics&
GetPerUserSpecifics() const;
I'm not sure if this function is necessary.  According to the original design
doc, there's no need for a PerUserSpecifics, since it would always contain
exactly one sub-message and the caller would have to know which one it is.  It
might be easier to just expect the caller to call GetEntitySpecifics and place
all possible sub-messages directly under sync_pb::EntitySpecifics.

That might have undesirable effects on other parts of the code that expect
types' protobufs to be formatted a certain way, ie. proto_value_conversions.cc. 
Maybe it would be better to use slightly uglier protobuf definitions in order to
not disturb the existing code too much.

Server devs: any thoughts?

http://codereview.chromium.org/10825137/diff/5001/sync/internal_api/public/en...
File sync/internal_api/public/engine/control_model_worker.h (right):

http://codereview.chromium.org/10825137/diff/5001/sync/internal_api/public/en...
sync/internal_api/public/engine/control_model_worker.h:21: class SYNC_EXPORT
ControlModelWorker : public ModelSafeWorker {
This code is copy/pasted from PassiveModelWorker.  I feel sort of bad about
that.  

On the other hand, it would require much more code to define a 'BaseModelWorker'
and have both the PassiveModelWorker and ControlModelWorker inherit from it. 
This would enable us to share roughly two lines of actual code between both
classes.  It just doesn't seem worth the effort.

http://codereview.chromium.org/10825137/diff/5001/sync/internal_api/public/en...
File sync/internal_api/public/engine/model_safe_worker.h (right):

http://codereview.chromium.org/10825137/diff/5001/sync/internal_api/public/en...
sync/internal_api/public/engine/model_safe_worker.h:42: GROUP_CONTROL,       //
Models that require special handling on the sync
Are we still OK with this name?  Does anyone have a better idea?

http://codereview.chromium.org/10825137/diff/5001/sync/internal_api/sync_mana...
File sync/internal_api/sync_manager_impl.cc (right):

http://codereview.chromium.org/10825137/diff/5001/sync/internal_api/sync_mana...
sync/internal_api/sync_manager_impl.cc:515: void
SyncManagerImpl::InitialProcessMetadataContinuation(
This would be a great place to put the code that checks and sets account-global
flags.

http://codereview.chromium.org/10825137/diff/5001/sync/protocol/per_device_sp...
File sync/protocol/per_device_specifics.proto (right):

http://codereview.chromium.org/10825137/diff/5001/sync/protocol/per_device_sp...
sync/protocol/per_device_specifics.proto:35: message PerDeviceSpecifics {
Feel free to hold a bike-shed discussion about the contents of this file.

(Seriously.  This will be your last chance to recommend different names or
alternate protobuf structures.)

http://codereview.chromium.org/10825137/diff/5001/sync/syncable/model_type.cc
File sync/syncable/model_type.cc (right):

http://codereview.chromium.org/10825137/diff/5001/sync/syncable/model_type.cc...
sync/syncable/model_type.cc:260: ModelTypeSet
unencryptable_types(PER_DEVICE_METADATA, PER_USER_METADATA);
Why do these types skip encryption?

I believe these types are likely to contain information which we can't do
without.  They might contain flags which affect how we encrypt things, so it
would be bad if a 'passphrase required' state prevented us from reading them.

The justification for downloading them early is similar.

http://codereview.chromium.org/10825137/diff/5001/sync/syncable/nigori_util.cc
File sync/syncable/nigori_util.cc (right):

http://codereview.chromium.org/10825137/diff/5001/sync/syncable/nigori_util.c...
sync/syncable/nigori_util.cc:88: if (!syncer::EncryptableTypes().Has(type))
This is a new concept that I'm introducing.  We already have PASSWORDS and
NIGORI which have special encryption treatment.  I'm adding EncryptableTypes()
to make it easier to define types which we expect will never support encryption.

http://codereview.chromium.org/10825137/diff/5001/sync/test/engine/syncer_com...
File sync/test/engine/syncer_command_test.cc (right):

http://codereview.chromium.org/10825137/diff/5001/sync/test/engine/syncer_com...
sync/test/engine/syncer_command_test.cc:24: workers()->push_back( // FIXME
comment
FIXME: remove this FIXME.

Powered by Google App Engine
This is Rietveld 408576698