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

Side by Side Diff: content/renderer/indexed_db_dispatcher.cc

Issue 8779003: Chromium side of IDBIndex.count() and IDBObjectStore.count() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Accomodate worker thread changes Created 9 years 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
« no previous file with comments | « content/renderer/indexed_db_dispatcher.h ('k') | content/renderer/renderer_webidbindex_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/renderer/indexed_db_dispatcher.h" 5 #include "content/renderer/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/indexed_db_messages.h" 9 #include "content/common/indexed_db_messages.h"
10 #include "content/renderer/render_thread_impl.h" 10 #include "content/renderer/render_thread_impl.h"
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 params.lower_open = idb_key_range.lowerOpen(); 313 params.lower_open = idb_key_range.lowerOpen();
314 params.upper_open = idb_key_range.upperOpen(); 314 params.upper_open = idb_key_range.upperOpen();
315 params.direction = direction; 315 params.direction = direction;
316 params.idb_index_id = idb_index_id; 316 params.idb_index_id = idb_index_id;
317 params.transaction_id = TransactionId(transaction); 317 params.transaction_id = TransactionId(transaction);
318 Send(new IndexedDBHostMsg_IndexOpenKeyCursor(params, ec)); 318 Send(new IndexedDBHostMsg_IndexOpenKeyCursor(params, ec));
319 if (*ec) 319 if (*ec)
320 pending_callbacks_.Remove(params.response_id); 320 pending_callbacks_.Remove(params.response_id);
321 } 321 }
322 322
323 void IndexedDBDispatcher::RequestIDBIndexCount(
324 const WebIDBKeyRange& idb_key_range,
325 WebIDBCallbacks* callbacks_ptr,
326 int32 idb_index_id,
327 const WebIDBTransaction& transaction,
328 WebExceptionCode* ec) {
329 ResetCursorPrefetchCaches();
330 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr);
331 IndexedDBHostMsg_IndexCount_Params params;
332 params.thread_id = CurrentWorkerId();
333 params.response_id = pending_callbacks_.Add(callbacks.release());
334 params.lower_key.Set(idb_key_range.lower());
335 params.upper_key.Set(idb_key_range.upper());
336 params.lower_open = idb_key_range.lowerOpen();
337 params.upper_open = idb_key_range.upperOpen();
338 params.idb_index_id = idb_index_id;
339 params.transaction_id = TransactionId(transaction);
340 Send(new IndexedDBHostMsg_IndexCount(params, ec));
341 if (*ec)
342 pending_callbacks_.Remove(params.response_id);
343 }
344
323 void IndexedDBDispatcher::RequestIDBIndexGetObject( 345 void IndexedDBDispatcher::RequestIDBIndexGetObject(
324 const IndexedDBKey& key, 346 const IndexedDBKey& key,
325 WebIDBCallbacks* callbacks_ptr, 347 WebIDBCallbacks* callbacks_ptr,
326 int32 idb_index_id, 348 int32 idb_index_id,
327 const WebIDBTransaction& transaction, 349 const WebIDBTransaction& transaction,
328 WebExceptionCode* ec) { 350 WebExceptionCode* ec) {
329 ResetCursorPrefetchCaches(); 351 ResetCursorPrefetchCaches();
330 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); 352 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr);
331 int32 response_id = pending_callbacks_.Add(callbacks.release()); 353 int32 response_id = pending_callbacks_.Add(callbacks.release());
332 Send(new IndexedDBHostMsg_IndexGetObject(idb_index_id, CurrentWorkerId(), 354 Send(new IndexedDBHostMsg_IndexGetObject(idb_index_id, CurrentWorkerId(),
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 params.lower_open = idb_key_range.lowerOpen(); 464 params.lower_open = idb_key_range.lowerOpen();
443 params.upper_open = idb_key_range.upperOpen(); 465 params.upper_open = idb_key_range.upperOpen();
444 params.direction = direction; 466 params.direction = direction;
445 params.idb_object_store_id = idb_object_store_id; 467 params.idb_object_store_id = idb_object_store_id;
446 params.transaction_id = TransactionId(transaction); 468 params.transaction_id = TransactionId(transaction);
447 Send(new IndexedDBHostMsg_ObjectStoreOpenCursor(params, ec)); 469 Send(new IndexedDBHostMsg_ObjectStoreOpenCursor(params, ec));
448 if (*ec) 470 if (*ec)
449 pending_callbacks_.Remove(params.response_id); 471 pending_callbacks_.Remove(params.response_id);
450 } 472 }
451 473
474 void IndexedDBDispatcher::RequestIDBObjectStoreCount(
475 const WebIDBKeyRange& idb_key_range,
476 WebIDBCallbacks* callbacks_ptr,
477 int32 idb_object_store_id,
478 const WebIDBTransaction& transaction,
479 WebExceptionCode* ec) {
480 ResetCursorPrefetchCaches();
481 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr);
482 IndexedDBHostMsg_ObjectStoreCount_Params params;
483 params.thread_id = CurrentWorkerId();
484 params.response_id = pending_callbacks_.Add(callbacks.release());
485 params.lower_key.Set(idb_key_range.lower());
486 params.upper_key.Set(idb_key_range.upper());
487 params.lower_open = idb_key_range.lowerOpen();
488 params.upper_open = idb_key_range.upperOpen();
489 params.idb_object_store_id = idb_object_store_id;
490 params.transaction_id = TransactionId(transaction);
491 Send(new IndexedDBHostMsg_ObjectStoreCount(params, ec));
492 if (*ec)
493 pending_callbacks_.Remove(params.response_id);
494 }
495
452 void IndexedDBDispatcher::RegisterWebIDBTransactionCallbacks( 496 void IndexedDBDispatcher::RegisterWebIDBTransactionCallbacks(
453 WebIDBTransactionCallbacks* callbacks, 497 WebIDBTransactionCallbacks* callbacks,
454 int32 id) { 498 int32 id) {
455 pending_transaction_callbacks_.AddWithID(callbacks, id); 499 pending_transaction_callbacks_.AddWithID(callbacks, id);
456 } 500 }
457 501
458 void IndexedDBDispatcher::CursorDestroyed(int32 cursor_id) { 502 void IndexedDBDispatcher::CursorDestroyed(int32 cursor_id) {
459 cursors_.erase(cursor_id); 503 cursors_.erase(cursor_id);
460 } 504 }
461 505
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
634 } 678 }
635 679
636 void IndexedDBDispatcher::ResetCursorPrefetchCaches(int32 exception_cursor_id) { 680 void IndexedDBDispatcher::ResetCursorPrefetchCaches(int32 exception_cursor_id) {
637 typedef std::map<int32, RendererWebIDBCursorImpl*>::iterator Iterator; 681 typedef std::map<int32, RendererWebIDBCursorImpl*>::iterator Iterator;
638 for (Iterator i = cursors_.begin(); i != cursors_.end(); ++i) { 682 for (Iterator i = cursors_.begin(); i != cursors_.end(); ++i) {
639 if (i->first == exception_cursor_id) 683 if (i->first == exception_cursor_id)
640 continue; 684 continue;
641 i->second->ResetPrefetchCache(); 685 i->second->ResetPrefetchCache();
642 } 686 }
643 } 687 }
OLDNEW
« no previous file with comments | « content/renderer/indexed_db_dispatcher.h ('k') | content/renderer/renderer_webidbindex_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698