Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_COMMON_INDEXED_DB_MESSAGES_H_ | 5 #ifndef CHROME_COMMON_INDEXED_DB_MESSAGES_H_ |
| 6 #define CHROME_COMMON_INDEXED_DB_MESSAGES_H_ | 6 #define CHROME_COMMON_INDEXED_DB_MESSAGES_H_ |
| 7 #pragma once | 7 // Partially-guarded file, included multiple times, hence no #pragma once. |
| 8 | 8 |
| 9 #include "chrome/common/indexed_db_key.h" | 9 #include "chrome/common/indexed_db_key.h" |
| 10 #include "chrome/common/indexed_db_param_traits.h" | 10 #include "chrome/common/indexed_db_param_traits.h" |
| 11 #include "chrome/common/serialized_script_value.h" | 11 #include "chrome/common/serialized_script_value.h" |
| 12 #include "ipc/ipc_message_macros.h" | 12 #include "ipc/ipc_message_macros.h" |
| 13 #include "ipc/ipc_param_traits.h" | 13 #include "ipc/ipc_param_traits.h" |
| 14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebExceptionCode.h" | 14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebExceptionCode.h" |
| 15 | 15 |
| 16 #endif // CHROME_COMMON_INDEXED_DB_MESSAGES_H_ | |
| 17 | |
| 18 #undef IPC_MESSAGE_START | |
| 16 #define IPC_MESSAGE_START IndexedDBMsgStart | 19 #define IPC_MESSAGE_START IndexedDBMsgStart |
| 17 | 20 |
| 21 // Argument structures used in messages | |
| 22 | |
| 18 // Used to open an indexed database. | 23 // Used to open an indexed database. |
| 19 struct IndexedDBHostMsg_FactoryOpen_Params { | 24 #undef IPC_STRUCT_NAME |
| 20 IndexedDBHostMsg_FactoryOpen_Params(); | 25 #define IPC_STRUCT_NAME IndexedDBHostMsg_FactoryOpen_Params |
| 21 ~IndexedDBHostMsg_FactoryOpen_Params(); | 26 // The routing ID of the view initiating the open. |
| 22 | 27 IPC_STRUCT_FIRST(int32, routing_id, INIT) |
| 23 // The routing ID of the view initiating the open. | 28 // The response should have this id. |
| 24 int32 routing_id; | 29 IPC_STRUCT_NEXT(int32, response_id, INIT) |
| 25 | 30 // The origin doing the initiating. |
| 26 // The response should have this id. | 31 IPC_STRUCT_NEXT(string16, origin, INIT) |
| 27 int32 response_id; | 32 // The name of the database. |
| 28 | 33 IPC_STRUCT_NEXT(string16, name, INIT) |
| 29 // The origin doing the initiating. | 34 // The maximum size of the database. |
| 30 string16 origin; | 35 IPC_STRUCT_LAST(uint64, maximum_size, INIT) |
| 31 | |
| 32 // The name of the database. | |
| 33 string16 name; | |
| 34 | |
| 35 // The maximum size of the database. | |
| 36 uint64 maximum_size; | |
| 37 }; | |
| 38 | 36 |
| 39 // Used to create an object store. | 37 // Used to create an object store. |
| 40 struct IndexedDBHostMsg_DatabaseCreateObjectStore_Params { | 38 #undef IPC_STRUCT_NAME |
| 41 IndexedDBHostMsg_DatabaseCreateObjectStore_Params(); | 39 #define IPC_STRUCT_NAME IndexedDBHostMsg_DatabaseCreateObjectStore_Params |
| 42 ~IndexedDBHostMsg_DatabaseCreateObjectStore_Params(); | 40 // The name of the object store. |
| 43 | 41 IPC_STRUCT_FIRST(string16, name, INIT) |
| 44 // The name of the object store. | 42 // The keyPath of the object store. |
| 45 string16 name; | 43 IPC_STRUCT_NEXT(NullableString16, key_path, INIT) |
| 46 | 44 // Whether the object store created should have a key generator. |
| 47 // The keyPath of the object store. | 45 IPC_STRUCT_NEXT(bool, auto_increment, INIT) |
| 48 NullableString16 key_path; | 46 // The transaction this is associated with. |
| 49 | 47 IPC_STRUCT_NEXT(int32, transaction_id, INIT) |
| 50 // Whether the object store created should have a key generator. | 48 // The database the object store belongs to. |
| 51 bool auto_increment; | 49 IPC_STRUCT_LAST(int32, idb_database_id, INIT) |
| 52 | |
| 53 // The transaction this is associated with. | |
| 54 int32 transaction_id; | |
| 55 | |
| 56 // The database the object store belongs to. | |
| 57 int32 idb_database_id; | |
| 58 }; | |
| 59 | 50 |
| 60 // Used to open both cursors and object cursors in IndexedDB. | 51 // Used to open both cursors and object cursors in IndexedDB. |
| 61 struct IndexedDBHostMsg_IndexOpenCursor_Params { | 52 #undef IPC_STRUCT_NAME |
| 62 IndexedDBHostMsg_IndexOpenCursor_Params(); | 53 #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
| |
| 63 ~IndexedDBHostMsg_IndexOpenCursor_Params(); | 54 // The response should have this id. |
| 64 | 55 IPC_STRUCT_FIRST(int32, response_id, INIT) |
| 65 // The response should have this id. | 56 // The serialized lower key. |
| 66 int32 response_id; | 57 IPC_STRUCT_NEXT(IndexedDBKey, lower_key, NOINIT) |
| 67 | 58 // The serialized upper key. |
| 68 // The serialized lower key. | 59 IPC_STRUCT_NEXT(IndexedDBKey, upper_key, NOINIT) |
| 69 IndexedDBKey lower_key; | 60 // Is the lower bound open? |
| 70 | 61 IPC_STRUCT_NEXT(bool, lower_open, INIT) |
| 71 // The serialized upper key. | 62 // Is the upper bound open? |
| 72 IndexedDBKey upper_key; | 63 IPC_STRUCT_NEXT(bool, upper_open, INIT) |
| 73 | 64 // The direction of this cursor. |
| 74 // Is the lower bound open? | 65 IPC_STRUCT_NEXT(int32, direction, INIT) |
| 75 bool lower_open; | 66 // The index the index belongs to. |
| 76 | 67 IPC_STRUCT_NEXT(int32, idb_index_id, INIT) |
| 77 // Is the upper bound open? | 68 // The transaction this request belongs to. |
| 78 bool upper_open; | 69 IPC_STRUCT_LAST(int, transaction_id, INIT) |
| 79 | |
| 80 // The direction of this cursor. | |
| 81 int32 direction; | |
| 82 | |
| 83 // The index the index belongs to. | |
| 84 int32 idb_index_id; | |
| 85 | |
| 86 // The transaction this request belongs to. | |
| 87 int transaction_id; | |
| 88 }; | |
| 89 | 70 |
| 90 // Used to set a value in an object store. | 71 // Used to set a value in an object store. |
| 91 struct IndexedDBHostMsg_ObjectStorePut_Params { | 72 #undef IPC_STRUCT_NAME |
| 92 IndexedDBHostMsg_ObjectStorePut_Params(); | 73 #define IPC_STRUCT_NAME IndexedDBHostMsg_ObjectStorePut_Params |
| 93 ~IndexedDBHostMsg_ObjectStorePut_Params(); | 74 // The object store's id. |
| 94 | 75 IPC_STRUCT_FIRST(int32, idb_object_store_id, INIT) |
| 95 // The object store's id. | 76 // The id any response should contain. |
| 96 int32 idb_object_store_id; | 77 IPC_STRUCT_NEXT(int32, response_id, INIT) |
| 97 | 78 // The value to set. |
| 98 // The id any response should contain. | 79 IPC_STRUCT_NEXT(SerializedScriptValue, serialized_value, NOINIT) |
| 99 int32 response_id; | 80 // The key to set it on (may not be "valid"/set in some cases). |
| 100 | 81 IPC_STRUCT_NEXT(IndexedDBKey, key, NOINIT) |
| 101 // The value to set. | 82 // If it already exists, don't update (just return an error). |
| 102 SerializedScriptValue serialized_value; | 83 IPC_STRUCT_NEXT(bool, add_only, INIT) |
| 103 | 84 // The transaction it's associated with. |
| 104 // The key to set it on (may not be "valid"/set in some cases). | 85 IPC_STRUCT_LAST(int, transaction_id, INIT) |
| 105 IndexedDBKey key; | |
| 106 | |
| 107 // If it already exists, don't update (just return an error). | |
| 108 bool add_only; | |
| 109 | |
| 110 // The transaction it's associated with. | |
| 111 int transaction_id; | |
| 112 }; | |
| 113 | 86 |
| 114 // Used to create an index. | 87 // Used to create an index. |
| 115 struct IndexedDBHostMsg_ObjectStoreCreateIndex_Params { | 88 #undef IPC_STRUCT_NAME |
| 116 IndexedDBHostMsg_ObjectStoreCreateIndex_Params(); | 89 #define IPC_STRUCT_NAME IndexedDBHostMsg_ObjectStoreCreateIndex_Params |
| 117 ~IndexedDBHostMsg_ObjectStoreCreateIndex_Params(); | 90 // The name of the index. |
| 118 | 91 IPC_STRUCT_FIRST(string16, name, INIT) |
| 119 // The name of the index. | 92 // The keyPath of the index. |
| 120 string16 name; | 93 IPC_STRUCT_NEXT(NullableString16, key_path, INIT) |
| 121 | 94 // Whether the index created has unique keys. |
| 122 // The keyPath of the index. | 95 IPC_STRUCT_NEXT(bool, unique, INIT) |
| 123 NullableString16 key_path; | 96 // The transaction this is associated with. |
| 124 | 97 IPC_STRUCT_NEXT(int32, transaction_id, INIT) |
| 125 // Whether the index created has unique keys. | 98 // The object store the index belongs to. |
| 126 bool unique; | 99 IPC_STRUCT_LAST(int32, idb_object_store_id, INIT) |
| 127 | |
| 128 // The transaction this is associated with. | |
| 129 int32 transaction_id; | |
| 130 | |
| 131 // The object store the index belongs to. | |
| 132 int32 idb_object_store_id; | |
| 133 }; | |
| 134 | 100 |
| 135 // Used to open an IndexedDB cursor. | 101 // Used to open an IndexedDB cursor. |
| 136 struct IndexedDBHostMsg_ObjectStoreOpenCursor_Params { | 102 #undef IPC_STRUCT_NAME |
| 137 IndexedDBHostMsg_ObjectStoreOpenCursor_Params(); | 103 #define IPC_STRUCT_NAME IndexedDBHostMsg_ObjectStoreOpenCursor_Params |
| 138 ~IndexedDBHostMsg_ObjectStoreOpenCursor_Params(); | 104 // The response should have this id. |
| 139 | 105 IPC_STRUCT_FIRST(int32, response_id, INIT) |
| 140 // The response should have this id. | 106 // The serialized lower key. |
| 141 int32 response_id; | 107 IPC_STRUCT_NEXT(IndexedDBKey, lower_key, NOINIT) |
| 142 | 108 // The serialized upper key. |
| 143 // The serialized lower key. | 109 IPC_STRUCT_NEXT(IndexedDBKey, upper_key, NOINIT) |
| 144 IndexedDBKey lower_key; | 110 // Is the lower bound open? |
| 145 | 111 IPC_STRUCT_NEXT(bool, lower_open, INIT) |
| 146 // The serialized upper key. | 112 // Is the upper bound open? |
| 147 IndexedDBKey upper_key; | 113 IPC_STRUCT_NEXT(bool, upper_open, INIT) |
| 148 | 114 // The direction of this cursor. |
| 149 // Is the lower bound open? | 115 IPC_STRUCT_NEXT(int32, direction, INIT) |
| 150 bool lower_open; | 116 // The object store the cursor belongs to. |
| 151 | 117 IPC_STRUCT_NEXT(int32, idb_object_store_id, INIT) |
| 152 // Is the upper bound open? | 118 // The transaction this request belongs to. |
| 153 bool upper_open; | 119 IPC_STRUCT_LAST(int, transaction_id, INIT) |
| 154 | |
| 155 // The direction of this cursor. | |
| 156 int32 direction; | |
| 157 | |
| 158 // The object store the cursor belongs to. | |
| 159 int32 idb_object_store_id; | |
| 160 | |
| 161 // The transaction this request belongs to. | |
| 162 int transaction_id; | |
| 163 }; | |
| 164 | |
| 165 namespace IPC { | |
| 166 template <> | |
| 167 struct ParamTraits<IndexedDBHostMsg_FactoryOpen_Params> { | |
| 168 typedef IndexedDBHostMsg_FactoryOpen_Params param_type; | |
| 169 static void Write(Message* m, const param_type& p); | |
| 170 static bool Read(const Message* m, void** iter, param_type* p); | |
| 171 static void Log(const param_type& p, std::string* l); | |
| 172 }; | |
| 173 | |
| 174 template <> | |
| 175 struct ParamTraits<IndexedDBHostMsg_DatabaseCreateObjectStore_Params> { | |
| 176 typedef IndexedDBHostMsg_DatabaseCreateObjectStore_Params param_type; | |
| 177 static void Write(Message* m, const param_type& p); | |
| 178 static bool Read(const Message* m, void** iter, param_type* p); | |
| 179 static void Log(const param_type& p, std::string* l); | |
| 180 }; | |
| 181 | |
| 182 template <> | |
| 183 struct ParamTraits<IndexedDBHostMsg_IndexOpenCursor_Params> { | |
| 184 typedef IndexedDBHostMsg_IndexOpenCursor_Params param_type; | |
| 185 static void Write(Message* m, const param_type& p); | |
| 186 static bool Read(const Message* m, void** iter, param_type* p); | |
| 187 static void Log(const param_type& p, std::string* l); | |
| 188 }; | |
| 189 | |
| 190 template <> | |
| 191 struct ParamTraits<IndexedDBHostMsg_ObjectStorePut_Params> { | |
| 192 typedef IndexedDBHostMsg_ObjectStorePut_Params param_type; | |
| 193 static void Write(Message* m, const param_type& p); | |
| 194 static bool Read(const Message* m, void** iter, param_type* p); | |
| 195 static void Log(const param_type& p, std::string* l); | |
| 196 }; | |
| 197 | |
| 198 template <> | |
| 199 struct ParamTraits<IndexedDBHostMsg_ObjectStoreCreateIndex_Params> { | |
| 200 typedef IndexedDBHostMsg_ObjectStoreCreateIndex_Params param_type; | |
| 201 static void Write(Message* m, const param_type& p); | |
| 202 static bool Read(const Message* m, void** iter, param_type* p); | |
| 203 static void Log(const param_type& p, std::string* l); | |
| 204 }; | |
| 205 | |
| 206 template <> | |
| 207 struct ParamTraits<IndexedDBHostMsg_ObjectStoreOpenCursor_Params> { | |
| 208 typedef IndexedDBHostMsg_ObjectStoreOpenCursor_Params param_type; | |
| 209 static void Write(Message* m, const param_type& p); | |
| 210 static bool Read(const Message* m, void** iter, param_type* p); | |
| 211 static void Log(const param_type& p, std::string* l); | |
| 212 }; | |
| 213 | |
| 214 } // namespace IPC | |
| 215 | 120 |
| 216 // Indexed DB messages sent from the browser to the renderer. | 121 // Indexed DB messages sent from the browser to the renderer. |
| 217 | 122 |
| 218 // IDBCallback message handlers. | 123 // IDBCallback message handlers. |
| 219 IPC_MESSAGE_CONTROL2(IndexedDBMsg_CallbacksSuccessIDBCursor, | 124 IPC_MESSAGE_CONTROL2(IndexedDBMsg_CallbacksSuccessIDBCursor, |
| 220 int32 /* response_id */, | 125 int32 /* response_id */, |
| 221 int32 /* cursor_id */) | 126 int32 /* cursor_id */) |
| 222 IPC_MESSAGE_CONTROL2(IndexedDBMsg_CallbacksSuccessIDBDatabase, | 127 IPC_MESSAGE_CONTROL2(IndexedDBMsg_CallbacksSuccessIDBDatabase, |
| 223 int32 /* response_id */, | 128 int32 /* response_id */, |
| 224 int32 /* idb_database_id */) | 129 int32 /* idb_database_id */) |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 485 int32 /* idb_transaction_id */) | 390 int32 /* idb_transaction_id */) |
| 486 | 391 |
| 487 // IDBTransaction::DidCompleteTaskEvents() message. | 392 // IDBTransaction::DidCompleteTaskEvents() message. |
| 488 IPC_MESSAGE_CONTROL1(IndexedDBHostMsg_TransactionDidCompleteTaskEvents, | 393 IPC_MESSAGE_CONTROL1(IndexedDBHostMsg_TransactionDidCompleteTaskEvents, |
| 489 int32 /* idb_transaction_id */) | 394 int32 /* idb_transaction_id */) |
| 490 | 395 |
| 491 // WebIDBTransaction::~WebIDBTransaction() message. | 396 // WebIDBTransaction::~WebIDBTransaction() message. |
| 492 IPC_MESSAGE_CONTROL1(IndexedDBHostMsg_TransactionDestroyed, | 397 IPC_MESSAGE_CONTROL1(IndexedDBHostMsg_TransactionDestroyed, |
| 493 int32 /* idb_transaction_id */) | 398 int32 /* idb_transaction_id */) |
| 494 | 399 |
| 495 #endif // CHROME_COMMON_INDEXED_DB_MESSAGES_H_ | |
| OLD | NEW |