File: shared_proto_database_client_list.h

package info (click to toggle)
chromium 120.0.6099.224-1~deb11u1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 6,112,112 kB
  • sloc: cpp: 32,907,025; ansic: 8,148,123; javascript: 3,679,536; python: 2,031,248; asm: 959,718; java: 804,675; xml: 617,256; sh: 111,417; objc: 100,835; perl: 88,443; cs: 53,032; makefile: 29,579; fortran: 24,137; php: 21,162; tcl: 21,147; sql: 20,809; ruby: 17,735; pascal: 12,864; yacc: 8,045; lisp: 3,388; lex: 1,323; ada: 727; awk: 329; jsp: 267; csh: 117; exp: 43; sed: 37
file content (114 lines) | stat: -rw-r--r-- 3,961 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef COMPONENTS_LEVELDB_PROTO_PUBLIC_SHARED_PROTO_DATABASE_CLIENT_LIST_H_
#define COMPONENTS_LEVELDB_PROTO_PUBLIC_SHARED_PROTO_DATABASE_CLIENT_LIST_H_

#include <stddef.h>

#include <string>

#include "base/component_export.h"

namespace leveldb_proto {

const char* const kFeatureEngagementName = "FeatureEngagement";

// The enum values are used to index into the shared database. Do not rearrange
// or reuse the integer values. Add new database types at the end of the enum,
// and update the string mapping in ProtoDbTypeToString(). Also update the
// variant LevelDBClient in
// //tools/metrics/histograms/metadata/leveldb_proto/histograms.xml to match the
// strings for the types.
enum class ProtoDbType {
  TEST_DATABASE0 = 0,
  TEST_DATABASE1 = 1,
  TEST_DATABASE2 = 2,
  FEATURE_ENGAGEMENT_EVENT = 3,
  FEATURE_ENGAGEMENT_AVAILABILITY = 4,
  USAGE_STATS_WEBSITE_EVENT = 5,
  USAGE_STATS_SUSPENSION = 6,
  USAGE_STATS_TOKEN_MAPPING = 7,
  DOM_DISTILLER_STORE = 8,
  DOWNLOAD_STORE = 9,
  CACHED_IMAGE_METADATA_STORE = 10,
  FEED_CONTENT_DATABASE = 11,
  FEED_JOURNAL_DATABASE = 12,
  REMOTE_SUGGESTIONS_DATABASE = 13,
  REMOTE_SUGGESTIONS_IMAGE_DATABASE = 14,
  NOTIFICATION_SCHEDULER_ICON_STORE = 15,
  NOTIFICATION_SCHEDULER_IMPRESSION_STORE = 16,
  NOTIFICATION_SCHEDULER_NOTIFICATION_STORE = 17,
  BUDGET_DATABASE = 18,
  STRIKE_DATABASE = 19,
  HINT_CACHE_STORE = 20,
  DOWNLOAD_DB = 21,
  VIDEO_DECODE_STATS_DB = 22,
  PRINT_JOB_DATABASE = 23,
  // DB is not tied to a profile, will always be unique.
  GCM_KEY_STORE = 24,
  // DB Used by shared database, will always be unique.
  SHARED_DB_METADATA = 25,
  FEED_STREAM_DATABASE = 26,
  PERSISTED_STATE_DATABASE = 27,
  UPBOARDING_QUERY_TILE_STORE = 28,
  NEARBY_SHARE_PUBLIC_CERTIFICATE_DATABASE = 29,
  VIDEO_TUTORIALS_DATABASE = 30,
  FEED_KEY_VALUE_DATABASE = 31,
  CART_DATABASE = 32,
  COMMERCE_SUBSCRIPTION_DATABASE = 33,
  MERCHANT_TRUST_SIGNAL_DATABASE = 34,
  SHARE_HISTORY_DATABASE = 35,
  SHARE_RANKING_DATABASE = 36,
  SEGMENT_INFO_DATABASE = 37,
  SIGNAL_DATABASE = 38,
  SIGNAL_STORAGE_CONFIG_DATABASE = 39,
  VIDEO_TUTORIALS_V2_DATABASE = 40,
  COUPON_DATABASE = 41,
  PAGE_ENTITY_METADATA_STORE = 42,
  WEBRTC_VIDEO_STATS_DB = 43,
  PERSISTENT_ORIGIN_TRIALS = 44,
  NEARBY_PRESENCE_LOCAL_PUBLIC_CREDENTIAL_DATABASE = 45,
  NEARBY_PRESENCE_PRIVATE_CREDENTIAL_DATABASE = 46,
  NEARBY_PRESENCE_REMOTE_PUBLIC_CREDENTIAL_DATABASE = 47,
  DISCOUNTS_DATABASE = 48,
  COMMERCE_PARCEL_TRACKING_DATABASE = 49,
  LAST,
};

// List of databases that need to keep using unique db instances. New databases
// shouldn't be here unless they have a good reason.
constexpr ProtoDbType kBlocklistedDbForSharedImpl[]{
    // DB is not tied to a profile, will always be unique.
    ProtoDbType::GCM_KEY_STORE,
    // DB Used by shared database, will always be unique.
    ProtoDbType::SHARED_DB_METADATA,
    // Marks the end of list.
    ProtoDbType::LAST,
};

// Add any obsolete databases in this list so that, if the data is no longer
// needed.
constexpr ProtoDbType kObsoleteSharedProtoDbTypeClients[] = {
    ProtoDbType::DOM_DISTILLER_STORE,
    ProtoDbType::FEED_CONTENT_DATABASE,
    ProtoDbType::FEED_JOURNAL_DATABASE,
    ProtoDbType::VIDEO_TUTORIALS_DATABASE,
    ProtoDbType::VIDEO_TUTORIALS_V2_DATABASE,
    ProtoDbType::LAST,  // Marks the end of list.
};

class COMPONENT_EXPORT(LEVELDB_PROTO) SharedProtoDatabaseClientList {
 public:
  // Determines if the given |db_type| should use a unique or shared DB.
  static bool ShouldUseSharedDB(ProtoDbType db_type);

  // Converts a ProtoDbType to a string, which is used for UMA metrics and field
  // trials.
  static std::string ProtoDbTypeToString(ProtoDbType db_type);
};

}  // namespace leveldb_proto

#endif  // COMPONENTS_LEVELDB_PROTO_PUBLIC_SHARED_PROTO_DATABASE_CLIENT_LIST_H_