| 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 #include "chrome/browser/in_process_webkit/indexed_db_dispatcher_host.h" | 5 #include "chrome/browser/in_process_webkit/indexed_db_dispatcher_host.h" | 
| 6 | 6 | 
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" | 
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" | 
| 9 #include "chrome/browser/chrome_thread.h" | 9 #include "chrome/browser/chrome_thread.h" | 
| 10 #include "chrome/browser/host_content_settings_map.h" | 10 #include "chrome/browser/host_content_settings_map.h" | 
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 102 | 102 | 
| 103   database_dispatcher_host_.reset(); | 103   database_dispatcher_host_.reset(); | 
| 104   index_dispatcher_host_.reset(); | 104   index_dispatcher_host_.reset(); | 
| 105 } | 105 } | 
| 106 | 106 | 
| 107 bool IndexedDBDispatcherHost::OnMessageReceived(const IPC::Message& message) { | 107 bool IndexedDBDispatcherHost::OnMessageReceived(const IPC::Message& message) { | 
| 108   DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO)); | 108   DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO)); | 
| 109   DCHECK(process_handle_); | 109   DCHECK(process_handle_); | 
| 110 | 110 | 
| 111   switch (message.type()) { | 111   switch (message.type()) { | 
| 112     case ViewHostMsg_IDBCursorDestroyed::ID: |  | 
| 113     case ViewHostMsg_IDBCursorDirection::ID: | 112     case ViewHostMsg_IDBCursorDirection::ID: | 
| 114     case ViewHostMsg_IDBCursorKey::ID: | 113     case ViewHostMsg_IDBCursorKey::ID: | 
| 115     case ViewHostMsg_IDBCursorValue::ID: | 114     case ViewHostMsg_IDBCursorValue::ID: | 
| 116     case ViewHostMsg_IDBCursorUpdate::ID: | 115     case ViewHostMsg_IDBCursorUpdate::ID: | 
| 117     case ViewHostMsg_IDBCursorContinue::ID: | 116     case ViewHostMsg_IDBCursorContinue::ID: | 
| 118     case ViewHostMsg_IDBCursorRemove::ID: | 117     case ViewHostMsg_IDBCursorRemove::ID: | 
|  | 118     case ViewHostMsg_IDBCursorDestroyed::ID: | 
| 119     case ViewHostMsg_IDBFactoryOpen::ID: | 119     case ViewHostMsg_IDBFactoryOpen::ID: | 
| 120     case ViewHostMsg_IDBFactoryAbortPendingTransactions::ID: | 120     case ViewHostMsg_IDBFactoryAbortPendingTransactions::ID: | 
| 121     case ViewHostMsg_IDBDatabaseName::ID: | 121     case ViewHostMsg_IDBDatabaseName::ID: | 
| 122     case ViewHostMsg_IDBDatabaseDescription::ID: | 122     case ViewHostMsg_IDBDatabaseDescription::ID: | 
| 123     case ViewHostMsg_IDBDatabaseVersion::ID: | 123     case ViewHostMsg_IDBDatabaseVersion::ID: | 
| 124     case ViewHostMsg_IDBDatabaseObjectStores::ID: | 124     case ViewHostMsg_IDBDatabaseObjectStores::ID: | 
| 125     case ViewHostMsg_IDBDatabaseCreateObjectStore::ID: | 125     case ViewHostMsg_IDBDatabaseCreateObjectStore::ID: | 
| 126     case ViewHostMsg_IDBDatabaseObjectStore::ID: | 126     case ViewHostMsg_IDBDatabaseObjectStore::ID: | 
| 127     case ViewHostMsg_IDBDatabaseRemoveObjectStore::ID: | 127     case ViewHostMsg_IDBDatabaseRemoveObjectStore::ID: | 
| 128     case ViewHostMsg_IDBDatabaseSetVersion::ID: | 128     case ViewHostMsg_IDBDatabaseSetVersion::ID: | 
| 129     case ViewHostMsg_IDBDatabaseTransaction::ID: | 129     case ViewHostMsg_IDBDatabaseTransaction::ID: | 
| 130     case ViewHostMsg_IDBDatabaseDestroyed::ID: | 130     case ViewHostMsg_IDBDatabaseDestroyed::ID: | 
| 131     case ViewHostMsg_IDBIndexName::ID: | 131     case ViewHostMsg_IDBIndexName::ID: | 
| 132     case ViewHostMsg_IDBIndexStoreName::ID: | 132     case ViewHostMsg_IDBIndexStoreName::ID: | 
| 133     case ViewHostMsg_IDBIndexKeyPath::ID: | 133     case ViewHostMsg_IDBIndexKeyPath::ID: | 
| 134     case ViewHostMsg_IDBIndexUnique::ID: | 134     case ViewHostMsg_IDBIndexUnique::ID: | 
| 135     case ViewHostMsg_IDBIndexDestroyed::ID: | 135     case ViewHostMsg_IDBIndexDestroyed::ID: | 
| 136     case ViewHostMsg_IDBIndexOpenObjectCursor::ID: | 136     case ViewHostMsg_IDBIndexOpenObjectCursor::ID: | 
| 137     case ViewHostMsg_IDBIndexOpenCursor::ID: | 137     case ViewHostMsg_IDBIndexOpenCursor::ID: | 
| 138     case ViewHostMsg_IDBIndexGetObject::ID: | 138     case ViewHostMsg_IDBIndexGetObject::ID: | 
| 139     case ViewHostMsg_IDBIndexGet::ID: | 139     case ViewHostMsg_IDBIndexGet::ID: | 
| 140     case ViewHostMsg_IDBObjectStoreName::ID: | 140     case ViewHostMsg_IDBObjectStoreName::ID: | 
| 141     case ViewHostMsg_IDBObjectStoreKeyPath::ID: | 141     case ViewHostMsg_IDBObjectStoreKeyPath::ID: | 
| 142     case ViewHostMsg_IDBObjectStoreIndexNames::ID: | 142     case ViewHostMsg_IDBObjectStoreIndexNames::ID: | 
| 143     case ViewHostMsg_IDBObjectStoreGet::ID: | 143     case ViewHostMsg_IDBObjectStoreGet::ID: | 
| 144     case ViewHostMsg_IDBObjectStoreOpenCursor::ID: |  | 
| 145     case ViewHostMsg_IDBObjectStorePut::ID: | 144     case ViewHostMsg_IDBObjectStorePut::ID: | 
| 146     case ViewHostMsg_IDBObjectStoreRemove::ID: | 145     case ViewHostMsg_IDBObjectStoreRemove::ID: | 
| 147     case ViewHostMsg_IDBObjectStoreCreateIndex::ID: | 146     case ViewHostMsg_IDBObjectStoreCreateIndex::ID: | 
| 148     case ViewHostMsg_IDBObjectStoreIndex::ID: | 147     case ViewHostMsg_IDBObjectStoreIndex::ID: | 
| 149     case ViewHostMsg_IDBObjectStoreRemoveIndex::ID: | 148     case ViewHostMsg_IDBObjectStoreRemoveIndex::ID: | 
|  | 149     case ViewHostMsg_IDBObjectStoreOpenCursor::ID: | 
| 150     case ViewHostMsg_IDBObjectStoreDestroyed::ID: | 150     case ViewHostMsg_IDBObjectStoreDestroyed::ID: | 
| 151     case ViewHostMsg_IDBTransactionDestroyed::ID: | 151     case ViewHostMsg_IDBTransactionDestroyed::ID: | 
| 152     case ViewHostMsg_IDBTransactionObjectStore::ID: | 152     case ViewHostMsg_IDBTransactionObjectStore::ID: | 
| 153       break; | 153       break; | 
| 154     default: | 154     default: | 
| 155       return false; | 155       return false; | 
| 156   } | 156   } | 
| 157 | 157 | 
| 158   bool success = ChromeThread::PostTask( | 158   bool success = ChromeThread::PostTask( | 
| 159       ChromeThread::WEBKIT, FROM_HERE, NewRunnableMethod( | 159       ChromeThread::WEBKIT, FROM_HERE, NewRunnableMethod( | 
| (...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 505 | 505 | 
| 506 IndexedDBDispatcherHost::IndexDispatcherHost::~IndexDispatcherHost() { | 506 IndexedDBDispatcherHost::IndexDispatcherHost::~IndexDispatcherHost() { | 
| 507 } | 507 } | 
| 508 | 508 | 
| 509 bool IndexedDBDispatcherHost::IndexDispatcherHost::OnMessageReceived( | 509 bool IndexedDBDispatcherHost::IndexDispatcherHost::OnMessageReceived( | 
| 510     const IPC::Message& message, bool* msg_is_ok) { | 510     const IPC::Message& message, bool* msg_is_ok) { | 
| 511   bool handled = true; | 511   bool handled = true; | 
| 512   IPC_BEGIN_MESSAGE_MAP_EX(IndexedDBDispatcherHost::IndexDispatcherHost, | 512   IPC_BEGIN_MESSAGE_MAP_EX(IndexedDBDispatcherHost::IndexDispatcherHost, | 
| 513                            message, *msg_is_ok) | 513                            message, *msg_is_ok) | 
| 514     IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_IDBIndexName, OnName) | 514     IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_IDBIndexName, OnName) | 
|  | 515     IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_IDBIndexStoreName, OnStoreName) | 
| 515     IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_IDBIndexKeyPath, OnKeyPath) | 516     IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_IDBIndexKeyPath, OnKeyPath) | 
| 516     IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_IDBIndexUnique, OnUnique) | 517     IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_IDBIndexUnique, OnUnique) | 
|  | 518     IPC_MESSAGE_HANDLER(ViewHostMsg_IDBIndexOpenObjectCursor, | 
|  | 519                         OnOpenObjectCursor) | 
|  | 520     IPC_MESSAGE_HANDLER(ViewHostMsg_IDBIndexOpenCursor, OnOpenCursor) | 
|  | 521     IPC_MESSAGE_HANDLER(ViewHostMsg_IDBIndexGetObject, OnGetObject) | 
|  | 522     IPC_MESSAGE_HANDLER(ViewHostMsg_IDBIndexGet, OnGet) | 
| 517     IPC_MESSAGE_HANDLER(ViewHostMsg_IDBIndexDestroyed, OnDestroyed) | 523     IPC_MESSAGE_HANDLER(ViewHostMsg_IDBIndexDestroyed, OnDestroyed) | 
| 518     IPC_MESSAGE_UNHANDLED(handled = false) | 524     IPC_MESSAGE_UNHANDLED(handled = false) | 
| 519   IPC_END_MESSAGE_MAP() | 525   IPC_END_MESSAGE_MAP() | 
| 520   return handled; | 526   return handled; | 
| 521 } | 527 } | 
| 522 | 528 | 
| 523 void IndexedDBDispatcherHost::IndexDispatcherHost::Send( | 529 void IndexedDBDispatcherHost::IndexDispatcherHost::Send( | 
| 524     IPC::Message* message) { | 530     IPC::Message* message) { | 
| 525   // The macro magic in OnMessageReceived requires this to link, but it should | 531   // The macro magic in OnMessageReceived requires this to link, but it should | 
| 526   // never actually be called. | 532   // never actually be called. | 
| 527   NOTREACHED(); | 533   NOTREACHED(); | 
| 528   parent_->Send(message); | 534   parent_->Send(message); | 
| 529 } | 535 } | 
| 530 | 536 | 
| 531 void IndexedDBDispatcherHost::IndexDispatcherHost::OnName( | 537 void IndexedDBDispatcherHost::IndexDispatcherHost::OnName( | 
| 532     int32 object_id, IPC::Message* reply_msg) { | 538     int32 object_id, IPC::Message* reply_msg) { | 
| 533   parent_->SyncGetter<string16, ViewHostMsg_IDBIndexName>( | 539   parent_->SyncGetter<string16, ViewHostMsg_IDBIndexName>( | 
| 534       &map_, object_id, reply_msg, &WebIDBIndex::name); | 540       &map_, object_id, reply_msg, &WebIDBIndex::name); | 
| 535 } | 541 } | 
| 536 | 542 | 
|  | 543 void IndexedDBDispatcherHost::IndexDispatcherHost::OnStoreName( | 
|  | 544     int32 object_id, IPC::Message* reply_msg) { | 
|  | 545   parent_->SyncGetter<string16, ViewHostMsg_IDBIndexStoreName>( | 
|  | 546       &map_, object_id, reply_msg, &WebIDBIndex::storeName); | 
|  | 547 } | 
|  | 548 | 
| 537 void IndexedDBDispatcherHost::IndexDispatcherHost::OnKeyPath( | 549 void IndexedDBDispatcherHost::IndexDispatcherHost::OnKeyPath( | 
| 538     int32 object_id, IPC::Message* reply_msg) { | 550     int32 object_id, IPC::Message* reply_msg) { | 
| 539   parent_->SyncGetter<NullableString16, ViewHostMsg_IDBIndexKeyPath>( | 551   parent_->SyncGetter<NullableString16, ViewHostMsg_IDBIndexKeyPath>( | 
| 540       &map_, object_id, reply_msg, &WebIDBIndex::keyPath); | 552       &map_, object_id, reply_msg, &WebIDBIndex::keyPath); | 
| 541 } | 553 } | 
| 542 | 554 | 
| 543 void IndexedDBDispatcherHost::IndexDispatcherHost::OnUnique( | 555 void IndexedDBDispatcherHost::IndexDispatcherHost::OnUnique( | 
| 544     int32 object_id, IPC::Message* reply_msg) { | 556     int32 object_id, IPC::Message* reply_msg) { | 
| 545   parent_->SyncGetter<bool, ViewHostMsg_IDBIndexUnique>( | 557   parent_->SyncGetter<bool, ViewHostMsg_IDBIndexUnique>( | 
| 546       &map_, object_id, reply_msg, &WebIDBIndex::unique); | 558       &map_, object_id, reply_msg, &WebIDBIndex::unique); | 
| (...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 945   ViewHostMsg_IDBTransactionObjectStore::WriteReplyParams( | 957   ViewHostMsg_IDBTransactionObjectStore::WriteReplyParams( | 
| 946          reply_msg, object_id); | 958          reply_msg, object_id); | 
| 947   parent_->Send(reply_msg); | 959   parent_->Send(reply_msg); | 
| 948 } | 960 } | 
| 949 | 961 | 
| 950 void IndexedDBDispatcherHost::TransactionDispatcherHost::OnDestroyed( | 962 void IndexedDBDispatcherHost::TransactionDispatcherHost::OnDestroyed( | 
| 951     int32 object_id) { | 963     int32 object_id) { | 
| 952   parent_->DestroyObject( | 964   parent_->DestroyObject( | 
| 953       &map_, object_id, ViewHostMsg_IDBTransactionDestroyed::ID); | 965       &map_, object_id, ViewHostMsg_IDBTransactionDestroyed::ID); | 
| 954 } | 966 } | 
| OLD | NEW | 
|---|