diff options
Diffstat (limited to 'chrome/common/indexed_db_messages.h')
-rw-r--r-- | chrome/common/indexed_db_messages.h | 233 |
1 files changed, 76 insertions, 157 deletions
diff --git a/chrome/common/indexed_db_messages.h b/chrome/common/indexed_db_messages.h index 8eb77eb..4203f61 100644 --- a/chrome/common/indexed_db_messages.h +++ b/chrome/common/indexed_db_messages.h @@ -2,222 +2,125 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_COMMON_INDEXED_DB_MESSAGES_H_ -#define CHROME_COMMON_INDEXED_DB_MESSAGES_H_ -#pragma once +// Message definition file, included multiple times, hence no include guard. + +#include <vector> #include "chrome/common/indexed_db_key.h" #include "chrome/common/indexed_db_param_traits.h" #include "chrome/common/serialized_script_value.h" #include "ipc/ipc_message_macros.h" #include "ipc/ipc_param_traits.h" -#include "third_party/WebKit/WebKit/chromium/public/WebExceptionCode.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebExceptionCode.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBObjectStore.h" #define IPC_MESSAGE_START IndexedDBMsgStart -// Used to open an indexed database. -struct IndexedDBHostMsg_FactoryOpen_Params { - IndexedDBHostMsg_FactoryOpen_Params(); - ~IndexedDBHostMsg_FactoryOpen_Params(); +// Argument structures used in messages - // The routing ID of the view initiating the open. - int32 routing_id; +IPC_ENUM_TRAITS(WebKit::WebIDBObjectStore::PutMode) +// Used to open an indexed database. +IPC_STRUCT_BEGIN(IndexedDBHostMsg_FactoryOpen_Params) + // The routing ID of the view initiating the open. + IPC_STRUCT_MEMBER(int32, routing_id) // The response should have this id. - int32 response_id; - + IPC_STRUCT_MEMBER(int32, response_id) // The origin doing the initiating. - string16 origin; - + IPC_STRUCT_MEMBER(string16, origin) // The name of the database. - string16 name; - + IPC_STRUCT_MEMBER(string16, name) // The maximum size of the database. - uint64 maximum_size; -}; + IPC_STRUCT_MEMBER(uint64, maximum_size) +IPC_STRUCT_END() // Used to create an object store. -struct IndexedDBHostMsg_DatabaseCreateObjectStore_Params { - IndexedDBHostMsg_DatabaseCreateObjectStore_Params(); - ~IndexedDBHostMsg_DatabaseCreateObjectStore_Params(); - +IPC_STRUCT_BEGIN(IndexedDBHostMsg_DatabaseCreateObjectStore_Params) // The name of the object store. - string16 name; - + IPC_STRUCT_MEMBER(string16, name) // The keyPath of the object store. - NullableString16 key_path; - + IPC_STRUCT_MEMBER(NullableString16, key_path) // Whether the object store created should have a key generator. - bool auto_increment; - + IPC_STRUCT_MEMBER(bool, auto_increment) // The transaction this is associated with. - int32 transaction_id; - + IPC_STRUCT_MEMBER(int32, transaction_id) // The database the object store belongs to. - int32 idb_database_id; -}; + IPC_STRUCT_MEMBER(int32, idb_database_id) +IPC_STRUCT_END() // Used to open both cursors and object cursors in IndexedDB. -struct IndexedDBHostMsg_IndexOpenCursor_Params { - IndexedDBHostMsg_IndexOpenCursor_Params(); - ~IndexedDBHostMsg_IndexOpenCursor_Params(); - +IPC_STRUCT_BEGIN(IndexedDBHostMsg_IndexOpenCursor_Params) // The response should have this id. - int32 response_id; - + IPC_STRUCT_MEMBER(int32, response_id) // The serialized lower key. - IndexedDBKey lower_key; - + IPC_STRUCT_MEMBER(IndexedDBKey, lower_key) // The serialized upper key. - IndexedDBKey upper_key; - + IPC_STRUCT_MEMBER(IndexedDBKey, upper_key) // Is the lower bound open? - bool lower_open; - + IPC_STRUCT_MEMBER(bool, lower_open) // Is the upper bound open? - bool upper_open; - + IPC_STRUCT_MEMBER(bool, upper_open) // The direction of this cursor. - int32 direction; - + IPC_STRUCT_MEMBER(int32, direction) // The index the index belongs to. - int32 idb_index_id; - + IPC_STRUCT_MEMBER(int32, idb_index_id) // The transaction this request belongs to. - int transaction_id; -}; + IPC_STRUCT_MEMBER(int, transaction_id) +IPC_STRUCT_END() // Used to set a value in an object store. -struct IndexedDBHostMsg_ObjectStorePut_Params { - IndexedDBHostMsg_ObjectStorePut_Params(); - ~IndexedDBHostMsg_ObjectStorePut_Params(); - +IPC_STRUCT_BEGIN(IndexedDBHostMsg_ObjectStorePut_Params) // The object store's id. - int32 idb_object_store_id; - + IPC_STRUCT_MEMBER(int32, idb_object_store_id) // The id any response should contain. - int32 response_id; - + IPC_STRUCT_MEMBER(int32, response_id) // The value to set. - SerializedScriptValue serialized_value; - + IPC_STRUCT_MEMBER(SerializedScriptValue, serialized_value) // The key to set it on (may not be "valid"/set in some cases). - IndexedDBKey key; - - // If it already exists, don't update (just return an error). - bool add_only; - + IPC_STRUCT_MEMBER(IndexedDBKey, key) + // Whether this is an add or a put. + IPC_STRUCT_MEMBER(WebKit::WebIDBObjectStore::PutMode, put_mode) // The transaction it's associated with. - int transaction_id; -}; + IPC_STRUCT_MEMBER(int, transaction_id) +IPC_STRUCT_END() // Used to create an index. -struct IndexedDBHostMsg_ObjectStoreCreateIndex_Params { - IndexedDBHostMsg_ObjectStoreCreateIndex_Params(); - ~IndexedDBHostMsg_ObjectStoreCreateIndex_Params(); - +IPC_STRUCT_BEGIN(IndexedDBHostMsg_ObjectStoreCreateIndex_Params) // The name of the index. - string16 name; - + IPC_STRUCT_MEMBER(string16, name) // The keyPath of the index. - NullableString16 key_path; - + IPC_STRUCT_MEMBER(NullableString16, key_path) // Whether the index created has unique keys. - bool unique; - + IPC_STRUCT_MEMBER(bool, unique) // The transaction this is associated with. - int32 transaction_id; - + IPC_STRUCT_MEMBER(int32, transaction_id) // The object store the index belongs to. - int32 idb_object_store_id; -}; + IPC_STRUCT_MEMBER(int32, idb_object_store_id) +IPC_STRUCT_END() // Used to open an IndexedDB cursor. -struct IndexedDBHostMsg_ObjectStoreOpenCursor_Params { - IndexedDBHostMsg_ObjectStoreOpenCursor_Params(); - ~IndexedDBHostMsg_ObjectStoreOpenCursor_Params(); - +IPC_STRUCT_BEGIN(IndexedDBHostMsg_ObjectStoreOpenCursor_Params) // The response should have this id. - int32 response_id; - + IPC_STRUCT_MEMBER(int32, response_id) // The serialized lower key. - IndexedDBKey lower_key; - + IPC_STRUCT_MEMBER(IndexedDBKey, lower_key) // The serialized upper key. - IndexedDBKey upper_key; - + IPC_STRUCT_MEMBER(IndexedDBKey, upper_key) // Is the lower bound open? - bool lower_open; - + IPC_STRUCT_MEMBER(bool, lower_open) // Is the upper bound open? - bool upper_open; - + IPC_STRUCT_MEMBER(bool, upper_open) // The direction of this cursor. - int32 direction; - + IPC_STRUCT_MEMBER(int32, direction) // The object store the cursor belongs to. - int32 idb_object_store_id; - + IPC_STRUCT_MEMBER(int32, idb_object_store_id) // The transaction this request belongs to. - int transaction_id; -}; - -namespace IPC { -template <> -struct ParamTraits<IndexedDBHostMsg_FactoryOpen_Params> { - typedef IndexedDBHostMsg_FactoryOpen_Params param_type; - static void Write(Message* m, const param_type& p); - static bool Read(const Message* m, void** iter, param_type* p); - static void Log(const param_type& p, std::string* l); -}; - -template <> -struct ParamTraits<IndexedDBHostMsg_DatabaseCreateObjectStore_Params> { - typedef IndexedDBHostMsg_DatabaseCreateObjectStore_Params param_type; - static void Write(Message* m, const param_type& p); - static bool Read(const Message* m, void** iter, param_type* p); - static void Log(const param_type& p, std::string* l); -}; - -template <> -struct ParamTraits<IndexedDBHostMsg_IndexOpenCursor_Params> { - typedef IndexedDBHostMsg_IndexOpenCursor_Params param_type; - static void Write(Message* m, const param_type& p); - static bool Read(const Message* m, void** iter, param_type* p); - static void Log(const param_type& p, std::string* l); -}; - -template <> -struct ParamTraits<IndexedDBHostMsg_ObjectStorePut_Params> { - typedef IndexedDBHostMsg_ObjectStorePut_Params param_type; - static void Write(Message* m, const param_type& p); - static bool Read(const Message* m, void** iter, param_type* p); - static void Log(const param_type& p, std::string* l); -}; - -template <> -struct ParamTraits<IndexedDBHostMsg_ObjectStoreCreateIndex_Params> { - typedef IndexedDBHostMsg_ObjectStoreCreateIndex_Params param_type; - static void Write(Message* m, const param_type& p); - static bool Read(const Message* m, void** iter, param_type* p); - static void Log(const param_type& p, std::string* l); -}; - -template <> -struct ParamTraits<IndexedDBHostMsg_ObjectStoreOpenCursor_Params> { - typedef IndexedDBHostMsg_ObjectStoreOpenCursor_Params param_type; - static void Write(Message* m, const param_type& p); - static bool Read(const Message* m, void** iter, param_type* p); - static void Log(const param_type& p, std::string* l); -}; - -} // namespace IPC + IPC_STRUCT_MEMBER(int, transaction_id) +IPC_STRUCT_END() // Indexed DB messages sent from the browser to the renderer. // IDBCallback message handlers. -IPC_MESSAGE_CONTROL1(IndexedDBMsg_CallbacksSuccessNull, - int32 /* response_id */) IPC_MESSAGE_CONTROL2(IndexedDBMsg_CallbacksSuccessIDBCursor, int32 /* response_id */, int32 /* cursor_id */) @@ -243,6 +146,8 @@ IPC_MESSAGE_CONTROL3(IndexedDBMsg_CallbacksError, int32 /* response_id */, int /* code */, string16 /* message */) +IPC_MESSAGE_CONTROL1(IndexedDBMsg_CallbacksBlocked, + int32 /* response_id */) // IDBTransactionCallback message handlers. IPC_MESSAGE_CONTROL1(IndexedDBMsg_TransactionCallbacksAbort, @@ -343,6 +248,14 @@ IPC_SYNC_MESSAGE_CONTROL4_2(IndexedDBHostMsg_DatabaseTransaction, int32, /* idb_transaction_id */ WebKit::WebExceptionCode /* ec */) +// WebIDBDatabase::close() message. +IPC_MESSAGE_CONTROL1(IndexedDBHostMsg_DatabaseOpen, + int32 /* idb_database_id */) + +// WebIDBDatabase::close() message. +IPC_MESSAGE_CONTROL1(IndexedDBHostMsg_DatabaseClose, + int32 /* idb_database_id */) + // WebIDBDatabase::~WebIDBDatabase() message. IPC_MESSAGE_CONTROL1(IndexedDBHostMsg_DatabaseDestroyed, int32 /* idb_database_id */) @@ -433,6 +346,13 @@ IPC_SYNC_MESSAGE_CONTROL4_1(IndexedDBHostMsg_ObjectStoreDelete, int32, /* transaction_id */ WebKit::WebExceptionCode /* ec */) +// WebIDBObjectStore::clear() message. +IPC_SYNC_MESSAGE_CONTROL3_1(IndexedDBHostMsg_ObjectStoreClear, + int32, /* idb_object_store_id */ + int32, /* response_id */ + int32, /* transaction_id */ + WebKit::WebExceptionCode /* ec */) + // WebIDBObjectStore::createIndex() message. IPC_SYNC_MESSAGE_CONTROL1_2(IndexedDBHostMsg_ObjectStoreCreateIndex, IndexedDBHostMsg_ObjectStoreCreateIndex_Params, @@ -490,4 +410,3 @@ IPC_MESSAGE_CONTROL1(IndexedDBHostMsg_TransactionDidCompleteTaskEvents, IPC_MESSAGE_CONTROL1(IndexedDBHostMsg_TransactionDestroyed, int32 /* idb_transaction_id */) -#endif // CHROME_COMMON_INDEXED_DB_MESSAGES_H_ |