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

Side by Side Diff: third_party/WebKit/Source/modules/indexeddb/IDBDatabase.cpp

Issue 2370643004: Port messages sent by WebIDBFactoryImpl to Mojo. (Closed)
Patch Set: Addressed most of dcheng@'s feedback. Created 4 years, 2 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 406
407 void IDBDatabase::closeConnection() { 407 void IDBDatabase::closeConnection() {
408 DCHECK(m_closePending); 408 DCHECK(m_closePending);
409 DCHECK(m_transactions.isEmpty()); 409 DCHECK(m_transactions.isEmpty());
410 410
411 if (m_backend) { 411 if (m_backend) {
412 m_backend->close(); 412 m_backend->close();
413 m_backend.reset(); 413 m_backend.reset();
414 } 414 }
415 415
416 if (m_databaseCallbacks)
417 m_databaseCallbacks->detachWebCallbacks();
418
416 if (m_contextStopped || !getExecutionContext()) 419 if (m_contextStopped || !getExecutionContext())
417 return; 420 return;
418 421
419 EventQueue* eventQueue = getExecutionContext()->getEventQueue(); 422 EventQueue* eventQueue = getExecutionContext()->getEventQueue();
420 // Remove any pending versionchange events scheduled to fire on this 423 // Remove any pending versionchange events scheduled to fire on this
421 // connection. They would have been scheduled by the backend when another 424 // connection. They would have been scheduled by the backend when another
422 // connection attempted an upgrade, but the frontend connection is being 425 // connection attempted an upgrade, but the frontend connection is being
423 // closed before they could fire. 426 // closed before they could fire.
424 for (size_t i = 0; i < m_enqueuedEvents.size(); ++i) { 427 for (size_t i = 0; i < m_enqueuedEvents.size(); ++i) {
425 bool removed = eventQueue->cancelEvent(m_enqueuedEvents[i].get()); 428 bool removed = eventQueue->cancelEvent(m_enqueuedEvents[i].get());
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 void IDBDatabase::contextDestroyed() { 511 void IDBDatabase::contextDestroyed() {
509 m_contextStopped = true; 512 m_contextStopped = true;
510 513
511 // Immediately close the connection to the back end. Don't attempt a 514 // Immediately close the connection to the back end. Don't attempt a
512 // normal close() since that may wait on transactions which require a 515 // normal close() since that may wait on transactions which require a
513 // round trip to the back-end to abort. 516 // round trip to the back-end to abort.
514 if (m_backend) { 517 if (m_backend) {
515 m_backend->close(); 518 m_backend->close();
516 m_backend.reset(); 519 m_backend.reset();
517 } 520 }
521
522 if (m_databaseCallbacks)
523 m_databaseCallbacks->detachWebCallbacks();
518 } 524 }
519 525
520 const AtomicString& IDBDatabase::interfaceName() const { 526 const AtomicString& IDBDatabase::interfaceName() const {
521 return EventTargetNames::IDBDatabase; 527 return EventTargetNames::IDBDatabase;
522 } 528 }
523 529
524 ExecutionContext* IDBDatabase::getExecutionContext() const { 530 ExecutionContext* IDBDatabase::getExecutionContext() const {
525 return ActiveDOMObject::getExecutionContext(); 531 return ActiveDOMObject::getExecutionContext();
526 } 532 }
527 533
528 void IDBDatabase::recordApiCallsHistogram(IndexedDatabaseMethods method) { 534 void IDBDatabase::recordApiCallsHistogram(IndexedDatabaseMethods method) {
529 DEFINE_THREAD_SAFE_STATIC_LOCAL( 535 DEFINE_THREAD_SAFE_STATIC_LOCAL(
530 EnumerationHistogram, apiCallsHistogram, 536 EnumerationHistogram, apiCallsHistogram,
531 new EnumerationHistogram("WebCore.IndexedDB.FrontEndAPICalls", 537 new EnumerationHistogram("WebCore.IndexedDB.FrontEndAPICalls",
532 IDBMethodsMax)); 538 IDBMethodsMax));
533 apiCallsHistogram.count(method); 539 apiCallsHistogram.count(method);
534 } 540 }
535 541
536 } // namespace blink 542 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698