OLD | NEW |
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> | 7 #include <utility> |
8 | 8 |
9 #include "base/format_macros.h" | 9 #include "base/format_macros.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 void IndexedDBDispatcher::RequestIDBDatabaseGet( | 303 void IndexedDBDispatcher::RequestIDBDatabaseGet( |
304 int32 ipc_database_id, | 304 int32 ipc_database_id, |
305 int64 transaction_id, | 305 int64 transaction_id, |
306 int64 object_store_id, | 306 int64 object_store_id, |
307 int64 index_id, | 307 int64 index_id, |
308 const IndexedDBKeyRange& key_range, | 308 const IndexedDBKeyRange& key_range, |
309 bool key_only, | 309 bool key_only, |
310 WebIDBCallbacks* callbacks) { | 310 WebIDBCallbacks* callbacks) { |
311 ResetCursorPrefetchCaches(transaction_id, kAllCursors); | 311 ResetCursorPrefetchCaches(transaction_id, kAllCursors); |
312 IndexedDBHostMsg_DatabaseGet_Params params; | 312 IndexedDBHostMsg_DatabaseGet_Params params; |
313 init_params(params, callbacks); | 313 init_params(¶ms, callbacks); |
314 params.ipc_database_id = ipc_database_id; | 314 params.ipc_database_id = ipc_database_id; |
315 params.transaction_id = transaction_id; | 315 params.transaction_id = transaction_id; |
316 params.object_store_id = object_store_id; | 316 params.object_store_id = object_store_id; |
317 params.index_id = index_id; | 317 params.index_id = index_id; |
318 params.key_range = key_range; | 318 params.key_range = key_range; |
319 params.key_only = key_only; | 319 params.key_only = key_only; |
320 Send(new IndexedDBHostMsg_DatabaseGet(params)); | 320 Send(new IndexedDBHostMsg_DatabaseGet(params)); |
321 } | 321 } |
322 | 322 |
323 void IndexedDBDispatcher::RequestIDBDatabasePut( | 323 void IndexedDBDispatcher::RequestIDBDatabasePut( |
(...skipping 14 matching lines...) Expand all Loading... |
338 WebString::fromUTF8(base::StringPrintf( | 338 WebString::fromUTF8(base::StringPrintf( |
339 "The serialized value is too large" | 339 "The serialized value is too large" |
340 " (size=%" PRIuS " bytes, max=%" PRIuS " bytes).", | 340 " (size=%" PRIuS " bytes, max=%" PRIuS " bytes).", |
341 value.size(), | 341 value.size(), |
342 kMaxIDBValueSizeInBytes).c_str()))); | 342 kMaxIDBValueSizeInBytes).c_str()))); |
343 return; | 343 return; |
344 } | 344 } |
345 | 345 |
346 ResetCursorPrefetchCaches(transaction_id, kAllCursors); | 346 ResetCursorPrefetchCaches(transaction_id, kAllCursors); |
347 IndexedDBHostMsg_DatabasePut_Params params; | 347 IndexedDBHostMsg_DatabasePut_Params params; |
348 init_params(params, callbacks); | 348 init_params(¶ms, callbacks); |
349 params.ipc_database_id = ipc_database_id; | 349 params.ipc_database_id = ipc_database_id; |
350 params.transaction_id = transaction_id; | 350 params.transaction_id = transaction_id; |
351 params.object_store_id = object_store_id; | 351 params.object_store_id = object_store_id; |
352 | 352 |
353 params.value.assign(value.data(), value.data() + value.size()); | 353 params.value.assign(value.data(), value.data() + value.size()); |
354 params.key = key; | 354 params.key = key; |
355 params.put_mode = put_mode; | 355 params.put_mode = put_mode; |
356 | 356 |
357 DCHECK_EQ(index_ids.size(), index_keys.size()); | 357 DCHECK_EQ(index_ids.size(), index_keys.size()); |
358 params.index_keys.resize(index_ids.size()); | 358 params.index_keys.resize(index_ids.size()); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 int64 transaction_id, | 390 int64 transaction_id, |
391 int64 object_store_id, | 391 int64 object_store_id, |
392 int64 index_id, | 392 int64 index_id, |
393 const IndexedDBKeyRange& key_range, | 393 const IndexedDBKeyRange& key_range, |
394 WebIDBCursor::Direction direction, | 394 WebIDBCursor::Direction direction, |
395 bool key_only, | 395 bool key_only, |
396 WebIDBDatabase::TaskType task_type, | 396 WebIDBDatabase::TaskType task_type, |
397 WebIDBCallbacks* callbacks) { | 397 WebIDBCallbacks* callbacks) { |
398 ResetCursorPrefetchCaches(transaction_id, kAllCursors); | 398 ResetCursorPrefetchCaches(transaction_id, kAllCursors); |
399 IndexedDBHostMsg_DatabaseOpenCursor_Params params; | 399 IndexedDBHostMsg_DatabaseOpenCursor_Params params; |
400 init_params(params, callbacks); | 400 init_params(¶ms, callbacks); |
401 params.ipc_database_id = ipc_database_id; | 401 params.ipc_database_id = ipc_database_id; |
402 params.transaction_id = transaction_id; | 402 params.transaction_id = transaction_id; |
403 params.object_store_id = object_store_id; | 403 params.object_store_id = object_store_id; |
404 params.index_id = index_id; | 404 params.index_id = index_id; |
405 params.key_range = key_range; | 405 params.key_range = key_range; |
406 params.direction = direction; | 406 params.direction = direction; |
407 params.key_only = key_only; | 407 params.key_only = key_only; |
408 params.task_type = task_type; | 408 params.task_type = task_type; |
409 Send(new IndexedDBHostMsg_DatabaseOpenCursor(params)); | 409 Send(new IndexedDBHostMsg_DatabaseOpenCursor(params)); |
410 | 410 |
411 DCHECK(cursor_transaction_ids_.find(params.ipc_callbacks_id) == | 411 DCHECK(cursor_transaction_ids_.find(params.ipc_callbacks_id) == |
412 cursor_transaction_ids_.end()); | 412 cursor_transaction_ids_.end()); |
413 cursor_transaction_ids_[params.ipc_callbacks_id] = transaction_id; | 413 cursor_transaction_ids_[params.ipc_callbacks_id] = transaction_id; |
414 } | 414 } |
415 | 415 |
416 void IndexedDBDispatcher::RequestIDBDatabaseCount( | 416 void IndexedDBDispatcher::RequestIDBDatabaseCount( |
417 int32 ipc_database_id, | 417 int32 ipc_database_id, |
418 int64 transaction_id, | 418 int64 transaction_id, |
419 int64 object_store_id, | 419 int64 object_store_id, |
420 int64 index_id, | 420 int64 index_id, |
421 const IndexedDBKeyRange& key_range, | 421 const IndexedDBKeyRange& key_range, |
422 WebIDBCallbacks* callbacks) { | 422 WebIDBCallbacks* callbacks) { |
423 ResetCursorPrefetchCaches(transaction_id, kAllCursors); | 423 ResetCursorPrefetchCaches(transaction_id, kAllCursors); |
424 IndexedDBHostMsg_DatabaseCount_Params params; | 424 IndexedDBHostMsg_DatabaseCount_Params params; |
425 init_params(params, callbacks); | 425 init_params(¶ms, callbacks); |
426 params.ipc_database_id = ipc_database_id; | 426 params.ipc_database_id = ipc_database_id; |
427 params.transaction_id = transaction_id; | 427 params.transaction_id = transaction_id; |
428 params.object_store_id = object_store_id; | 428 params.object_store_id = object_store_id; |
429 params.index_id = index_id; | 429 params.index_id = index_id; |
430 params.key_range = key_range; | 430 params.key_range = key_range; |
431 Send(new IndexedDBHostMsg_DatabaseCount(params)); | 431 Send(new IndexedDBHostMsg_DatabaseCount(params)); |
432 } | 432 } |
433 | 433 |
434 void IndexedDBDispatcher::RequestIDBDatabaseDeleteRange( | 434 void IndexedDBDispatcher::RequestIDBDatabaseDeleteRange( |
435 int32 ipc_database_id, | 435 int32 ipc_database_id, |
436 int64 transaction_id, | 436 int64 transaction_id, |
437 int64 object_store_id, | 437 int64 object_store_id, |
438 const IndexedDBKeyRange& key_range, | 438 const IndexedDBKeyRange& key_range, |
439 WebIDBCallbacks* callbacks) { | 439 WebIDBCallbacks* callbacks) { |
440 ResetCursorPrefetchCaches(transaction_id, kAllCursors); | 440 ResetCursorPrefetchCaches(transaction_id, kAllCursors); |
441 IndexedDBHostMsg_DatabaseDeleteRange_Params params; | 441 IndexedDBHostMsg_DatabaseDeleteRange_Params params; |
442 init_params(params, callbacks); | 442 init_params(¶ms, callbacks); |
443 params.ipc_database_id = ipc_database_id; | 443 params.ipc_database_id = ipc_database_id; |
444 params.transaction_id = transaction_id; | 444 params.transaction_id = transaction_id; |
445 params.object_store_id = object_store_id; | 445 params.object_store_id = object_store_id; |
446 params.key_range = key_range; | 446 params.key_range = key_range; |
447 Send(new IndexedDBHostMsg_DatabaseDeleteRange(params)); | 447 Send(new IndexedDBHostMsg_DatabaseDeleteRange(params)); |
448 } | 448 } |
449 | 449 |
450 void IndexedDBDispatcher::RequestIDBDatabaseClear( | 450 void IndexedDBDispatcher::RequestIDBDatabaseClear( |
451 int32 ipc_database_id, | 451 int32 ipc_database_id, |
452 int64 transaction_id, | 452 int64 transaction_id, |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
792 typedef std::map<int32, WebIDBCursorImpl*>::iterator Iterator; | 792 typedef std::map<int32, WebIDBCursorImpl*>::iterator Iterator; |
793 for (Iterator i = cursors_.begin(); i != cursors_.end(); ++i) { | 793 for (Iterator i = cursors_.begin(); i != cursors_.end(); ++i) { |
794 if (i->first == ipc_exception_cursor_id || | 794 if (i->first == ipc_exception_cursor_id || |
795 i->second->transaction_id() != transaction_id) | 795 i->second->transaction_id() != transaction_id) |
796 continue; | 796 continue; |
797 i->second->ResetPrefetchCache(); | 797 i->second->ResetPrefetchCache(); |
798 } | 798 } |
799 } | 799 } |
800 | 800 |
801 } // namespace content | 801 } // namespace content |
OLD | NEW |