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

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

Issue 320833002: [IndexedDB] Use consistent enums on both sides of IPC. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase patch. Created 6 years, 6 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
OLDNEW
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/indexed_db/indexed_db_dispatcher_host.h" 5 #include "content/browser/indexed_db/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/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/memory/scoped_vector.h" 10 #include "base/memory/scoped_vector.h"
(...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after
657 } 657 }
658 } else { 658 } else {
659 blob_info[i] = IndexedDBBlobInfo(info.uuid, info.mime_type, info.size); 659 blob_info[i] = IndexedDBBlobInfo(info.uuid, info.mime_type, info.size);
660 } 660 }
661 } 661 }
662 662
663 // TODO(alecflett): Avoid a copy here. 663 // TODO(alecflett): Avoid a copy here.
664 IndexedDBValue value; 664 IndexedDBValue value;
665 value.bits = params.value; 665 value.bits = params.value;
666 value.blob_info.swap(blob_info); 666 value.blob_info.swap(blob_info);
667 connection->database()->Put( 667 connection->database()->Put(host_transaction_id,
668 host_transaction_id, 668 params.object_store_id,
669 params.object_store_id, 669 &value,
670 &value, 670 &scoped_handles,
671 &scoped_handles, 671 make_scoped_ptr(new IndexedDBKey(params.key)),
672 make_scoped_ptr(new IndexedDBKey(params.key)), 672 params.put_mode,
673 static_cast<IndexedDBDatabase::PutMode>(params.put_mode), 673 callbacks,
674 callbacks, 674 params.index_keys);
675 params.index_keys);
676 TransactionIDToSizeMap* map = 675 TransactionIDToSizeMap* map =
677 &parent_->database_dispatcher_host_->transaction_size_map_; 676 &parent_->database_dispatcher_host_->transaction_size_map_;
678 // Size can't be big enough to overflow because it represents the 677 // Size can't be big enough to overflow because it represents the
679 // actual bytes passed through IPC. 678 // actual bytes passed through IPC.
680 (*map)[host_transaction_id] += params.value.size(); 679 (*map)[host_transaction_id] += params.value.size();
681 } 680 }
682 681
683 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnSetIndexKeys( 682 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnSetIndexKeys(
684 const IndexedDBHostMsg_DatabaseSetIndexKeys_Params& params) { 683 const IndexedDBHostMsg_DatabaseSetIndexKeys_Params& params) {
685 DCHECK( 684 DCHECK(
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
722 if (!connection || !connection->IsConnected()) 721 if (!connection || !connection->IsConnected())
723 return; 722 return;
724 723
725 scoped_refptr<IndexedDBCallbacks> callbacks(new IndexedDBCallbacks( 724 scoped_refptr<IndexedDBCallbacks> callbacks(new IndexedDBCallbacks(
726 parent_, params.ipc_thread_id, params.ipc_callbacks_id, -1)); 725 parent_, params.ipc_thread_id, params.ipc_callbacks_id, -1));
727 connection->database()->OpenCursor( 726 connection->database()->OpenCursor(
728 parent_->HostTransactionId(params.transaction_id), 727 parent_->HostTransactionId(params.transaction_id),
729 params.object_store_id, 728 params.object_store_id,
730 params.index_id, 729 params.index_id,
731 make_scoped_ptr(new IndexedDBKeyRange(params.key_range)), 730 make_scoped_ptr(new IndexedDBKeyRange(params.key_range)),
732 static_cast<indexed_db::CursorDirection>(params.direction), 731 params.direction,
733 params.key_only, 732 params.key_only,
734 static_cast<IndexedDBDatabase::TaskType>(params.task_type), 733 params.task_type,
735 callbacks); 734 callbacks);
736 } 735 }
737 736
738 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnCount( 737 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnCount(
739 const IndexedDBHostMsg_DatabaseCount_Params& params) { 738 const IndexedDBHostMsg_DatabaseCount_Params& params) {
740 DCHECK( 739 DCHECK(
741 parent_->indexed_db_context_->TaskRunner()->RunsTasksOnCurrentThread()); 740 parent_->indexed_db_context_->TaskRunner()->RunsTasksOnCurrentThread());
742 IndexedDBConnection* connection = 741 IndexedDBConnection* connection =
743 parent_->GetOrTerminateProcess(&map_, params.ipc_database_id); 742 parent_->GetOrTerminateProcess(&map_, params.ipc_database_id);
744 if (!connection || !connection->IsConnected()) 743 if (!connection || !connection->IsConnected())
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
979 } 978 }
980 979
981 void IndexedDBDispatcherHost::CursorDispatcherHost::OnDestroyed( 980 void IndexedDBDispatcherHost::CursorDispatcherHost::OnDestroyed(
982 int32 ipc_object_id) { 981 int32 ipc_object_id) {
983 DCHECK( 982 DCHECK(
984 parent_->indexed_db_context_->TaskRunner()->RunsTasksOnCurrentThread()); 983 parent_->indexed_db_context_->TaskRunner()->RunsTasksOnCurrentThread());
985 parent_->DestroyObject(&map_, ipc_object_id); 984 parent_->DestroyObject(&map_, ipc_object_id);
986 } 985 }
987 986
988 } // namespace content 987 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/indexed_db/indexed_db_database_unittest.cc ('k') | content/browser/indexed_db/indexed_db_fake_backing_store.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698