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

Unified Diff: content/browser/indexed_db/indexed_db_callbacks.h

Issue 1963293002: Replacing Indexed DB Chromium IPC with Mojo Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Refactoring after Passing URLRequestContextGetter. Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/indexed_db/indexed_db_callbacks.h
diff --git a/content/browser/indexed_db/indexed_db_callbacks.h b/content/browser/indexed_db/indexed_db_callbacks.h
index edca21931df9b909d657b866b0e2e4c2ff7dcca2..a768d3951aa7f084b17f5531bea06d09160e686d 100644
--- a/content/browser/indexed_db/indexed_db_callbacks.h
+++ b/content/browser/indexed_db/indexed_db_callbacks.h
@@ -5,141 +5,24 @@
#ifndef CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CALLBACKS_H_
#define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CALLBACKS_H_
-#include <stdint.h>
-
#include <memory>
-#include <string>
-#include <vector>
-#include "base/logging.h"
-#include "base/macros.h"
-#include "base/memory/ref_counted.h"
-#include "base/strings/string16.h"
-#include "content/browser/indexed_db/indexed_db_database_error.h"
-#include "content/browser/indexed_db/indexed_db_dispatcher_host.h"
-#include "content/common/indexed_db/indexed_db_key.h"
-#include "content/common/indexed_db/indexed_db_key_path.h"
-#include "url/origin.h"
+#include "base/callback.h"
namespace content {
-class IndexedDBBlobInfo;
+
class IndexedDBConnection;
-class IndexedDBCursor;
-class IndexedDBDatabase;
-class IndexedDBDatabaseCallbacks;
-struct IndexedDBDataLossInfo;
+class IndexedDBDatabaseError;
struct IndexedDBDatabaseMetadata;
-struct IndexedDBReturnValue;
-struct IndexedDBValue;
-
-class CONTENT_EXPORT IndexedDBCallbacks
- : public base::RefCounted<IndexedDBCallbacks> {
- public:
- // Simple payload responses
- IndexedDBCallbacks(IndexedDBDispatcherHost* dispatcher_host,
- int32_t ipc_thread_id,
- int32_t ipc_callbacks_id);
-
- // IndexedDBCursor responses
- IndexedDBCallbacks(IndexedDBDispatcherHost* dispatcher_host,
- int32_t ipc_thread_id,
- int32_t ipc_callbacks_id,
- int32_t ipc_cursor_id);
-
- // IndexedDBDatabase responses
- IndexedDBCallbacks(IndexedDBDispatcherHost* dispatcher_host,
- int32_t ipc_thread_id,
- int32_t ipc_callbacks_id,
- int32_t ipc_database_callbacks_id,
- int64_t host_transaction_id,
- const url::Origin& origin);
-
- virtual void OnError(const IndexedDBDatabaseError& error);
-
- // IndexedDBFactory::GetDatabaseNames
- virtual void OnSuccess(const std::vector<base::string16>& string);
-
- // IndexedDBFactory::Open / DeleteDatabase
- virtual void OnBlocked(int64_t existing_version);
-
- // IndexedDBFactory::Open
- virtual void OnUpgradeNeeded(
- int64_t old_version,
- std::unique_ptr<IndexedDBConnection> connection,
- const content::IndexedDBDatabaseMetadata& metadata,
- const IndexedDBDataLossInfo& data_loss_info);
- virtual void OnSuccess(std::unique_ptr<IndexedDBConnection> connection,
- const content::IndexedDBDatabaseMetadata& metadata);
-
- // IndexedDBDatabase::OpenCursor
- virtual void OnSuccess(scoped_refptr<IndexedDBCursor> cursor,
- const IndexedDBKey& key,
- const IndexedDBKey& primary_key,
- IndexedDBValue* value);
-
- // IndexedDBCursor::Continue / Advance
- virtual void OnSuccess(const IndexedDBKey& key,
- const IndexedDBKey& primary_key,
- IndexedDBValue* value);
-
- // IndexedDBCursor::PrefetchContinue
- virtual void OnSuccessWithPrefetch(
- const std::vector<IndexedDBKey>& keys,
- const std::vector<IndexedDBKey>& primary_keys,
- std::vector<IndexedDBValue>* values);
-
- // IndexedDBDatabase::Get
- // IndexedDBCursor::Advance
- virtual void OnSuccess(IndexedDBReturnValue* value);
-
- // IndexedDBDatabase::GetAll
- virtual void OnSuccessArray(std::vector<IndexedDBReturnValue>* values,
- const IndexedDBKeyPath& key_path);
-
- // IndexedDBDatabase::Put / IndexedDBCursor::Update
- virtual void OnSuccess(const IndexedDBKey& key);
-
- // IndexedDBDatabase::Count
- // IndexedDBFactory::DeleteDatabase
- // IndexedDBDatabase::DeleteRange
- virtual void OnSuccess(int64_t value);
-
- // IndexedDBCursor::Continue / Advance (when complete)
- virtual void OnSuccess();
-
- void SetConnectionOpenStartTime(const base::TimeTicks& start_time);
-
- protected:
- virtual ~IndexedDBCallbacks();
-
- private:
- void RegisterBlobsAndSend(const std::vector<IndexedDBBlobInfo>& blob_info,
- const base::Closure& callback);
-
- friend class base::RefCounted<IndexedDBCallbacks>;
-
- // Originally from IndexedDBCallbacks:
- scoped_refptr<IndexedDBDispatcherHost> dispatcher_host_;
- int32_t ipc_callbacks_id_;
- int32_t ipc_thread_id_;
-
- // IndexedDBCursor callbacks ------------------------
- int32_t ipc_cursor_id_;
-
- // IndexedDBDatabase callbacks ------------------------
- int64_t host_transaction_id_;
- url::Origin origin_;
- int32_t ipc_database_id_;
- int32_t ipc_database_callbacks_id_;
- // Used to assert that OnSuccess is only called if there was no data loss.
- blink::WebIDBDataLoss data_loss_;
+typedef base::Callback<void(std::unique_ptr<IndexedDBConnection> connection,
+ const content::IndexedDBDatabaseMetadata& metadata,
+ const content::IndexedDBDatabaseError&)>
+ OpenResultCallback;
- // The "blocked" event should be sent at most once per request.
- bool sent_blocked_;
- base::TimeTicks connection_open_start_time_;
- DISALLOW_COPY_AND_ASSIGN(IndexedDBCallbacks);
-};
+using DeleteResultCallback =
+ base::Callback<void(int64_t version,
+ const content::IndexedDBDatabaseError&)>;
} // namespace content
« no previous file with comments | « content/browser/indexed_db/indexed_db_browsertest.cc ('k') | content/browser/indexed_db/indexed_db_callbacks.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698