Chromium Code Reviews| Index: content/browser/indexed_db/indexed_db_database.h |
| diff --git a/content/browser/indexed_db/indexed_db_database.h b/content/browser/indexed_db/indexed_db_database.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..522150f66834754289e3956a88aa76b791bf9e95 |
| --- /dev/null |
| +++ b/content/browser/indexed_db/indexed_db_database.h |
| @@ -0,0 +1,129 @@ |
| +// Copyright (c) 2013 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 CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DATABASE_H_ |
| +#define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DATABASE_H_ |
| + |
| +#include <vector> |
| + |
| +#include "base/memory/ref_counted.h" |
| +#include "base/memory/scoped_ptr.h" |
| +#include "base/string16.h" |
| +#include "content/browser/indexed_db/indexed_db.h" |
| +#include "content/browser/indexed_db/indexed_db_database_error.h" |
| +#include "content/common/indexed_db/indexed_db_key.h" |
| +#include "content/common/indexed_db/indexed_db_key_path.h" |
| +#include "content/common/indexed_db/indexed_db_key_range.h" |
| + |
| +namespace content { |
| + |
| +class IndexedDBCallbacksWrapper; |
| +class IndexedDBDatabaseCallbacksWrapper; |
| +struct IndexedDBDatabaseMetadata; |
| + |
| +typedef int ExceptionCode; |
| + |
| +// This is implemented by IndexedDBDatabaseImpl and optionally others (in order |
| +// to proxy calls across process barriers). All calls to these classes should be |
| +// non-blocking and trigger work on a background thread if necessary. |
| +class IndexedDBDatabase : public base::RefCounted<IndexedDBDatabase> { |
| + public: |
| + virtual void CreateObjectStore(int64_t transaction_id, |
| + int64_t object_store_id, |
| + const string16& name, |
| + const IndexedDBKeyPath&, |
| + bool auto_increment) = 0; |
| + virtual void DeleteObjectStore(int64_t transaction_id, |
| + int64_t object_store_id) = 0; |
| + virtual void CreateTransaction( |
| + int64_t transaction_id, |
| + scoped_refptr<IndexedDBDatabaseCallbacksWrapper>, |
| + const std::vector<int64_t>& object_store_ids, |
| + unsigned short mode) = 0; |
| + virtual void Close(scoped_refptr<IndexedDBDatabaseCallbacksWrapper>) = 0; |
| + |
| + // Transaction-specific operations. |
| + virtual void Commit(int64_t transaction_id) = 0; |
| + virtual void Abort(int64_t transaction_id) = 0; |
| + virtual void Abort(int64_t transaction_id, |
| + scoped_refptr<IndexedDBDatabaseError>) = 0; |
| + |
| + virtual void CreateIndex(int64_t transaction_id, |
| + int64_t object_store_id, |
| + int64_t index_id, |
| + const string16& name, |
| + const IndexedDBKeyPath&, |
| + bool unique, |
| + bool multi_entry) = 0; |
| + virtual void DeleteIndex(int64_t transaction_id, |
| + int64_t object_store_id, |
| + int64_t index_id) = 0; |
| + |
| + enum TaskType { |
| + NormalTask = 0, |
|
jamesr
2013/05/21 23:56:06
SHOUTY
jsbell
2013/05/22 17:54:44
Done.
|
| + PreemptiveTask |
| + }; |
| + |
| + enum PutMode { |
| + AddOrUpdate, |
| + AddOnly, |
| + CursorUpdate |
| + }; |
| + |
| + static const int64_t MinimumIndexId = 30; |
| + |
| + typedef std::vector<IndexedDBKey> IndexKeys; |
| + |
| + virtual void Get(int64_t transaction_id, |
| + int64_t object_store_id, |
| + int64_t index_id, |
| + scoped_ptr<IndexedDBKeyRange>, |
| + bool key_only, |
| + scoped_refptr<IndexedDBCallbacksWrapper>) = 0; |
| + // This will swap() with value. |
| + virtual void Put(int64_t transaction_id, |
| + int64_t object_store_id, |
| + std::vector<char>* value, |
| + scoped_ptr<IndexedDBKey>, |
| + PutMode, |
| + scoped_refptr<IndexedDBCallbacksWrapper>, |
| + const std::vector<int64_t>& index_ids, |
| + const std::vector<IndexKeys>&) = 0; |
| + virtual void SetIndexKeys(int64_t transaction_id, |
| + int64_t object_store_id, |
| + scoped_ptr<IndexedDBKey> primary_key, |
| + const std::vector<int64_t>& index_ids, |
| + const std::vector<IndexKeys>&) = 0; |
| + virtual void SetIndexesReady(int64_t transaction_id, |
| + int64_t object_store_id, |
| + const std::vector<int64_t>& index_ids) = 0; |
| + virtual void OpenCursor(int64_t transaction_id, |
| + int64_t object_store_id, |
| + int64_t index_id, |
| + scoped_ptr<IndexedDBKeyRange>, |
| + IndexedDB::CursorDirection, |
| + bool key_only, |
| + TaskType, |
| + scoped_refptr<IndexedDBCallbacksWrapper>) = 0; |
| + virtual void Count(int64_t transaction_id, |
| + int64_t object_store_id, |
| + int64_t index_id, |
| + scoped_ptr<IndexedDBKeyRange>, |
| + scoped_refptr<IndexedDBCallbacksWrapper>) = 0; |
| + virtual void DeleteRange(int64_t transaction_id, |
| + int64_t object_store_id, |
| + scoped_ptr<IndexedDBKeyRange>, |
| + scoped_refptr<IndexedDBCallbacksWrapper>) = 0; |
| + virtual void Clear(int64_t transaction_id, |
| + int64_t object_store_id, |
| + scoped_refptr<IndexedDBCallbacksWrapper>) = 0; |
| + |
| + protected: |
| + virtual ~IndexedDBDatabase() {} |
| + friend class base::RefCounted<IndexedDBDatabase>; |
| +}; |
| + |
| +} // namespace content |
| + |
| +#endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DATABASE_H_ |