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

Side by Side Diff: components/offline_pages/background/request_queue_store_sql.h

Issue 2372043002: [Offline pages] Applying TaskQueue to RequestQueue::ChangeRequestsState (Closed)
Patch Set: Addressing feedback from dougarnett Created 4 years, 2 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
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 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_OFFLINE_PAGES_BACKGROUND_REQUEST_QUEUE_STORE_SQL_H_ 5 #ifndef COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_QUEUE_STORE_SQL_H_
6 #define COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_QUEUE_STORE_SQL_H_ 6 #define COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_QUEUE_STORE_SQL_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 22 matching lines...) Expand all
33 ~RequestQueueStoreSQL() override; 33 ~RequestQueueStoreSQL() override;
34 34
35 // RequestQueueStore implementation. 35 // RequestQueueStore implementation.
36 void GetRequests(const GetRequestsCallback& callback) override; 36 void GetRequests(const GetRequestsCallback& callback) override;
37 void AddRequest(const SavePageRequest& offline_page, 37 void AddRequest(const SavePageRequest& offline_page,
38 const AddCallback& callback) override; 38 const AddCallback& callback) override;
39 void UpdateRequests(const std::vector<SavePageRequest>& requests, 39 void UpdateRequests(const std::vector<SavePageRequest>& requests,
40 const UpdateCallback& callback) override; 40 const UpdateCallback& callback) override;
41 void RemoveRequests(const std::vector<int64_t>& request_ids, 41 void RemoveRequests(const std::vector<int64_t>& request_ids,
42 const RemoveCallback& callback) override; 42 const RemoveCallback& callback) override;
43 void ChangeRequestsState(
44 const std::vector<int64_t>& request_ids,
45 const SavePageRequest::RequestState new_state,
46 const UpdateMultipleRequestsCallback& callback) override;
47 void Reset(const ResetCallback& callback) override; 43 void Reset(const ResetCallback& callback) override;
48 44
49 private: 45 private:
50 // Helper functions to return immediately if no database is found. 46 // Helper functions to return immediately if no database is found.
51 bool CheckDb(const base::Closure& callback); 47 bool CheckDb(const base::Closure& callback);
52 48
53 // Used to initialize DB connection. 49 // Used to initialize DB connection.
54 void OpenConnection(); 50 void OpenConnection();
55 void OnOpenConnectionDone(bool success); 51 void OnOpenConnectionDone(bool success);
56 52
57 // Used to finalize connection reset. 53 // Used to finalize connection reset.
58 void OnResetDone(const ResetCallback& callback, bool success); 54 void OnResetDone(const ResetCallback& callback, bool success);
59 55
60 // Background thread where all SQL access should be run. 56 // Background thread where all SQL access should be run.
61 scoped_refptr<base::SequencedTaskRunner> background_task_runner_; 57 scoped_refptr<base::SequencedTaskRunner> background_task_runner_;
62 58
63 // Path to the database on disk. 59 // Path to the database on disk.
64 base::FilePath db_file_path_; 60 base::FilePath db_file_path_;
65 61
66 // Database connection. 62 // Database connection.
67 std::unique_ptr<sql::Connection> db_; 63 std::unique_ptr<sql::Connection> db_;
68 64
69 base::WeakPtrFactory<RequestQueueStoreSQL> weak_ptr_factory_; 65 base::WeakPtrFactory<RequestQueueStoreSQL> weak_ptr_factory_;
70 DISALLOW_COPY_AND_ASSIGN(RequestQueueStoreSQL); 66 DISALLOW_COPY_AND_ASSIGN(RequestQueueStoreSQL);
71 }; 67 };
72 68
73 } // namespace offline_pages 69 } // namespace offline_pages
74 70
75 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_QUEUE_STORE_SQL_H_ 71 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_QUEUE_STORE_SQL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698