OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "content/browser/in_process_webkit/indexed_db_dispatcher_host.h" | 5 #include "content/browser/in_process_webkit/indexed_db_dispatcher_host.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "content/browser/in_process_webkit/indexed_db_callbacks.h" | 10 #include "content/browser/in_process_webkit/indexed_db_callbacks.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBKeyRange.h" | 28 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBKeyRange.h" |
29 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBObjectStore.h" | 29 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBObjectStore.h" |
30 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBTransaction.h" | 30 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBTransaction.h" |
31 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h" | 31 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h" |
32 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebVector.h" | 32 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebVector.h" |
33 #include "webkit/database/database_util.h" | 33 #include "webkit/database/database_util.h" |
34 #include "webkit/glue/webkit_glue.h" | 34 #include "webkit/glue/webkit_glue.h" |
35 | 35 |
36 using content::BrowserMessageFilter; | 36 using content::BrowserMessageFilter; |
37 using content::BrowserThread; | 37 using content::BrowserThread; |
| 38 using content::IndexedDBDatabaseMetadata; |
38 using content::IndexedDBKey; | 39 using content::IndexedDBKey; |
39 using content::IndexedDBKeyPath; | 40 using content::IndexedDBKeyPath; |
40 using content::IndexedDBKeyRange; | 41 using content::IndexedDBKeyRange; |
41 using content::UserMetricsAction; | 42 using content::UserMetricsAction; |
42 using content::SerializedScriptValue; | 43 using content::SerializedScriptValue; |
43 using webkit_database::DatabaseUtil; | 44 using webkit_database::DatabaseUtil; |
44 using WebKit::WebDOMStringList; | 45 using WebKit::WebDOMStringList; |
45 using WebKit::WebExceptionCode; | 46 using WebKit::WebExceptionCode; |
46 using WebKit::WebIDBCallbacks; | 47 using WebKit::WebIDBCallbacks; |
47 using WebKit::WebIDBCursor; | 48 using WebKit::WebIDBCursor; |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 database->close(); | 318 database->close(); |
318 parent_->Context()->ConnectionClosed(iter->second); | 319 parent_->Context()->ConnectionClosed(iter->second); |
319 } | 320 } |
320 } | 321 } |
321 | 322 |
322 bool IndexedDBDispatcherHost::DatabaseDispatcherHost::OnMessageReceived( | 323 bool IndexedDBDispatcherHost::DatabaseDispatcherHost::OnMessageReceived( |
323 const IPC::Message& message, bool* msg_is_ok) { | 324 const IPC::Message& message, bool* msg_is_ok) { |
324 bool handled = true; | 325 bool handled = true; |
325 IPC_BEGIN_MESSAGE_MAP_EX(IndexedDBDispatcherHost::DatabaseDispatcherHost, | 326 IPC_BEGIN_MESSAGE_MAP_EX(IndexedDBDispatcherHost::DatabaseDispatcherHost, |
326 message, *msg_is_ok) | 327 message, *msg_is_ok) |
| 328 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseMetadata, OnMetadata) |
327 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseName, OnName) | 329 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseName, OnName) |
328 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseVersion, OnVersion) | 330 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseVersion, OnVersion) |
329 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseObjectStoreNames, | 331 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseObjectStoreNames, |
330 OnObjectStoreNames) | 332 OnObjectStoreNames) |
331 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseCreateObjectStore, | 333 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseCreateObjectStore, |
332 OnCreateObjectStore) | 334 OnCreateObjectStore) |
333 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseDeleteObjectStore, | 335 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseDeleteObjectStore, |
334 OnDeleteObjectStore) | 336 OnDeleteObjectStore) |
335 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseSetVersion, OnSetVersion) | 337 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseSetVersion, OnSetVersion) |
336 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseTransaction, OnTransaction) | 338 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseTransaction, OnTransaction) |
337 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseClose, OnClose) | 339 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseClose, OnClose) |
338 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseOpen, OnOpen) | 340 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseOpen, OnOpen) |
339 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseDestroyed, OnDestroyed) | 341 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseDestroyed, OnDestroyed) |
340 IPC_MESSAGE_UNHANDLED(handled = false) | 342 IPC_MESSAGE_UNHANDLED(handled = false) |
341 IPC_END_MESSAGE_MAP() | 343 IPC_END_MESSAGE_MAP() |
342 return handled; | 344 return handled; |
343 } | 345 } |
344 | 346 |
345 void IndexedDBDispatcherHost::DatabaseDispatcherHost::Send( | 347 void IndexedDBDispatcherHost::DatabaseDispatcherHost::Send( |
346 IPC::Message* message) { | 348 IPC::Message* message) { |
347 parent_->Send(message); | 349 parent_->Send(message); |
348 } | 350 } |
349 | 351 |
| 352 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnMetadata( |
| 353 int32 object_id, content::IndexedDBDatabaseMetadata* metadata) { |
| 354 WebIDBDatabase* idb_database = parent_->GetOrTerminateProcess( |
| 355 &map_, object_id); |
| 356 if (!idb_database) |
| 357 return; |
| 358 |
| 359 *metadata = IndexedDBDatabaseMetadata(idb_database->metadata()); |
| 360 } |
| 361 |
350 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnName( | 362 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnName( |
351 int32 object_id, string16* name) { | 363 int32 object_id, string16* name) { |
352 parent_->SyncGetter<string16>(&map_, object_id, name, &WebIDBDatabase::name); | 364 parent_->SyncGetter<string16>(&map_, object_id, name, &WebIDBDatabase::name); |
353 } | 365 } |
354 | 366 |
355 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnVersion( | 367 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnVersion( |
356 int32 object_id, string16* version) { | 368 int32 object_id, string16* version) { |
357 parent_->SyncGetter<string16>( | 369 parent_->SyncGetter<string16>( |
358 &map_, object_id, version, &WebIDBDatabase::version); | 370 &map_, object_id, version, &WebIDBDatabase::version); |
359 } | 371 } |
(...skipping 861 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1221 } | 1233 } |
1222 idb_transaction->didCompleteTaskEvents(); | 1234 idb_transaction->didCompleteTaskEvents(); |
1223 } | 1235 } |
1224 | 1236 |
1225 void IndexedDBDispatcherHost::TransactionDispatcherHost::OnDestroyed( | 1237 void IndexedDBDispatcherHost::TransactionDispatcherHost::OnDestroyed( |
1226 int32 object_id) { | 1238 int32 object_id) { |
1227 transaction_size_map_.erase(object_id); | 1239 transaction_size_map_.erase(object_id); |
1228 transaction_url_map_.erase(object_id); | 1240 transaction_url_map_.erase(object_id); |
1229 parent_->DestroyObject(&map_, object_id); | 1241 parent_->DestroyObject(&map_, object_id); |
1230 } | 1242 } |
OLD | NEW |