OLD | NEW |
---|---|
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/common/indexed_db/indexed_db_dispatcher.h" | 5 #include "content/common/indexed_db/indexed_db_dispatcher.h" |
6 | 6 |
7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
8 #include "base/threading/thread_local.h" | 8 #include "base/threading/thread_local.h" |
9 #include "content/common/child_thread.h" | 9 #include "content/common/child_thread.h" |
10 #include "content/common/indexed_db/indexed_db_messages.h" | 10 #include "content/common/indexed_db/indexed_db_messages.h" |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
378 params.ipc_database_id = ipc_database_id; | 378 params.ipc_database_id = ipc_database_id; |
379 params.transaction_id = transaction_id; | 379 params.transaction_id = transaction_id; |
380 params.object_store_id = object_store_id; | 380 params.object_store_id = object_store_id; |
381 params.index_id = index_id; | 381 params.index_id = index_id; |
382 params.key_range = key_range; | 382 params.key_range = key_range; |
383 params.key_only = key_only; | 383 params.key_only = key_only; |
384 Send(new IndexedDBHostMsg_DatabaseGet(params)); | 384 Send(new IndexedDBHostMsg_DatabaseGet(params)); |
385 } | 385 } |
386 | 386 |
387 | 387 |
388 void IndexedDBDispatcher::RequestIDBDatabasePut( | 388 void IndexedDBDispatcher::RequestIDBDatabasePutOld( |
389 int32 ipc_database_id, | 389 int32 ipc_database_id, |
390 int64 transaction_id, | 390 int64 transaction_id, |
391 int64 object_store_id, | 391 int64 object_store_id, |
392 WebKit::WebVector<unsigned char>* value, | 392 WebKit::WebVector<unsigned char>* value, |
393 const IndexedDBKey& key, | 393 const IndexedDBKey& key, |
394 WebKit::WebIDBDatabase::PutMode put_mode, | 394 WebKit::WebIDBDatabase::PutMode put_mode, |
395 WebKit::WebIDBCallbacks* callbacks, | 395 WebKit::WebIDBCallbacks* callbacks, |
396 const WebKit::WebVector<long long>& index_ids, | 396 const WebKit::WebVector<long long>& index_ids, |
397 const WebKit::WebVector<WebKit::WebVector< | 397 const WebKit::WebVector<WebKit::WebVector< |
398 WebKit::WebIDBKey> >& index_keys) { | 398 WebKit::WebIDBKey> >& index_keys) { |
399 ResetCursorPrefetchCaches(); | 399 ResetCursorPrefetchCaches(); |
400 IndexedDBHostMsg_DatabasePut_Params params; | 400 IndexedDBHostMsg_DatabasePutOld_Params params; |
401 init_params(params, callbacks); | 401 init_params(params, callbacks); |
402 params.ipc_database_id = ipc_database_id; | 402 params.ipc_database_id = ipc_database_id; |
403 params.transaction_id = transaction_id; | 403 params.transaction_id = transaction_id; |
404 params.object_store_id = object_store_id; | 404 params.object_store_id = object_store_id; |
405 | 405 |
406 COMPILE_ASSERT(sizeof(params.value[0]) == sizeof((*value)[0]), Cant_copy); | 406 COMPILE_ASSERT(sizeof(params.value[0]) == sizeof((*value)[0]), Cant_copy); |
407 params.value.assign(value->data(), value->data() + value->size()); | 407 params.value.assign(value->data(), value->data() + value->size()); |
408 params.key = key; | 408 params.key = key; |
409 params.put_mode = put_mode; | 409 params.put_mode = put_mode; |
410 | 410 |
411 COMPILE_ASSERT(sizeof(params.index_ids[0]) == | 411 COMPILE_ASSERT(sizeof(params.index_ids[0]) == |
412 sizeof(index_ids[0]), Cant_copy); | 412 sizeof(index_ids[0]), Cant_copy); |
413 params.index_ids.assign(index_ids.data(), | 413 params.index_ids.assign(index_ids.data(), |
414 index_ids.data() + index_ids.size()); | 414 index_ids.data() + index_ids.size()); |
415 | 415 |
416 params.index_keys.resize(index_keys.size()); | 416 params.index_keys.resize(index_keys.size()); |
417 for (size_t i = 0; i < index_keys.size(); ++i) { | 417 for (size_t i = 0; i < index_keys.size(); ++i) { |
418 params.index_keys[i].resize(index_keys[i].size()); | 418 params.index_keys[i].resize(index_keys[i].size()); |
419 for (size_t j = 0; j < index_keys[i].size(); ++j) { | 419 for (size_t j = 0; j < index_keys[i].size(); ++j) { |
420 params.index_keys[i][j] = IndexedDBKey(index_keys[i][j]); | 420 params.index_keys[i][j] = IndexedDBKey(index_keys[i][j]); |
421 } | 421 } |
422 } | 422 } |
423 Send(new IndexedDBHostMsg_DatabasePutOld(params)); | |
424 } | |
425 | |
426 void IndexedDBDispatcher::RequestIDBDatabasePut( | |
427 int32 ipc_database_id, | |
428 int64 transaction_id, | |
429 int64 object_store_id, | |
430 const WebKit::WebData& value, | |
jsbell
2013/02/07 00:06:07
ditto
| |
431 const IndexedDBKey& key, | |
432 WebKit::WebIDBDatabase::PutMode put_mode, | |
jsbell
2013/02/07 00:06:07
And this webKit:: prefix shouldn't be necessary be
| |
433 WebKit::WebIDBCallbacks* callbacks, | |
jsbell
2013/02/07 00:06:07
Or this one, etc.
| |
434 const WebKit::WebVector<long long>& index_ids, | |
435 const WebKit::WebVector<WebKit::WebVector< | |
436 WebKit::WebIDBKey> >& index_keys) { | |
437 ResetCursorPrefetchCaches(); | |
438 IndexedDBHostMsg_DatabasePut_Params params; | |
439 init_params(params, callbacks); | |
440 params.ipc_database_id = ipc_database_id; | |
441 params.transaction_id = transaction_id; | |
442 params.object_store_id = object_store_id; | |
443 | |
444 params.value.assign(value.data(), value.data() + value.size()); | |
445 params.key = key; | |
446 params.put_mode = put_mode; | |
447 | |
448 COMPILE_ASSERT(sizeof(params.index_ids[0]) == | |
449 sizeof(index_ids[0]), Cant_copy); | |
450 params.index_ids.assign(index_ids.data(), | |
451 index_ids.data() + index_ids.size()); | |
452 | |
453 params.index_keys.resize(index_keys.size()); | |
454 for (size_t i = 0; i < index_keys.size(); ++i) { | |
455 params.index_keys[i].resize(index_keys[i].size()); | |
456 for (size_t j = 0; j < index_keys[i].size(); ++j) { | |
457 params.index_keys[i][j] = IndexedDBKey(index_keys[i][j]); | |
458 } | |
459 } | |
423 Send(new IndexedDBHostMsg_DatabasePut(params)); | 460 Send(new IndexedDBHostMsg_DatabasePut(params)); |
424 } | 461 } |
425 | 462 |
426 void IndexedDBDispatcher::RequestIDBDatabaseOpenCursor( | 463 void IndexedDBDispatcher::RequestIDBDatabaseOpenCursor( |
427 int32 ipc_database_id, | 464 int32 ipc_database_id, |
428 int64 transaction_id, | 465 int64 transaction_id, |
429 int64 object_store_id, | 466 int64 object_store_id, |
430 int64 index_id, | 467 int64 index_id, |
431 const IndexedDBKeyRange& key_range, | 468 const IndexedDBKeyRange& key_range, |
432 unsigned short direction, | 469 unsigned short direction, |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
754 int32 ipc_exception_cursor_id) { | 791 int32 ipc_exception_cursor_id) { |
755 typedef std::map<int32, RendererWebIDBCursorImpl*>::iterator Iterator; | 792 typedef std::map<int32, RendererWebIDBCursorImpl*>::iterator Iterator; |
756 for (Iterator i = cursors_.begin(); i != cursors_.end(); ++i) { | 793 for (Iterator i = cursors_.begin(); i != cursors_.end(); ++i) { |
757 if (i->first == ipc_exception_cursor_id) | 794 if (i->first == ipc_exception_cursor_id) |
758 continue; | 795 continue; |
759 i->second->ResetPrefetchCache(); | 796 i->second->ResetPrefetchCache(); |
760 } | 797 } |
761 } | 798 } |
762 | 799 |
763 } // namespace content | 800 } // namespace content |
OLD | NEW |