| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 COMPONENTS_SYNC_BASE_EXTENSIONS_ACTIVITY_H_ | 5 #ifndef COMPONENTS_SYNC_BASE_EXTENSIONS_ACTIVITY_H_ |
| 6 #define COMPONENTS_SYNC_BASE_EXTENSIONS_ACTIVITY_H_ | 6 #define COMPONENTS_SYNC_BASE_EXTENSIONS_ACTIVITY_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 | 28 |
| 29 // The human-readable ID identifying the extension responsible | 29 // The human-readable ID identifying the extension responsible |
| 30 // for the activity reported in this Record. | 30 // for the activity reported in this Record. |
| 31 std::string extension_id; | 31 std::string extension_id; |
| 32 | 32 |
| 33 // How many times the extension successfully invoked a write | 33 // How many times the extension successfully invoked a write |
| 34 // operation through the bookmarks API since the last CommitMessage. | 34 // operation through the bookmarks API since the last CommitMessage. |
| 35 uint32_t bookmark_write_count; | 35 uint32_t bookmark_write_count; |
| 36 }; | 36 }; |
| 37 | 37 |
| 38 typedef std::map<std::string, Record> Records; | 38 using Records = std::map<std::string, Record>; |
| 39 | 39 |
| 40 ExtensionsActivity(); | 40 ExtensionsActivity(); |
| 41 | 41 |
| 42 // Fill |buffer| with all current records and then clear the | 42 // Fill |buffer| with all current records and then clear the |
| 43 // internal records. Called on sync thread to append records to sync commit | 43 // internal records. Called on sync thread to append records to sync commit |
| 44 // message. | 44 // message. |
| 45 void GetAndClearRecords(Records* buffer); | 45 void GetAndClearRecords(Records* buffer); |
| 46 | 46 |
| 47 // Merge |records| with the current set of records. Called on sync thread to | 47 // Merge |records| with the current set of records. Called on sync thread to |
| 48 // put back records if sync commit failed. | 48 // put back records if sync commit failed. |
| 49 void PutRecords(const Records& records); | 49 void PutRecords(const Records& records); |
| 50 | 50 |
| 51 // Increment write count of the specified extension. | 51 // Increment write count of the specified extension. |
| 52 void UpdateRecord(const std::string& extension_id); | 52 void UpdateRecord(const std::string& extension_id); |
| 53 | 53 |
| 54 private: | 54 private: |
| 55 friend class base::RefCountedThreadSafe<ExtensionsActivity>; | 55 friend class base::RefCountedThreadSafe<ExtensionsActivity>; |
| 56 ~ExtensionsActivity(); | 56 ~ExtensionsActivity(); |
| 57 | 57 |
| 58 Records records_; | 58 Records records_; |
| 59 mutable base::Lock records_lock_; | 59 mutable base::Lock records_lock_; |
| 60 }; | 60 }; |
| 61 | 61 |
| 62 } // namespace syncer | 62 } // namespace syncer |
| 63 | 63 |
| 64 #endif // COMPONENTS_SYNC_BASE_EXTENSIONS_ACTIVITY_H_ | 64 #endif // COMPONENTS_SYNC_BASE_EXTENSIONS_ACTIVITY_H_ |
| OLD | NEW |