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

Unified Diff: components/offline_pages/background/request_queue_store_sql.h

Issue 2489443002: Move all components/offline_pages/ files into component/offline_pages/core (Closed)
Patch Set: rebase Created 4 years 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 side-by-side diff with in-line comments
Download patch
Index: components/offline_pages/background/request_queue_store_sql.h
diff --git a/components/offline_pages/background/request_queue_store_sql.h b/components/offline_pages/background/request_queue_store_sql.h
deleted file mode 100644
index b733f46b274c8cebc0a5bb422e13ee911a4b5512..0000000000000000000000000000000000000000
--- a/components/offline_pages/background/request_queue_store_sql.h
+++ /dev/null
@@ -1,79 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_QUEUE_STORE_SQL_H_
-#define COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_QUEUE_STORE_SQL_H_
-
-#include <stdint.h>
-#include <memory>
-#include <vector>
-
-#include "base/files/file_path.h"
-#include "base/memory/weak_ptr.h"
-#include "components/offline_pages/background/request_queue_store.h"
-
-namespace base {
-class SequencedTaskRunner;
-}
-
-namespace sql {
-class Connection;
-}
-
-namespace offline_pages {
-
-// SQLite implementation of RequestQueueStore.
-class RequestQueueStoreSQL : public RequestQueueStore {
- public:
- RequestQueueStoreSQL(
- scoped_refptr<base::SequencedTaskRunner> background_task_runner,
- const base::FilePath& database_dir);
- ~RequestQueueStoreSQL() override;
-
- // RequestQueueStore implementation.
- void Initialize(const InitializeCallback& callback) override;
- void GetRequests(const GetRequestsCallback& callback) override;
- // Note: current implementation of this method makes a SQL query per ID. This
- // is OK as long as number of IDs stays low, which is a typical case.
- // Implementation should be revisited in case that presumption changes.
- void GetRequestsByIds(const std::vector<int64_t>& request_ids,
- const UpdateCallback& callback) override;
- void AddRequest(const SavePageRequest& offline_page,
- const AddCallback& callback) override;
- void UpdateRequests(const std::vector<SavePageRequest>& requests,
- const UpdateCallback& callback) override;
- void RemoveRequests(const std::vector<int64_t>& request_ids,
- const UpdateCallback& callback) override;
- void Reset(const ResetCallback& callback) override;
- StoreState state() const override;
-
- private:
- // Used to finalize DB connection initialization.
- void OnOpenConnectionDone(const InitializeCallback& callback, bool success);
-
- // Used to finalize DB connection reset.
- void OnResetDone(const ResetCallback& callback, bool success);
-
- // Helper function to return immediately if no database is found.
- bool CheckDb() const;
-
- // Background thread where all SQL access should be run.
- scoped_refptr<base::SequencedTaskRunner> background_task_runner_;
-
- // Path to the database on disk.
- base::FilePath db_file_path_;
-
- // Database connection.
- std::unique_ptr<sql::Connection> db_;
-
- // State of the store.
- StoreState state_;
-
- base::WeakPtrFactory<RequestQueueStoreSQL> weak_ptr_factory_;
- DISALLOW_COPY_AND_ASSIGN(RequestQueueStoreSQL);
-};
-
-} // namespace offline_pages
-
-#endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_QUEUE_STORE_SQL_H_

Powered by Google App Engine
This is Rietveld 408576698