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

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

Issue 19117005: IndexedDB: Coding conventions and cleanup (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 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 "base/format_macros.h" 7 #include "base/format_macros.h"
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "base/threading/thread_local.h" 10 #include "base/threading/thread_local.h"
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 // There won't be pending database callbacks if the transaction was aborted in 272 // There won't be pending database callbacks if the transaction was aborted in
273 // the initial upgradeneeded event handler. 273 // the initial upgradeneeded event handler.
274 if (pending_database_callbacks_.Lookup(ipc_database_callbacks_id)) 274 if (pending_database_callbacks_.Lookup(ipc_database_callbacks_id))
275 pending_database_callbacks_.Remove(ipc_database_callbacks_id); 275 pending_database_callbacks_.Remove(ipc_database_callbacks_id);
276 } 276 }
277 277
278 void IndexedDBDispatcher::RequestIDBDatabaseCreateTransaction( 278 void IndexedDBDispatcher::RequestIDBDatabaseCreateTransaction(
279 int32 ipc_database_id, 279 int32 ipc_database_id,
280 int64 transaction_id, 280 int64 transaction_id,
281 WebIDBDatabaseCallbacks* database_callbacks_ptr, 281 WebIDBDatabaseCallbacks* database_callbacks_ptr,
282 WebKit::WebVector<long long> object_store_ids, 282 WebVector<long long> object_store_ids,
283 unsigned short mode) { 283 unsigned short mode) {
284 scoped_ptr<WebIDBDatabaseCallbacks> database_callbacks( 284 scoped_ptr<WebIDBDatabaseCallbacks> database_callbacks(
285 database_callbacks_ptr); 285 database_callbacks_ptr);
286 IndexedDBHostMsg_DatabaseCreateTransaction_Params params; 286 IndexedDBHostMsg_DatabaseCreateTransaction_Params params;
287 params.ipc_thread_id = CurrentWorkerId(); 287 params.ipc_thread_id = CurrentWorkerId();
288 params.ipc_database_id = ipc_database_id; 288 params.ipc_database_id = ipc_database_id;
289 params.transaction_id = transaction_id; 289 params.transaction_id = transaction_id;
290 params.ipc_database_callbacks_id = 290 params.ipc_database_callbacks_id =
291 pending_database_callbacks_.Add(database_callbacks.release()); 291 pending_database_callbacks_.Add(database_callbacks.release());
292 params.object_store_ids 292 params.object_store_ids
(...skipping 26 matching lines...) Expand all
319 319
320 void IndexedDBDispatcher::RequestIDBDatabasePut( 320 void IndexedDBDispatcher::RequestIDBDatabasePut(
321 int32 ipc_database_id, 321 int32 ipc_database_id,
322 int64 transaction_id, 322 int64 transaction_id,
323 int64 object_store_id, 323 int64 object_store_id,
324 const WebData& value, 324 const WebData& value,
325 const IndexedDBKey& key, 325 const IndexedDBKey& key,
326 WebIDBDatabase::PutMode put_mode, 326 WebIDBDatabase::PutMode put_mode,
327 WebIDBCallbacks* callbacks, 327 WebIDBCallbacks* callbacks,
328 const WebVector<long long>& index_ids, 328 const WebVector<long long>& index_ids,
329 const WebVector<WebKit::WebVector<WebIDBKey> >& index_keys) { 329 const WebVector<WebVector<WebIDBKey> >& index_keys) {
330 330
331 if (value.size() > kMaxIDBValueSizeInBytes) { 331 if (value.size() > kMaxIDBValueSizeInBytes) {
332 callbacks->onError(WebIDBDatabaseError( 332 callbacks->onError(WebIDBDatabaseError(
333 WebKit::WebIDBDatabaseExceptionUnknownError, 333 WebKit::WebIDBDatabaseExceptionUnknownError,
334 WebString::fromUTF8(base::StringPrintf( 334 WebString::fromUTF8(base::StringPrintf(
335 "The serialized value is too large" 335 "The serialized value is too large"
336 " (size=%" PRIuS " bytes, max=%" PRIuS " bytes).", 336 " (size=%" PRIuS " bytes, max=%" PRIuS " bytes).",
337 value.size(), 337 value.size(),
338 kMaxIDBValueSizeInBytes).c_str()))); 338 kMaxIDBValueSizeInBytes).c_str())));
339 return; 339 return;
(...skipping 26 matching lines...) Expand all
366 } 366 }
367 367
368 void IndexedDBDispatcher::RequestIDBDatabaseOpenCursor( 368 void IndexedDBDispatcher::RequestIDBDatabaseOpenCursor(
369 int32 ipc_database_id, 369 int32 ipc_database_id,
370 int64 transaction_id, 370 int64 transaction_id,
371 int64 object_store_id, 371 int64 object_store_id,
372 int64 index_id, 372 int64 index_id,
373 const IndexedDBKeyRange& key_range, 373 const IndexedDBKeyRange& key_range,
374 unsigned short direction, 374 unsigned short direction,
375 bool key_only, 375 bool key_only,
376 WebKit::WebIDBDatabase::TaskType task_type, 376 WebIDBDatabase::TaskType task_type,
377 WebIDBCallbacks* callbacks) { 377 WebIDBCallbacks* callbacks) {
378 ResetCursorPrefetchCaches(); 378 ResetCursorPrefetchCaches();
379 IndexedDBHostMsg_DatabaseOpenCursor_Params params; 379 IndexedDBHostMsg_DatabaseOpenCursor_Params params;
380 init_params(params, callbacks); 380 init_params(params, callbacks);
381 params.ipc_database_id = ipc_database_id; 381 params.ipc_database_id = ipc_database_id;
382 params.transaction_id = transaction_id; 382 params.transaction_id = transaction_id;
383 params.object_store_id = object_store_id; 383 params.object_store_id = object_store_id;
384 params.index_id = index_id; 384 params.index_id = index_id;
385 params.key_range = IndexedDBKeyRange(key_range); 385 params.key_range = key_range;
386 params.direction = direction; 386 params.direction = direction;
387 params.key_only = key_only; 387 params.key_only = key_only;
388 params.task_type = task_type; 388 params.task_type = task_type;
389 Send(new IndexedDBHostMsg_DatabaseOpenCursor(params)); 389 Send(new IndexedDBHostMsg_DatabaseOpenCursor(params));
390 } 390 }
391 391
392 void IndexedDBDispatcher::RequestIDBDatabaseCount( 392 void IndexedDBDispatcher::RequestIDBDatabaseCount(
393 int32 ipc_database_id, 393 int32 ipc_database_id,
394 int64 transaction_id, 394 int64 transaction_id,
395 int64 object_store_id, 395 int64 object_store_id,
396 int64 index_id, 396 int64 index_id,
397 const IndexedDBKeyRange& key_range, 397 const IndexedDBKeyRange& key_range,
398 WebKit::WebIDBCallbacks* callbacks) { 398 WebIDBCallbacks* callbacks) {
399 ResetCursorPrefetchCaches(); 399 ResetCursorPrefetchCaches();
400 IndexedDBHostMsg_DatabaseCount_Params params; 400 IndexedDBHostMsg_DatabaseCount_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 params.index_id = index_id; 405 params.index_id = index_id;
406 params.key_range = IndexedDBKeyRange(key_range); 406 params.key_range = key_range;
407 Send(new IndexedDBHostMsg_DatabaseCount(params)); 407 Send(new IndexedDBHostMsg_DatabaseCount(params));
408 } 408 }
409 409
410 void IndexedDBDispatcher::RequestIDBDatabaseDeleteRange( 410 void IndexedDBDispatcher::RequestIDBDatabaseDeleteRange(
411 int32 ipc_database_id, 411 int32 ipc_database_id,
412 int64 transaction_id, 412 int64 transaction_id,
413 int64 object_store_id, 413 int64 object_store_id,
414 const IndexedDBKeyRange& key_range, 414 const IndexedDBKeyRange& key_range,
415 WebKit::WebIDBCallbacks* callbacks) { 415 WebIDBCallbacks* callbacks) {
416 ResetCursorPrefetchCaches(); 416 ResetCursorPrefetchCaches();
417 IndexedDBHostMsg_DatabaseDeleteRange_Params params; 417 IndexedDBHostMsg_DatabaseDeleteRange_Params params;
418 init_params(params, callbacks); 418 init_params(params, callbacks);
419 params.ipc_database_id = ipc_database_id; 419 params.ipc_database_id = ipc_database_id;
420 params.transaction_id = transaction_id; 420 params.transaction_id = transaction_id;
421 params.object_store_id = object_store_id; 421 params.object_store_id = object_store_id;
422 params.key_range = key_range; 422 params.key_range = key_range;
423 Send(new IndexedDBHostMsg_DatabaseDeleteRange(params)); 423 Send(new IndexedDBHostMsg_DatabaseDeleteRange(params));
424 } 424 }
425 425
426 void IndexedDBDispatcher::RequestIDBDatabaseClear( 426 void IndexedDBDispatcher::RequestIDBDatabaseClear(
427 int32 ipc_database_id, 427 int32 ipc_database_id,
428 int64 transaction_id, 428 int64 transaction_id,
429 int64 object_store_id, 429 int64 object_store_id,
430 WebKit::WebIDBCallbacks* callbacks_ptr) { 430 WebIDBCallbacks* callbacks_ptr) {
431 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); 431 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr);
432 int32 ipc_callbacks_id = pending_callbacks_.Add(callbacks.release()); 432 int32 ipc_callbacks_id = pending_callbacks_.Add(callbacks.release());
433 Send(new IndexedDBHostMsg_DatabaseClear(CurrentWorkerId(), 433 Send(new IndexedDBHostMsg_DatabaseClear(CurrentWorkerId(),
434 ipc_callbacks_id, 434 ipc_callbacks_id,
435 ipc_database_id, 435 ipc_database_id,
436 transaction_id, 436 transaction_id,
437 object_store_id)); 437 object_store_id));
438 } 438 }
439 439
440 void IndexedDBDispatcher::CursorDestroyed(int32 ipc_cursor_id) { 440 void IndexedDBDispatcher::CursorDestroyed(int32 ipc_cursor_id) {
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
707 int32 ipc_exception_cursor_id) { 707 int32 ipc_exception_cursor_id) {
708 typedef std::map<int32, RendererWebIDBCursorImpl*>::iterator Iterator; 708 typedef std::map<int32, RendererWebIDBCursorImpl*>::iterator Iterator;
709 for (Iterator i = cursors_.begin(); i != cursors_.end(); ++i) { 709 for (Iterator i = cursors_.begin(); i != cursors_.end(); ++i) {
710 if (i->first == ipc_exception_cursor_id) 710 if (i->first == ipc_exception_cursor_id)
711 continue; 711 continue;
712 i->second->ResetPrefetchCache(); 712 i->second->ResetPrefetchCache();
713 } 713 }
714 } 714 }
715 715
716 } // namespace content 716 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698