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

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

Issue 18075008: IndexedDB: Switch key/value handling from vector<char> to std::string (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove C++11ism Created 7 years, 5 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) 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 <vector>
8
9 #include "base/bind.h" 7 #include "base/bind.h"
10 #include "base/command_line.h" 8 #include "base/command_line.h"
11 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
12 #include "base/process.h" 10 #include "base/process.h"
13 #include "base/process_util.h" 11 #include "base/process_util.h"
14 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
15 #include "content/browser/indexed_db/indexed_db_callbacks.h" 13 #include "content/browser/indexed_db/indexed_db_callbacks.h"
16 #include "content/browser/indexed_db/indexed_db_connection.h" 14 #include "content/browser/indexed_db/indexed_db_connection.h"
17 #include "content/browser/indexed_db/indexed_db_context_impl.h" 15 #include "content/browser/indexed_db/indexed_db_context_impl.h"
18 #include "content/browser/indexed_db/indexed_db_cursor.h" 16 #include "content/browser/indexed_db/indexed_db_cursor.h"
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 520
523 IndexedDBConnection* connection = 521 IndexedDBConnection* connection =
524 parent_->GetOrTerminateProcess(&map_, params.ipc_database_id); 522 parent_->GetOrTerminateProcess(&map_, params.ipc_database_id);
525 if (!connection) 523 if (!connection)
526 return; 524 return;
527 scoped_refptr<IndexedDBCallbacks> callbacks(IndexedDBCallbacks::Create( 525 scoped_refptr<IndexedDBCallbacks> callbacks(IndexedDBCallbacks::Create(
528 parent_, params.ipc_thread_id, params.ipc_callbacks_id)); 526 parent_, params.ipc_thread_id, params.ipc_callbacks_id));
529 527
530 int64 host_transaction_id = parent_->HostTransactionId(params.transaction_id); 528 int64 host_transaction_id = parent_->HostTransactionId(params.transaction_id);
531 // TODO(alecflett): Avoid a copy here. 529 // TODO(alecflett): Avoid a copy here.
532 std::vector<char> value_copy = params.value; 530 std::string value_copy(params.value);
533 connection->database()->Put( 531 connection->database()->Put(
534 host_transaction_id, 532 host_transaction_id,
535 params.object_store_id, 533 params.object_store_id,
536 &value_copy, 534 &value_copy,
537 make_scoped_ptr(new IndexedDBKey(params.key)), 535 make_scoped_ptr(new IndexedDBKey(params.key)),
538 static_cast<IndexedDBDatabase::PutMode>(params.put_mode), 536 static_cast<IndexedDBDatabase::PutMode>(params.put_mode),
539 callbacks, 537 callbacks,
540 params.index_ids, 538 params.index_ids,
541 params.index_keys); 539 params.index_keys);
542 TransactionIDToSizeMap* map = 540 TransactionIDToSizeMap* map =
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
851 } 849 }
852 850
853 void IndexedDBDispatcherHost::CursorDispatcherHost::OnDestroyed( 851 void IndexedDBDispatcherHost::CursorDispatcherHost::OnDestroyed(
854 int32 ipc_object_id) { 852 int32 ipc_object_id) {
855 DCHECK( 853 DCHECK(
856 parent_->indexed_db_context_->TaskRunner()->RunsTasksOnCurrentThread()); 854 parent_->indexed_db_context_->TaskRunner()->RunsTasksOnCurrentThread());
857 parent_->DestroyObject(&map_, ipc_object_id); 855 parent_->DestroyObject(&map_, ipc_object_id);
858 } 856 }
859 857
860 } // namespace content 858 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698