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

Side by Side Diff: components/update_client/persisted_data.h

Issue 1861383004: Add module for counting date-last-roll-call and persisting those counts (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ASAN Created 4 years, 8 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
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef COMPONENTS_UPDATE_CLIENT_PERSISTED_DATA_H_
6 #define COMPONENTS_UPDATE_CLIENT_PERSISTED_DATA_H_
7
8 #include <string>
9 #include <vector>
10
11 #include "base/macros.h"
12 #include "base/memory/ref_counted.h"
13 #include "base/threading/thread_checker.h"
14 #include "base/values.h"
15
16 class PrefRegistrySimple;
17 class PrefService;
18
19 namespace update_client {
20
21 // A PersistedData is a wrapper layer around a PrefService, designed to maintain
22 // update data that outlives the browser process and isn't exposed outside of
23 // update_client.
24 //
25 // The public methods of this class should be called only on the thread that
26 // initializes it - which also has to match the thread the PrefService has been
27 // initialized on.
28 class PersistedData : public base::RefCountedThreadSafe<PersistedData> {
29 public:
30 // Constructs a provider that uses the specified |prefService|.
31 // The associated preferences are assumed to already be registered.
32 // The prefService must outlive the entire update_client.
Bernhard Bauer 2016/04/08 09:06:09 Nit: |prefService| in pipes?
waffles 2016/04/08 19:11:01 Done.
33 PersistedData(PrefService* prefService);
Bernhard Bauer 2016/04/08 09:10:41 Also, underscore_style for variables.
waffles 2016/04/08 19:11:01 Done.
34
35 // Returns the DateLastRollCall of the specified |id|. -2 indicates that there
36 // is no record of the app.
Bernhard Bauer 2016/04/08 09:06:10 Can you explain what the value means otherwise?
waffles 2016/04/08 19:11:01 Done.
37 int DateLastRollCall(const std::string& id) const;
Bernhard Bauer 2016/04/08 09:06:09 Nit: GetDateLastRollCall(), so it doesn't sound li
waffles 2016/04/08 19:11:01 Done. (Too much Go lately, I guess.)
38
39 // Records the DateLastRollCall for the specified |ids|. |datenum| must be a
40 // non-negative integer: calls with a negative |datenum| are simply ignored.
Bernhard Bauer 2016/04/08 09:06:10 Is there a reason you ignore negative values rathe
waffles 2016/04/08 19:11:01 The value ultimately comes from the network - so w
41 // Calls to SetDateLastRollCall that occur prior to the persisted data store
42 // has been fully initialized are ignored.
43 void SetDateLastRollCall(const std::vector<std::string>& ids, int datenum);
44
45 private:
46 friend class base::RefCountedThreadSafe<PersistedData>;
47
48 ~PersistedData();
49
50 base::ThreadChecker thread_checker_;
51 PrefService* pref_service_;
52
53 DISALLOW_COPY_AND_ASSIGN(PersistedData);
54 };
55
56 // This is called only via update_client's RegisterUpdateClientPreferences.
57 void RegisterPersistedDataPreferences(PrefRegistrySimple* registry);
Bernhard Bauer 2016/04/08 09:06:10 Make this a static method on PersistedData?
waffles 2016/04/08 19:11:01 Done.
58
59 } // namespace update_client
60
61 #endif // COMPONENTS_UPDATE_CLIENT_PERSISTED_DATA_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698