Commit 98d8ce92 authored by vitaliii's avatar vitaliii Committed by Commit Bot

[Sync] Add static_assert for new model types in EntitySpecifics visitor.

Add a static_assert, which fails wen a new protocol type is added, to
EntitySpecifics visitor, so that people don't forget to update this
visitor. That's precisely what I did when I was adding a new type and it
took me couple of hours of debugging to understood what was wrong.

Change-Id: Idd35e143b1fcbda089de3552ac07b9754e344235
Reviewed-on: https://chromium-review.googlesource.com/1054010
Commit-Queue: vitaliii <vitaliii@chromium.org>
Reviewed-by: default avatarMarc Treib <treib@chromium.org>
Cr-Commit-Position: refs/heads/master@{#557830}
parent 1abedab6
......@@ -5,6 +5,7 @@
#ifndef COMPONENTS_SYNC_PROTOCOL_PROTO_VISITORS_H_
#define COMPONENTS_SYNC_PROTOCOL_PROTO_VISITORS_H_
#include "components/sync/base/model_type.h"
#include "components/sync/protocol/app_list_specifics.pb.h"
#include "components/sync/protocol/app_notification_specifics.pb.h"
#include "components/sync/protocol/app_setting_specifics.pb.h"
......@@ -362,6 +363,9 @@ VISIT_PROTO_FIELDS(const sync_pb::EntityMetadata& proto) {
}
VISIT_PROTO_FIELDS(const sync_pb::EntitySpecifics& proto) {
static_assert(40 == MODEL_TYPE_COUNT,
"When adding a new protocol type, you will likely need to add "
"it here as well.");
VISIT(encrypted);
VISIT(app);
VISIT(app_list);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment