| 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 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 void IDBDatabase::closeConnection() | 357 void IDBDatabase::closeConnection() |
| 358 { | 358 { |
| 359 DCHECK(m_closePending); | 359 DCHECK(m_closePending); |
| 360 DCHECK(m_transactions.isEmpty()); | 360 DCHECK(m_transactions.isEmpty()); |
| 361 | 361 |
| 362 if (m_backend) { | 362 if (m_backend) { |
| 363 m_backend->close(); | 363 m_backend->close(); |
| 364 m_backend.reset(); | 364 m_backend.reset(); |
| 365 } | 365 } |
| 366 | 366 |
| 367 if (m_databaseCallbacks) |
| 368 m_databaseCallbacks->detachWebCallbacks(); |
| 369 |
| 367 if (m_contextStopped || !getExecutionContext()) | 370 if (m_contextStopped || !getExecutionContext()) |
| 368 return; | 371 return; |
| 369 | 372 |
| 370 EventQueue* eventQueue = getExecutionContext()->getEventQueue(); | 373 EventQueue* eventQueue = getExecutionContext()->getEventQueue(); |
| 371 // Remove any pending versionchange events scheduled to fire on this | 374 // Remove any pending versionchange events scheduled to fire on this |
| 372 // connection. They would have been scheduled by the backend when another | 375 // connection. They would have been scheduled by the backend when another |
| 373 // connection attempted an upgrade, but the frontend connection is being | 376 // connection attempted an upgrade, but the frontend connection is being |
| 374 // closed before they could fire. | 377 // closed before they could fire. |
| 375 for (size_t i = 0; i < m_enqueuedEvents.size(); ++i) { | 378 for (size_t i = 0; i < m_enqueuedEvents.size(); ++i) { |
| 376 bool removed = eventQueue->cancelEvent(m_enqueuedEvents[i].get()); | 379 bool removed = eventQueue->cancelEvent(m_enqueuedEvents[i].get()); |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 455 { | 458 { |
| 456 m_contextStopped = true; | 459 m_contextStopped = true; |
| 457 | 460 |
| 458 // Immediately close the connection to the back end. Don't attempt a | 461 // Immediately close the connection to the back end. Don't attempt a |
| 459 // normal close() since that may wait on transactions which require a | 462 // normal close() since that may wait on transactions which require a |
| 460 // round trip to the back-end to abort. | 463 // round trip to the back-end to abort. |
| 461 if (m_backend) { | 464 if (m_backend) { |
| 462 m_backend->close(); | 465 m_backend->close(); |
| 463 m_backend.reset(); | 466 m_backend.reset(); |
| 464 } | 467 } |
| 468 |
| 469 if (m_databaseCallbacks) |
| 470 m_databaseCallbacks->detachWebCallbacks(); |
| 465 } | 471 } |
| 466 | 472 |
| 467 const AtomicString& IDBDatabase::interfaceName() const | 473 const AtomicString& IDBDatabase::interfaceName() const |
| 468 { | 474 { |
| 469 return EventTargetNames::IDBDatabase; | 475 return EventTargetNames::IDBDatabase; |
| 470 } | 476 } |
| 471 | 477 |
| 472 ExecutionContext* IDBDatabase::getExecutionContext() const | 478 ExecutionContext* IDBDatabase::getExecutionContext() const |
| 473 { | 479 { |
| 474 return ActiveDOMObject::getExecutionContext(); | 480 return ActiveDOMObject::getExecutionContext(); |
| 475 } | 481 } |
| 476 | 482 |
| 477 void IDBDatabase::recordApiCallsHistogram(IndexedDatabaseMethods method) | 483 void IDBDatabase::recordApiCallsHistogram(IndexedDatabaseMethods method) |
| 478 { | 484 { |
| 479 DEFINE_THREAD_SAFE_STATIC_LOCAL(EnumerationHistogram, apiCallsHistogram, new
EnumerationHistogram("WebCore.IndexedDB.FrontEndAPICalls", IDBMethodsMax)); | 485 DEFINE_THREAD_SAFE_STATIC_LOCAL(EnumerationHistogram, apiCallsHistogram, new
EnumerationHistogram("WebCore.IndexedDB.FrontEndAPICalls", IDBMethodsMax)); |
| 480 apiCallsHistogram.count(method); | 486 apiCallsHistogram.count(method); |
| 481 } | 487 } |
| 482 | 488 |
| 483 } // namespace blink | 489 } // namespace blink |
| OLD | NEW |