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 UI_APP_LIST_SEARCH_DICTIONARY_DATA_STORE_H_ | 5 #ifndef UI_APP_LIST_SEARCH_DICTIONARY_DATA_STORE_H_ |
6 #define UI_APP_LIST_SEARCH_DICTIONARY_DATA_STORE_H_ | 6 #define UI_APP_LIST_SEARCH_DICTIONARY_DATA_STORE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 // Schedule a job to persist the cached dictionary. | 47 // Schedule a job to persist the cached dictionary. |
48 void ScheduleWrite(); | 48 void ScheduleWrite(); |
49 | 49 |
50 // Used to get a pointer to the cached dictionary. Changes to this dictionary | 50 // Used to get a pointer to the cached dictionary. Changes to this dictionary |
51 // will not be persisted unless ScheduleWrite() is called. | 51 // will not be persisted unless ScheduleWrite() is called. |
52 base::DictionaryValue* cached_dict() { return cached_dict_.get(); } | 52 base::DictionaryValue* cached_dict() { return cached_dict_.get(); } |
53 | 53 |
54 private: | 54 private: |
55 friend class base::RefCountedThreadSafe<DictionaryDataStore>; | 55 friend class base::RefCountedThreadSafe<DictionaryDataStore>; |
56 | 56 |
57 virtual ~DictionaryDataStore(); | 57 ~DictionaryDataStore() override; |
58 | 58 |
59 // Reads data from backing file. | 59 // Reads data from backing file. |
60 scoped_ptr<base::DictionaryValue> LoadOnBlockingPool(); | 60 scoped_ptr<base::DictionaryValue> LoadOnBlockingPool(); |
61 | 61 |
62 // ImportantFileWriter::DataSerializer overrides: | 62 // ImportantFileWriter::DataSerializer overrides: |
63 virtual bool SerializeData(std::string* data) override; | 63 bool SerializeData(std::string* data) override; |
64 | 64 |
65 base::FilePath data_file_; | 65 base::FilePath data_file_; |
66 scoped_refptr<base::SequencedTaskRunner> file_task_runner_; | 66 scoped_refptr<base::SequencedTaskRunner> file_task_runner_; |
67 scoped_ptr<base::ImportantFileWriter> writer_; | 67 scoped_ptr<base::ImportantFileWriter> writer_; |
68 | 68 |
69 // Cached JSON dictionary to serve read and incremental change calls. | 69 // Cached JSON dictionary to serve read and incremental change calls. |
70 scoped_ptr<base::DictionaryValue> cached_dict_; | 70 scoped_ptr<base::DictionaryValue> cached_dict_; |
71 | 71 |
72 base::SequencedWorkerPool* worker_pool_; | 72 base::SequencedWorkerPool* worker_pool_; |
73 | 73 |
74 DISALLOW_COPY_AND_ASSIGN(DictionaryDataStore); | 74 DISALLOW_COPY_AND_ASSIGN(DictionaryDataStore); |
75 }; | 75 }; |
76 | 76 |
77 } // namespace app_list | 77 } // namespace app_list |
78 | 78 |
79 #endif // UI_APP_LIST_SEARCH_DICTIONARY_DATA_STORE_H_ | 79 #endif // UI_APP_LIST_SEARCH_DICTIONARY_DATA_STORE_H_ |
OLD | NEW |