OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 #ifndef SYNC_UTIL_EXTENSIONS_ACTIVITY_MONITOR_H_ | 5 #ifndef SYNC_UTIL_EXTENSIONS_ACTIVITY_MONITOR_H_ |
6 #define SYNC_UTIL_EXTENSIONS_ACTIVITY_MONITOR_H_ | 6 #define SYNC_UTIL_EXTENSIONS_ACTIVITY_MONITOR_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "sync/base/sync_export.h" |
12 | 13 |
13 namespace syncer { | 14 namespace syncer { |
14 | 15 |
15 // An interface to monitor usage of extensions APIs to send to sync | 16 // An interface to monitor usage of extensions APIs to send to sync |
16 // servers, with the ability to purge data once sync servers have | 17 // servers, with the ability to purge data once sync servers have |
17 // acknowledged it (successful commit response). | 18 // acknowledged it (successful commit response). |
18 // | 19 // |
19 // All abstract methods are called from the sync thread. | 20 // All abstract methods are called from the sync thread. |
20 class ExtensionsActivityMonitor { | 21 class SYNC_EXPORT ExtensionsActivityMonitor { |
21 public: | 22 public: |
22 // A data record of activity performed by extension |extension_id|. | 23 // A data record of activity performed by extension |extension_id|. |
23 struct Record { | 24 struct SYNC_EXPORT Record { |
24 Record(); | 25 Record(); |
25 ~Record(); | 26 ~Record(); |
26 | 27 |
27 // The human-readable ID identifying the extension responsible | 28 // The human-readable ID identifying the extension responsible |
28 // for the activity reported in this Record. | 29 // for the activity reported in this Record. |
29 std::string extension_id; | 30 std::string extension_id; |
30 | 31 |
31 // How many times the extension successfully invoked a write | 32 // How many times the extension successfully invoked a write |
32 // operation through the bookmarks API since the last CommitMessage. | 33 // operation through the bookmarks API since the last CommitMessage. |
33 uint32 bookmark_write_count; | 34 uint32 bookmark_write_count; |
34 }; | 35 }; |
35 | 36 |
36 typedef std::map<std::string, Record> Records; | 37 typedef std::map<std::string, Record> Records; |
37 | 38 |
38 // Fill |buffer| with all current records and then clear the | 39 // Fill |buffer| with all current records and then clear the |
39 // internal records. | 40 // internal records. |
40 virtual void GetAndClearRecords(Records* buffer) = 0; | 41 virtual void GetAndClearRecords(Records* buffer) = 0; |
41 | 42 |
42 // Merge |records| with the current set of records, adding the | 43 // Merge |records| with the current set of records, adding the |
43 // bookmark write counts for common Records. | 44 // bookmark write counts for common Records. |
44 virtual void PutRecords(const Records& records) = 0; | 45 virtual void PutRecords(const Records& records) = 0; |
45 | 46 |
46 protected: | 47 protected: |
47 virtual ~ExtensionsActivityMonitor(); | 48 virtual ~ExtensionsActivityMonitor(); |
48 }; | 49 }; |
49 | 50 |
50 } // namespace syncer | 51 } // namespace syncer |
51 | 52 |
52 #endif // SYNC_UTIL_EXTENSIONS_ACTIVITY_MONITOR_H_ | 53 #endif // SYNC_UTIL_EXTENSIONS_ACTIVITY_MONITOR_H_ |
OLD | NEW |