Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(217)

Side by Side Diff: content/browser/in_process_webkit/indexed_db_dispatcher_host.cc

Issue 7692006: IndexedDB API cleanup. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Copyright presubmit Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/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 "content/browser/browser_thread.h" 9 #include "content/browser/browser_thread.h"
10 #include "content/browser/in_process_webkit/indexed_db_callbacks.h" 10 #include "content/browser/in_process_webkit/indexed_db_callbacks.h"
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 version, 424 version,
425 new IndexedDBCallbacks<WebIDBTransaction>(parent_, response_id, 425 new IndexedDBCallbacks<WebIDBTransaction>(parent_, response_id,
426 database_url_map_[idb_database_id]), 426 database_url_map_[idb_database_id]),
427 *ec); 427 *ec);
428 } 428 }
429 429
430 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnTransaction( 430 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnTransaction(
431 int32 idb_database_id, 431 int32 idb_database_id,
432 const std::vector<string16>& names, 432 const std::vector<string16>& names,
433 int32 mode, 433 int32 mode,
434 int32 timeout,
435 int32* idb_transaction_id, 434 int32* idb_transaction_id,
436 WebKit::WebExceptionCode* ec) { 435 WebKit::WebExceptionCode* ec) {
437 WebIDBDatabase* database = parent_->GetOrTerminateProcess( 436 WebIDBDatabase* database = parent_->GetOrTerminateProcess(
438 &map_, idb_database_id); 437 &map_, idb_database_id);
439 if (!database) 438 if (!database)
440 return; 439 return;
441 440
442 WebDOMStringList object_stores; 441 WebDOMStringList object_stores;
443 for (std::vector<string16>::const_iterator it = names.begin(); 442 for (std::vector<string16>::const_iterator it = names.begin();
444 it != names.end(); ++it) { 443 it != names.end(); ++it) {
445 object_stores.append(*it); 444 object_stores.append(*it);
446 } 445 }
447 446
448 *ec = 0; 447 *ec = 0;
449 WebIDBTransaction* transaction = database->transaction( 448 WebIDBTransaction* transaction = database->transaction(
450 object_stores, mode, timeout, *ec); 449 object_stores, mode, *ec);
451 DCHECK(!transaction != !*ec); 450 DCHECK(!transaction != !*ec);
452 *idb_transaction_id = 451 *idb_transaction_id =
453 *ec ? 0 : parent_->Add(transaction, database_url_map_[idb_database_id]); 452 *ec ? 0 : parent_->Add(transaction, database_url_map_[idb_database_id]);
454 } 453 }
455 454
456 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnOpen( 455 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnOpen(
457 int32 idb_database_id, int32 response_id) { 456 int32 idb_database_id, int32 response_id) {
458 WebIDBDatabase* database = parent_->GetOrTerminateProcess( 457 WebIDBDatabase* database = parent_->GetOrTerminateProcess(
459 &map_, idb_database_id); 458 &map_, idb_database_id);
460 database->open(new IndexedDBDatabaseCallbacks(parent_, response_id)); 459 database->open(new IndexedDBDatabaseCallbacks(parent_, response_id));
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
910 int32 object_id, IndexedDBKey* primary_key) { 909 int32 object_id, IndexedDBKey* primary_key) {
911 WebIDBCursor* idb_cursor = parent_->GetOrTerminateProcess(&map_, object_id); 910 WebIDBCursor* idb_cursor = parent_->GetOrTerminateProcess(&map_, object_id);
912 if (!idb_cursor) 911 if (!idb_cursor)
913 return; 912 return;
914 913
915 *primary_key = IndexedDBKey(idb_cursor->primaryKey()); 914 *primary_key = IndexedDBKey(idb_cursor->primaryKey());
916 } 915 }
917 916
918 void IndexedDBDispatcherHost::CursorDispatcherHost::OnValue( 917 void IndexedDBDispatcherHost::CursorDispatcherHost::OnValue(
919 int32 object_id, 918 int32 object_id,
920 SerializedScriptValue* script_value, 919 SerializedScriptValue* script_value) {
921 IndexedDBKey* key) {
922 WebIDBCursor* idb_cursor = parent_->GetOrTerminateProcess(&map_, object_id); 920 WebIDBCursor* idb_cursor = parent_->GetOrTerminateProcess(&map_, object_id);
923 if (!idb_cursor) 921 if (!idb_cursor)
924 return; 922 return;
925 923
926 WebSerializedScriptValue temp_script_value; 924 *script_value = SerializedScriptValue(idb_cursor->value());
927 WebIDBKey temp_key;
928 idb_cursor->value(temp_script_value, temp_key);
929
930 *script_value = SerializedScriptValue(temp_script_value);
931 *key = IndexedDBKey(temp_key);
932 } 925 }
933 926
934 void IndexedDBDispatcherHost::CursorDispatcherHost::OnUpdate( 927 void IndexedDBDispatcherHost::CursorDispatcherHost::OnUpdate(
935 int32 cursor_id, 928 int32 cursor_id,
936 int32 response_id, 929 int32 response_id,
937 const SerializedScriptValue& value, 930 const SerializedScriptValue& value,
938 WebKit::WebExceptionCode* ec) { 931 WebKit::WebExceptionCode* ec) {
939 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); 932 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT));
940 WebIDBCursor* idb_cursor = parent_->GetOrTerminateProcess(&map_, cursor_id); 933 WebIDBCursor* idb_cursor = parent_->GetOrTerminateProcess(&map_, cursor_id);
941 if (!idb_cursor) 934 if (!idb_cursor)
(...skipping 22 matching lines...) Expand all
964 void IndexedDBDispatcherHost::CursorDispatcherHost::OnDelete( 957 void IndexedDBDispatcherHost::CursorDispatcherHost::OnDelete(
965 int32 cursor_id, 958 int32 cursor_id,
966 int32 response_id, 959 int32 response_id,
967 WebKit::WebExceptionCode* ec) { 960 WebKit::WebExceptionCode* ec) {
968 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); 961 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT));
969 WebIDBCursor* idb_cursor = parent_->GetOrTerminateProcess(&map_, cursor_id); 962 WebIDBCursor* idb_cursor = parent_->GetOrTerminateProcess(&map_, cursor_id);
970 if (!idb_cursor) 963 if (!idb_cursor)
971 return; 964 return;
972 965
973 *ec = 0; 966 *ec = 0;
974 // TODO(jorlow): This should be delete. 967 idb_cursor->deleteFunction(
975 idb_cursor->remove(
976 new IndexedDBCallbacks<WebSerializedScriptValue>(parent_, response_id), *e c); 968 new IndexedDBCallbacks<WebSerializedScriptValue>(parent_, response_id), *e c);
977 } 969 }
978 970
979 void IndexedDBDispatcherHost::CursorDispatcherHost::OnDestroyed( 971 void IndexedDBDispatcherHost::CursorDispatcherHost::OnDestroyed(
980 int32 object_id) { 972 int32 object_id) {
981 parent_->DestroyObject(&map_, object_id); 973 parent_->DestroyObject(&map_, object_id);
982 } 974 }
983 975
984 ////////////////////////////////////////////////////////////////////// 976 //////////////////////////////////////////////////////////////////////
985 // IndexedDBDispatcherHost::TransactionDispatcherHost 977 // IndexedDBDispatcherHost::TransactionDispatcherHost
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
1072 } 1064 }
1073 idb_transaction->didCompleteTaskEvents(); 1065 idb_transaction->didCompleteTaskEvents();
1074 } 1066 }
1075 1067
1076 void IndexedDBDispatcherHost::TransactionDispatcherHost::OnDestroyed( 1068 void IndexedDBDispatcherHost::TransactionDispatcherHost::OnDestroyed(
1077 int32 object_id) { 1069 int32 object_id) {
1078 transaction_size_map_.erase(object_id); 1070 transaction_size_map_.erase(object_id);
1079 transaction_url_map_.erase(object_id); 1071 transaction_url_map_.erase(object_id);
1080 parent_->DestroyObject(&map_, object_id); 1072 parent_->DestroyObject(&map_, object_id);
1081 } 1073 }
OLDNEW
« no previous file with comments | « content/browser/in_process_webkit/indexed_db_dispatcher_host.h ('k') | content/common/indexed_db_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698