OLD | NEW |
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 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 | 387 |
388 void IDBDatabase::closeConnection() { | 388 void IDBDatabase::closeConnection() { |
389 DCHECK(m_closePending); | 389 DCHECK(m_closePending); |
390 DCHECK(m_transactions.isEmpty()); | 390 DCHECK(m_transactions.isEmpty()); |
391 | 391 |
392 if (m_backend) { | 392 if (m_backend) { |
393 m_backend->close(); | 393 m_backend->close(); |
394 m_backend.reset(); | 394 m_backend.reset(); |
395 } | 395 } |
396 | 396 |
| 397 if (m_databaseCallbacks) |
| 398 m_databaseCallbacks->detachWebCallbacks(); |
| 399 |
397 if (m_contextStopped || !getExecutionContext()) | 400 if (m_contextStopped || !getExecutionContext()) |
398 return; | 401 return; |
399 | 402 |
400 EventQueue* eventQueue = getExecutionContext()->getEventQueue(); | 403 EventQueue* eventQueue = getExecutionContext()->getEventQueue(); |
401 // Remove any pending versionchange events scheduled to fire on this | 404 // Remove any pending versionchange events scheduled to fire on this |
402 // connection. They would have been scheduled by the backend when another | 405 // connection. They would have been scheduled by the backend when another |
403 // connection attempted an upgrade, but the frontend connection is being | 406 // connection attempted an upgrade, but the frontend connection is being |
404 // closed before they could fire. | 407 // closed before they could fire. |
405 for (size_t i = 0; i < m_enqueuedEvents.size(); ++i) { | 408 for (size_t i = 0; i < m_enqueuedEvents.size(); ++i) { |
406 bool removed = eventQueue->cancelEvent(m_enqueuedEvents[i].get()); | 409 bool removed = eventQueue->cancelEvent(m_enqueuedEvents[i].get()); |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 void IDBDatabase::contextDestroyed() { | 522 void IDBDatabase::contextDestroyed() { |
520 m_contextStopped = true; | 523 m_contextStopped = true; |
521 | 524 |
522 // Immediately close the connection to the back end. Don't attempt a | 525 // Immediately close the connection to the back end. Don't attempt a |
523 // normal close() since that may wait on transactions which require a | 526 // normal close() since that may wait on transactions which require a |
524 // round trip to the back-end to abort. | 527 // round trip to the back-end to abort. |
525 if (m_backend) { | 528 if (m_backend) { |
526 m_backend->close(); | 529 m_backend->close(); |
527 m_backend.reset(); | 530 m_backend.reset(); |
528 } | 531 } |
| 532 |
| 533 if (m_databaseCallbacks) |
| 534 m_databaseCallbacks->detachWebCallbacks(); |
529 } | 535 } |
530 | 536 |
531 const AtomicString& IDBDatabase::interfaceName() const { | 537 const AtomicString& IDBDatabase::interfaceName() const { |
532 return EventTargetNames::IDBDatabase; | 538 return EventTargetNames::IDBDatabase; |
533 } | 539 } |
534 | 540 |
535 ExecutionContext* IDBDatabase::getExecutionContext() const { | 541 ExecutionContext* IDBDatabase::getExecutionContext() const { |
536 return ActiveDOMObject::getExecutionContext(); | 542 return ActiveDOMObject::getExecutionContext(); |
537 } | 543 } |
538 | 544 |
539 void IDBDatabase::recordApiCallsHistogram(IndexedDatabaseMethods method) { | 545 void IDBDatabase::recordApiCallsHistogram(IndexedDatabaseMethods method) { |
540 DEFINE_THREAD_SAFE_STATIC_LOCAL( | 546 DEFINE_THREAD_SAFE_STATIC_LOCAL( |
541 EnumerationHistogram, apiCallsHistogram, | 547 EnumerationHistogram, apiCallsHistogram, |
542 new EnumerationHistogram("WebCore.IndexedDB.FrontEndAPICalls", | 548 new EnumerationHistogram("WebCore.IndexedDB.FrontEndAPICalls", |
543 IDBMethodsMax)); | 549 IDBMethodsMax)); |
544 apiCallsHistogram.count(method); | 550 apiCallsHistogram.count(method); |
545 } | 551 } |
546 | 552 |
547 } // namespace blink | 553 } // namespace blink |
OLD | NEW |