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