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

Side by Side Diff: content/child/indexed_db/indexed_db_dispatcher.cc

Issue 138703002: IndexedDB: Replace passing identically-sized vectors with pairs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased again Created 6 years, 11 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/child/indexed_db/indexed_db_dispatcher.h" 5 #include "content/child/indexed_db/indexed_db_dispatcher.h"
6 6
7 #include <utility>
8
7 #include "base/format_macros.h" 9 #include "base/format_macros.h"
8 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
9 #include "base/strings/stringprintf.h" 11 #include "base/strings/stringprintf.h"
10 #include "base/threading/thread_local.h" 12 #include "base/threading/thread_local.h"
11 #include "content/child/indexed_db/indexed_db_key_builders.h" 13 #include "content/child/indexed_db/indexed_db_key_builders.h"
12 #include "content/child/indexed_db/webidbcursor_impl.h" 14 #include "content/child/indexed_db/webidbcursor_impl.h"
13 #include "content/child/indexed_db/webidbdatabase_impl.h" 15 #include "content/child/indexed_db/webidbdatabase_impl.h"
14 #include "content/child/thread_safe_sender.h" 16 #include "content/child/thread_safe_sender.h"
15 #include "content/common/indexed_db/indexed_db_constants.h" 17 #include "content/common/indexed_db/indexed_db_constants.h"
16 #include "content/common/indexed_db/indexed_db_messages.h" 18 #include "content/common/indexed_db/indexed_db_messages.h"
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 IndexedDBHostMsg_DatabasePut_Params params; 341 IndexedDBHostMsg_DatabasePut_Params params;
340 init_params(params, callbacks); 342 init_params(params, callbacks);
341 params.ipc_database_id = ipc_database_id; 343 params.ipc_database_id = ipc_database_id;
342 params.transaction_id = transaction_id; 344 params.transaction_id = transaction_id;
343 params.object_store_id = object_store_id; 345 params.object_store_id = object_store_id;
344 346
345 params.value.assign(value.data(), value.data() + value.size()); 347 params.value.assign(value.data(), value.data() + value.size());
346 params.key = key; 348 params.key = key;
347 params.put_mode = put_mode; 349 params.put_mode = put_mode;
348 350
349 COMPILE_ASSERT(sizeof(params.index_ids[0]) == sizeof(index_ids[0]), 351 DCHECK_EQ(index_ids.size(), index_keys.size());
350 Cant_copy); 352 params.index_keys.resize(index_ids.size());
351 params.index_ids 353 for (size_t i = 0, len = index_ids.size(); i < len; ++i) {
352 .assign(index_ids.data(), index_ids.data() + index_ids.size()); 354 params.index_keys[i].first = index_ids[i];
353 355 params.index_keys[i].second.resize(index_keys[i].size());
354 params.index_keys.resize(index_keys.size());
355 for (size_t i = 0; i < index_keys.size(); ++i) {
356 params.index_keys[i].resize(index_keys[i].size());
357 for (size_t j = 0; j < index_keys[i].size(); ++j) { 356 for (size_t j = 0; j < index_keys[i].size(); ++j) {
358 params.index_keys[i][j] = 357 params.index_keys[i].second[j] =
359 IndexedDBKey(IndexedDBKeyBuilder::Build(index_keys[i][j])); 358 IndexedDBKey(IndexedDBKeyBuilder::Build(index_keys[i][j]));
360 } 359 }
361 } 360 }
361
362 Send(new IndexedDBHostMsg_DatabasePut(params)); 362 Send(new IndexedDBHostMsg_DatabasePut(params));
363 } 363 }
364 364
365 void IndexedDBDispatcher::RequestIDBDatabaseOpenCursor( 365 void IndexedDBDispatcher::RequestIDBDatabaseOpenCursor(
366 int32 ipc_database_id, 366 int32 ipc_database_id,
367 int64 transaction_id, 367 int64 transaction_id,
368 int64 object_store_id, 368 int64 object_store_id,
369 int64 index_id, 369 int64 index_id,
370 const IndexedDBKeyRange& key_range, 370 const IndexedDBKeyRange& key_range,
371 unsigned short direction, 371 unsigned short direction,
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
717 // TODO(jsbell): Only reset cursors from the same transaction. 717 // TODO(jsbell): Only reset cursors from the same transaction.
718 typedef std::map<int32, WebIDBCursorImpl*>::iterator Iterator; 718 typedef std::map<int32, WebIDBCursorImpl*>::iterator Iterator;
719 for (Iterator i = cursors_.begin(); i != cursors_.end(); ++i) { 719 for (Iterator i = cursors_.begin(); i != cursors_.end(); ++i) {
720 if (i->first == ipc_exception_cursor_id) 720 if (i->first == ipc_exception_cursor_id)
721 continue; 721 continue;
722 i->second->ResetPrefetchCache(); 722 i->second->ResetPrefetchCache();
723 } 723 }
724 } 724 }
725 725
726 } // namespace content 726 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/indexed_db/indexed_db_index_writer.cc ('k') | content/child/indexed_db/webidbdatabase_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698