| 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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 IDBDatabase* idbDatabase = | 95 IDBDatabase* idbDatabase = |
| 96 new IDBDatabase(context, std::move(database), callbacks); | 96 new IDBDatabase(context, std::move(database), callbacks); |
| 97 idbDatabase->suspendIfNeeded(); | 97 idbDatabase->suspendIfNeeded(); |
| 98 return idbDatabase; | 98 return idbDatabase; |
| 99 } | 99 } |
| 100 | 100 |
| 101 IDBDatabase::IDBDatabase(ExecutionContext* context, | 101 IDBDatabase::IDBDatabase(ExecutionContext* context, |
| 102 std::unique_ptr<WebIDBDatabase> backend, | 102 std::unique_ptr<WebIDBDatabase> backend, |
| 103 IDBDatabaseCallbacks* callbacks) | 103 IDBDatabaseCallbacks* callbacks) |
| 104 : ActiveScriptWrappable(this), | 104 : ActiveScriptWrappable(this), |
| 105 ActiveDOMObject(context), | 105 SuspendableObject(context), |
| 106 m_backend(std::move(backend)), | 106 m_backend(std::move(backend)), |
| 107 m_databaseCallbacks(callbacks) { | 107 m_databaseCallbacks(callbacks) { |
| 108 m_databaseCallbacks->connect(this); | 108 m_databaseCallbacks->connect(this); |
| 109 } | 109 } |
| 110 | 110 |
| 111 IDBDatabase::~IDBDatabase() { | 111 IDBDatabase::~IDBDatabase() { |
| 112 if (!m_closePending && m_backend) | 112 if (!m_closePending && m_backend) |
| 113 m_backend->close(); | 113 m_backend->close(); |
| 114 } | 114 } |
| 115 | 115 |
| 116 DEFINE_TRACE(IDBDatabase) { | 116 DEFINE_TRACE(IDBDatabase) { |
| 117 visitor->trace(m_versionChangeTransaction); | 117 visitor->trace(m_versionChangeTransaction); |
| 118 visitor->trace(m_transactions); | 118 visitor->trace(m_transactions); |
| 119 visitor->trace(m_observers); | 119 visitor->trace(m_observers); |
| 120 visitor->trace(m_enqueuedEvents); | 120 visitor->trace(m_enqueuedEvents); |
| 121 visitor->trace(m_databaseCallbacks); | 121 visitor->trace(m_databaseCallbacks); |
| 122 EventTargetWithInlineData::trace(visitor); | 122 EventTargetWithInlineData::trace(visitor); |
| 123 ActiveDOMObject::trace(visitor); | 123 SuspendableObject::trace(visitor); |
| 124 } | 124 } |
| 125 | 125 |
| 126 int64_t IDBDatabase::nextTransactionId() { | 126 int64_t IDBDatabase::nextTransactionId() { |
| 127 // Only keep a 32-bit counter to allow ports to use the other 32 | 127 // Only keep a 32-bit counter to allow ports to use the other 32 |
| 128 // bits of the id. | 128 // bits of the id. |
| 129 static int currentTransactionId = 0; | 129 static int currentTransactionId = 0; |
| 130 return atomicIncrement(¤tTransactionId); | 130 return atomicIncrement(¤tTransactionId); |
| 131 } | 131 } |
| 132 | 132 |
| 133 int32_t IDBDatabase::nextObserverId() { | 133 int32_t IDBDatabase::nextObserverId() { |
| (...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 572 | 572 |
| 573 if (m_databaseCallbacks) | 573 if (m_databaseCallbacks) |
| 574 m_databaseCallbacks->detachWebCallbacks(); | 574 m_databaseCallbacks->detachWebCallbacks(); |
| 575 } | 575 } |
| 576 | 576 |
| 577 const AtomicString& IDBDatabase::interfaceName() const { | 577 const AtomicString& IDBDatabase::interfaceName() const { |
| 578 return EventTargetNames::IDBDatabase; | 578 return EventTargetNames::IDBDatabase; |
| 579 } | 579 } |
| 580 | 580 |
| 581 ExecutionContext* IDBDatabase::getExecutionContext() const { | 581 ExecutionContext* IDBDatabase::getExecutionContext() const { |
| 582 return ActiveDOMObject::getExecutionContext(); | 582 return SuspendableObject::getExecutionContext(); |
| 583 } | 583 } |
| 584 | 584 |
| 585 void IDBDatabase::recordApiCallsHistogram(IndexedDatabaseMethods method) { | 585 void IDBDatabase::recordApiCallsHistogram(IndexedDatabaseMethods method) { |
| 586 DEFINE_THREAD_SAFE_STATIC_LOCAL( | 586 DEFINE_THREAD_SAFE_STATIC_LOCAL( |
| 587 EnumerationHistogram, apiCallsHistogram, | 587 EnumerationHistogram, apiCallsHistogram, |
| 588 new EnumerationHistogram("WebCore.IndexedDB.FrontEndAPICalls", | 588 new EnumerationHistogram("WebCore.IndexedDB.FrontEndAPICalls", |
| 589 IDBMethodsMax)); | 589 IDBMethodsMax)); |
| 590 apiCallsHistogram.count(method); | 590 apiCallsHistogram.count(method); |
| 591 } | 591 } |
| 592 | 592 |
| 593 } // namespace blink | 593 } // namespace blink |
| OLD | NEW |