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

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

Issue 2605393002: Move syncer::kModelTypeInfoMap array to read-only data segment (Closed)
Patch Set: Created 3 years, 11 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 | « no previous file | no next file » | 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 "components/sync/base/model_type.h" 5 #include "components/sync/base/model_type.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/strings/string_split.h" 10 #include "base/strings/string_split.h"
(...skipping 13 matching lines...) Expand all
24 #include "components/sync/protocol/search_engine_specifics.pb.h" 24 #include "components/sync/protocol/search_engine_specifics.pb.h"
25 #include "components/sync/protocol/session_specifics.pb.h" 25 #include "components/sync/protocol/session_specifics.pb.h"
26 #include "components/sync/protocol/sync.pb.h" 26 #include "components/sync/protocol/sync.pb.h"
27 #include "components/sync/protocol/theme_specifics.pb.h" 27 #include "components/sync/protocol/theme_specifics.pb.h"
28 #include "components/sync/protocol/typed_url_specifics.pb.h" 28 #include "components/sync/protocol/typed_url_specifics.pb.h"
29 #include "components/sync/syncable/syncable_proto_util.h" 29 #include "components/sync/syncable/syncable_proto_util.h"
30 30
31 namespace syncer { 31 namespace syncer {
32 32
33 struct ModelTypeInfo { 33 struct ModelTypeInfo {
34 const ModelType model_type; 34 ModelType model_type;
35 // Model Type notification string. 35 // Model Type notification string.
36 // This needs to match the corresponding proto message name in sync.proto 36 // This needs to match the corresponding proto message name in sync.proto
37 const char* const notification_type; 37 const char* notification_type;
38 // Root tag for Model Type 38 // Root tag for Model Type
39 // This should be the same as the model type but all lowercase. 39 // This should be the same as the model type but all lowercase.
40 const char* const root_tag; 40 const char* root_tag;
41 // String value for Model Type 41 // String value for Model Type
42 // This should be the same as the model type but space separated and the 42 // This should be the same as the model type but space separated and the
43 // first letter of every word capitalized. 43 // first letter of every word capitalized.
44 const char* const model_type_string; 44 const char* model_type_string;
45 // SpecificsFieldNumber for Model Type 45 // SpecificsFieldNumber for Model Type
46 const int specifics_field_number; 46 int specifics_field_number;
47 // Histogram value should be unique for the Model Type, Existing histogram 47 // Histogram value should be unique for the Model Type, Existing histogram
48 // values should never be modified without updating "SyncModelTypes" enum in 48 // values should never be modified without updating "SyncModelTypes" enum in
49 // histograms.xml to maintain backward compatibility. 49 // histograms.xml to maintain backward compatibility.
50 const int model_type_histogram_val; 50 int model_type_histogram_val;
51 }; 51 };
52 52
53 // Below struct entries are in the same order as their definition in the 53 // Below struct entries are in the same order as their definition in the
54 // ModelType enum. Don't forget to update the ModelType enum when you make 54 // ModelType enum. Don't forget to update the ModelType enum when you make
55 // changes to this list. 55 // changes to this list.
56 // Struct field values should be unique across the entire map. 56 // Struct field values should be unique across the entire map.
57 const ModelTypeInfo kModelTypeInfoMap[] = { 57 const ModelTypeInfo kModelTypeInfoMap[] = {
58 {UNSPECIFIED, "", "", "Unspecified", -1, 0}, 58 {UNSPECIFIED, "", "", "Unspecified", -1, 0},
59 {TOP_LEVEL_FOLDER, "", "", "Top Level Folder", -1, 1}, 59 {TOP_LEVEL_FOLDER, "", "", "Top Level Folder", -1, 1},
60 {BOOKMARKS, "BOOKMARK", "bookmarks", "Bookmarks", 60 {BOOKMARKS, "BOOKMARK", "bookmarks", "Bookmarks",
(...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after
773 bool TypeSupportsHierarchy(ModelType model_type) { 773 bool TypeSupportsHierarchy(ModelType model_type) {
774 // TODO(stanisc): crbug/438313: Should this also include TOP_LEVEL_FOLDER? 774 // TODO(stanisc): crbug/438313: Should this also include TOP_LEVEL_FOLDER?
775 return model_type == BOOKMARKS; 775 return model_type == BOOKMARKS;
776 } 776 }
777 777
778 bool TypeSupportsOrdering(ModelType model_type) { 778 bool TypeSupportsOrdering(ModelType model_type) {
779 return model_type == BOOKMARKS; 779 return model_type == BOOKMARKS;
780 } 780 }
781 781
782 } // namespace syncer 782 } // namespace syncer
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698