Chromium Code Reviews| Index: chrome/common/indexed_db_messages.h |
| =================================================================== |
| --- chrome/common/indexed_db_messages.h (revision 73235) |
| +++ chrome/common/indexed_db_messages.h (working copy) |
| @@ -4,7 +4,7 @@ |
| #ifndef CHROME_COMMON_INDEXED_DB_MESSAGES_H_ |
| #define CHROME_COMMON_INDEXED_DB_MESSAGES_H_ |
| -#pragma once |
| +// Partially-guarded file, included multiple times, hence no #pragma once. |
| #include "chrome/common/indexed_db_key.h" |
| #include "chrome/common/indexed_db_param_traits.h" |
| @@ -13,206 +13,111 @@ |
| #include "ipc/ipc_param_traits.h" |
| #include "third_party/WebKit/Source/WebKit/chromium/public/WebExceptionCode.h" |
| +#endif // CHROME_COMMON_INDEXED_DB_MESSAGES_H_ |
| + |
| +#undef IPC_MESSAGE_START |
| #define IPC_MESSAGE_START IndexedDBMsgStart |
| +// Argument structures used in messages |
| + |
| // Used to open an indexed database. |
| -struct IndexedDBHostMsg_FactoryOpen_Params { |
| - IndexedDBHostMsg_FactoryOpen_Params(); |
| - ~IndexedDBHostMsg_FactoryOpen_Params(); |
| +#undef IPC_STRUCT_NAME |
| +#define IPC_STRUCT_NAME IndexedDBHostMsg_FactoryOpen_Params |
| +// The routing ID of the view initiating the open. |
| +IPC_STRUCT_FIRST(int32, routing_id, INIT) |
| +// The response should have this id. |
| +IPC_STRUCT_NEXT(int32, response_id, INIT) |
| +// The origin doing the initiating. |
| +IPC_STRUCT_NEXT(string16, origin, INIT) |
| +// The name of the database. |
| +IPC_STRUCT_NEXT(string16, name, INIT) |
| +// The maximum size of the database. |
| +IPC_STRUCT_LAST(uint64, maximum_size, INIT) |
| - // The routing ID of the view initiating the open. |
| - int32 routing_id; |
| - |
| - // The response should have this id. |
| - int32 response_id; |
| - |
| - // The origin doing the initiating. |
| - string16 origin; |
| - |
| - // The name of the database. |
| - string16 name; |
| - |
| - // The maximum size of the database. |
| - uint64 maximum_size; |
| -}; |
| - |
| // Used to create an object store. |
| -struct IndexedDBHostMsg_DatabaseCreateObjectStore_Params { |
| - IndexedDBHostMsg_DatabaseCreateObjectStore_Params(); |
| - ~IndexedDBHostMsg_DatabaseCreateObjectStore_Params(); |
| +#undef IPC_STRUCT_NAME |
| +#define IPC_STRUCT_NAME IndexedDBHostMsg_DatabaseCreateObjectStore_Params |
| +// The name of the object store. |
| +IPC_STRUCT_FIRST(string16, name, INIT) |
| +// The keyPath of the object store. |
| +IPC_STRUCT_NEXT(NullableString16, key_path, INIT) |
| +// Whether the object store created should have a key generator. |
| +IPC_STRUCT_NEXT(bool, auto_increment, INIT) |
| +// The transaction this is associated with. |
| +IPC_STRUCT_NEXT(int32, transaction_id, INIT) |
| +// The database the object store belongs to. |
| +IPC_STRUCT_LAST(int32, idb_database_id, INIT) |
| - // The name of the object store. |
| - string16 name; |
| - |
| - // The keyPath of the object store. |
| - NullableString16 key_path; |
| - |
| - // Whether the object store created should have a key generator. |
| - bool auto_increment; |
| - |
| - // The transaction this is associated with. |
| - int32 transaction_id; |
| - |
| - // The database the object store belongs to. |
| - int32 idb_database_id; |
| -}; |
| - |
| // Used to open both cursors and object cursors in IndexedDB. |
| -struct IndexedDBHostMsg_IndexOpenCursor_Params { |
| - IndexedDBHostMsg_IndexOpenCursor_Params(); |
| - ~IndexedDBHostMsg_IndexOpenCursor_Params(); |
| +#undef IPC_STRUCT_NAME |
| +#define IPC_STRUCT_NAME IndexedDBHostMsg_IndexOpenCursor_Params |
|
darin (slow to review)
2011/02/01 22:20:45
it might be nice to use indentation here to improv
|
| +// The response should have this id. |
| +IPC_STRUCT_FIRST(int32, response_id, INIT) |
| +// The serialized lower key. |
| +IPC_STRUCT_NEXT(IndexedDBKey, lower_key, NOINIT) |
| +// The serialized upper key. |
| +IPC_STRUCT_NEXT(IndexedDBKey, upper_key, NOINIT) |
| +// Is the lower bound open? |
| +IPC_STRUCT_NEXT(bool, lower_open, INIT) |
| +// Is the upper bound open? |
| +IPC_STRUCT_NEXT(bool, upper_open, INIT) |
| +// The direction of this cursor. |
| +IPC_STRUCT_NEXT(int32, direction, INIT) |
| +// The index the index belongs to. |
| +IPC_STRUCT_NEXT(int32, idb_index_id, INIT) |
| +// The transaction this request belongs to. |
| +IPC_STRUCT_LAST(int, transaction_id, INIT) |
| - // The response should have this id. |
| - int32 response_id; |
| - |
| - // The serialized lower key. |
| - IndexedDBKey lower_key; |
| - |
| - // The serialized upper key. |
| - IndexedDBKey upper_key; |
| - |
| - // Is the lower bound open? |
| - bool lower_open; |
| - |
| - // Is the upper bound open? |
| - bool upper_open; |
| - |
| - // The direction of this cursor. |
| - int32 direction; |
| - |
| - // The index the index belongs to. |
| - int32 idb_index_id; |
| - |
| - // The transaction this request belongs to. |
| - int transaction_id; |
| -}; |
| - |
| // Used to set a value in an object store. |
| -struct IndexedDBHostMsg_ObjectStorePut_Params { |
| - IndexedDBHostMsg_ObjectStorePut_Params(); |
| - ~IndexedDBHostMsg_ObjectStorePut_Params(); |
| +#undef IPC_STRUCT_NAME |
| +#define IPC_STRUCT_NAME IndexedDBHostMsg_ObjectStorePut_Params |
| +// The object store's id. |
| +IPC_STRUCT_FIRST(int32, idb_object_store_id, INIT) |
| +// The id any response should contain. |
| +IPC_STRUCT_NEXT(int32, response_id, INIT) |
| +// The value to set. |
| +IPC_STRUCT_NEXT(SerializedScriptValue, serialized_value, NOINIT) |
| +// The key to set it on (may not be "valid"/set in some cases). |
| +IPC_STRUCT_NEXT(IndexedDBKey, key, NOINIT) |
| +// If it already exists, don't update (just return an error). |
| +IPC_STRUCT_NEXT(bool, add_only, INIT) |
| +// The transaction it's associated with. |
| +IPC_STRUCT_LAST(int, transaction_id, INIT) |
| - // The object store's id. |
| - int32 idb_object_store_id; |
| - |
| - // The id any response should contain. |
| - int32 response_id; |
| - |
| - // The value to set. |
| - 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; |
| - |
| - // The transaction it's associated with. |
| - int transaction_id; |
| -}; |
| - |
| // Used to create an index. |
| -struct IndexedDBHostMsg_ObjectStoreCreateIndex_Params { |
| - IndexedDBHostMsg_ObjectStoreCreateIndex_Params(); |
| - ~IndexedDBHostMsg_ObjectStoreCreateIndex_Params(); |
| +#undef IPC_STRUCT_NAME |
| +#define IPC_STRUCT_NAME IndexedDBHostMsg_ObjectStoreCreateIndex_Params |
| +// The name of the index. |
| +IPC_STRUCT_FIRST(string16, name, INIT) |
| +// The keyPath of the index. |
| +IPC_STRUCT_NEXT(NullableString16, key_path, INIT) |
| +// Whether the index created has unique keys. |
| +IPC_STRUCT_NEXT(bool, unique, INIT) |
| +// The transaction this is associated with. |
| +IPC_STRUCT_NEXT(int32, transaction_id, INIT) |
| +// The object store the index belongs to. |
| +IPC_STRUCT_LAST(int32, idb_object_store_id, INIT) |
| - // The name of the index. |
| - string16 name; |
| - |
| - // The keyPath of the index. |
| - NullableString16 key_path; |
| - |
| - // Whether the index created has unique keys. |
| - bool unique; |
| - |
| - // The transaction this is associated with. |
| - int32 transaction_id; |
| - |
| - // The object store the index belongs to. |
| - int32 idb_object_store_id; |
| -}; |
| - |
| // Used to open an IndexedDB cursor. |
| -struct IndexedDBHostMsg_ObjectStoreOpenCursor_Params { |
| - IndexedDBHostMsg_ObjectStoreOpenCursor_Params(); |
| - ~IndexedDBHostMsg_ObjectStoreOpenCursor_Params(); |
| +#undef IPC_STRUCT_NAME |
| +#define IPC_STRUCT_NAME IndexedDBHostMsg_ObjectStoreOpenCursor_Params |
| +// The response should have this id. |
| +IPC_STRUCT_FIRST(int32, response_id, INIT) |
| +// The serialized lower key. |
| +IPC_STRUCT_NEXT(IndexedDBKey, lower_key, NOINIT) |
| +// The serialized upper key. |
| +IPC_STRUCT_NEXT(IndexedDBKey, upper_key, NOINIT) |
| +// Is the lower bound open? |
| +IPC_STRUCT_NEXT(bool, lower_open, INIT) |
| +// Is the upper bound open? |
| +IPC_STRUCT_NEXT(bool, upper_open, INIT) |
| +// The direction of this cursor. |
| +IPC_STRUCT_NEXT(int32, direction, INIT) |
| +// The object store the cursor belongs to. |
| +IPC_STRUCT_NEXT(int32, idb_object_store_id, INIT) |
| +// The transaction this request belongs to. |
| +IPC_STRUCT_LAST(int, transaction_id, INIT) |
| - // The response should have this id. |
| - int32 response_id; |
| - |
| - // The serialized lower key. |
| - IndexedDBKey lower_key; |
| - |
| - // The serialized upper key. |
| - IndexedDBKey upper_key; |
| - |
| - // Is the lower bound open? |
| - bool lower_open; |
| - |
| - // Is the upper bound open? |
| - bool upper_open; |
| - |
| - // The direction of this cursor. |
| - int32 direction; |
| - |
| - // The object store the cursor belongs to. |
| - 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 |
| - |
| // Indexed DB messages sent from the browser to the renderer. |
| // IDBCallback message handlers. |
| @@ -492,4 +397,3 @@ |
| IPC_MESSAGE_CONTROL1(IndexedDBHostMsg_TransactionDestroyed, |
| int32 /* idb_transaction_id */) |
| -#endif // CHROME_COMMON_INDEXED_DB_MESSAGES_H_ |