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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 | 163 |
164 DOMStringList* IDBDatabase::objectStoreNames() const | 164 DOMStringList* IDBDatabase::objectStoreNames() const |
165 { | 165 { |
166 DOMStringList* objectStoreNames = DOMStringList::create(DOMStringList::Index
edDB); | 166 DOMStringList* objectStoreNames = DOMStringList::create(DOMStringList::Index
edDB); |
167 for (const auto& it : m_metadata.objectStores) | 167 for (const auto& it : m_metadata.objectStores) |
168 objectStoreNames->append(it.value.name); | 168 objectStoreNames->append(it.value.name); |
169 objectStoreNames->sort(); | 169 objectStoreNames->sort(); |
170 return objectStoreNames; | 170 return objectStoreNames; |
171 } | 171 } |
172 | 172 |
| 173 const String& IDBDatabase::getObjectStoreName(int64_t objectStoreId) const |
| 174 { |
| 175 const auto& it = m_metadata.objectStores.find(objectStoreId); |
| 176 DCHECK(it != m_metadata.objectStores.end()); |
| 177 return it->value.name; |
| 178 } |
| 179 |
173 IDBObjectStore* IDBDatabase::createObjectStore(const String& name, const IDBKeyP
ath& keyPath, bool autoIncrement, ExceptionState& exceptionState) | 180 IDBObjectStore* IDBDatabase::createObjectStore(const String& name, const IDBKeyP
ath& keyPath, bool autoIncrement, ExceptionState& exceptionState) |
174 { | 181 { |
175 IDB_TRACE("IDBDatabase::createObjectStore"); | 182 IDB_TRACE("IDBDatabase::createObjectStore"); |
176 recordApiCallsHistogram(IDBCreateObjectStoreCall); | 183 recordApiCallsHistogram(IDBCreateObjectStoreCall); |
177 | 184 |
178 if (!m_versionChangeTransaction) { | 185 if (!m_versionChangeTransaction) { |
179 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::notVers
ionChangeTransactionErrorMessage); | 186 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::notVers
ionChangeTransactionErrorMessage); |
180 return nullptr; | 187 return nullptr; |
181 } | 188 } |
182 if (m_versionChangeTransaction->isFinished() || m_versionChangeTransaction->
isFinishing()) { | 189 if (m_versionChangeTransaction->isFinished() || m_versionChangeTransaction->
isFinishing()) { |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 return ActiveDOMObject::getExecutionContext(); | 454 return ActiveDOMObject::getExecutionContext(); |
448 } | 455 } |
449 | 456 |
450 void IDBDatabase::recordApiCallsHistogram(IndexedDatabaseMethods method) | 457 void IDBDatabase::recordApiCallsHistogram(IndexedDatabaseMethods method) |
451 { | 458 { |
452 DEFINE_THREAD_SAFE_STATIC_LOCAL(EnumerationHistogram, apiCallsHistogram, new
EnumerationHistogram("WebCore.IndexedDB.FrontEndAPICalls", IDBMethodsMax)); | 459 DEFINE_THREAD_SAFE_STATIC_LOCAL(EnumerationHistogram, apiCallsHistogram, new
EnumerationHistogram("WebCore.IndexedDB.FrontEndAPICalls", IDBMethodsMax)); |
453 apiCallsHistogram.count(method); | 460 apiCallsHistogram.count(method); |
454 } | 461 } |
455 | 462 |
456 } // namespace blink | 463 } // namespace blink |
OLD | NEW |