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 <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 parent_->Context()->ConnectionClosed(iter->second, database); | 326 parent_->Context()->ConnectionClosed(iter->second, database); |
327 } | 327 } |
328 } | 328 } |
329 } | 329 } |
330 | 330 |
331 bool IndexedDBDispatcherHost::DatabaseDispatcherHost::OnMessageReceived( | 331 bool IndexedDBDispatcherHost::DatabaseDispatcherHost::OnMessageReceived( |
332 const IPC::Message& message, bool* msg_is_ok) { | 332 const IPC::Message& message, bool* msg_is_ok) { |
333 bool handled = true; | 333 bool handled = true; |
334 IPC_BEGIN_MESSAGE_MAP_EX(IndexedDBDispatcherHost::DatabaseDispatcherHost, | 334 IPC_BEGIN_MESSAGE_MAP_EX(IndexedDBDispatcherHost::DatabaseDispatcherHost, |
335 message, *msg_is_ok) | 335 message, *msg_is_ok) |
336 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseMetadata, OnMetadata) | |
337 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseCreateObjectStore, | 336 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseCreateObjectStore, |
338 OnCreateObjectStore) | 337 OnCreateObjectStore) |
339 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseDeleteObjectStore, | 338 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseDeleteObjectStore, |
340 OnDeleteObjectStore) | 339 OnDeleteObjectStore) |
341 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseCreateTransaction, | 340 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseCreateTransaction, |
342 OnCreateTransaction) | 341 OnCreateTransaction) |
343 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseClose, OnClose) | 342 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseClose, OnClose) |
344 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseDestroyed, OnDestroyed) | 343 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseDestroyed, OnDestroyed) |
345 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseGet, OnGet) | 344 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseGet, OnGet) |
346 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabasePut, OnPut) | 345 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabasePut, OnPut) |
(...skipping 16 matching lines...) Expand all Loading... |
363 IPC_MESSAGE_UNHANDLED(handled = false) | 362 IPC_MESSAGE_UNHANDLED(handled = false) |
364 IPC_END_MESSAGE_MAP() | 363 IPC_END_MESSAGE_MAP() |
365 return handled; | 364 return handled; |
366 } | 365 } |
367 | 366 |
368 void IndexedDBDispatcherHost::DatabaseDispatcherHost::Send( | 367 void IndexedDBDispatcherHost::DatabaseDispatcherHost::Send( |
369 IPC::Message* message) { | 368 IPC::Message* message) { |
370 parent_->Send(message); | 369 parent_->Send(message); |
371 } | 370 } |
372 | 371 |
373 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnMetadata( | |
374 int32 ipc_database_id, IndexedDBDatabaseMetadata* metadata) { | |
375 WebIDBDatabase* idb_database = parent_->GetOrTerminateProcess( | |
376 &map_, ipc_database_id); | |
377 if (!idb_database) | |
378 return; | |
379 | |
380 *metadata = ConvertMetadata(idb_database->metadata()); | |
381 } | |
382 | |
383 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnCreateObjectStore( | 372 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnCreateObjectStore( |
384 const IndexedDBHostMsg_DatabaseCreateObjectStore_Params& params) { | 373 const IndexedDBHostMsg_DatabaseCreateObjectStore_Params& params) { |
385 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); | 374 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); |
386 WebIDBDatabase* database = parent_->GetOrTerminateProcess( | 375 WebIDBDatabase* database = parent_->GetOrTerminateProcess( |
387 &map_, params.ipc_database_id); | 376 &map_, params.ipc_database_id); |
388 if (!database) | 377 if (!database) |
389 return; | 378 return; |
390 | 379 |
391 int64 host_transaction_id = parent_->HostTransactionId(params.transaction_id); | 380 int64 host_transaction_id = parent_->HostTransactionId(params.transaction_id); |
392 database->createObjectStore( | 381 database->createObjectStore( |
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
796 ipc_response_id), ec); | 785 ipc_response_id), ec); |
797 DCHECK(!ec); | 786 DCHECK(!ec); |
798 } | 787 } |
799 | 788 |
800 void IndexedDBDispatcherHost::CursorDispatcherHost::OnDestroyed( | 789 void IndexedDBDispatcherHost::CursorDispatcherHost::OnDestroyed( |
801 int32 ipc_object_id) { | 790 int32 ipc_object_id) { |
802 parent_->DestroyObject(&map_, ipc_object_id); | 791 parent_->DestroyObject(&map_, ipc_object_id); |
803 } | 792 } |
804 | 793 |
805 } // namespace content | 794 } // namespace content |
OLD | NEW |