| 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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 HashSet<String> stores; | 194 HashSet<String> stores; |
| 195 for (int64_t store_id : obs_txn.second) { | 195 for (int64_t store_id : obs_txn.second) { |
| 196 stores.insert(m_metadata.objectStores.get(store_id)->name); | 196 stores.insert(m_metadata.objectStores.get(store_id)->name); |
| 197 } | 197 } |
| 198 | 198 |
| 199 transaction = IDBTransaction::createObserver( | 199 transaction = IDBTransaction::createObserver( |
| 200 getExecutionContext(), obs_txn.first, stores, this); | 200 getExecutionContext(), obs_txn.first, stores, this); |
| 201 } | 201 } |
| 202 | 202 |
| 203 observer->callback()->call( | 203 observer->callback()->call( |
| 204 observer, IDBObserverChanges::create(this, transaction, observations, | 204 observer, |
| 205 map_entry.second)); | 205 IDBObserverChanges::create(this, transaction, observations, |
| 206 map_entry.second)); |
| 206 if (transaction) | 207 if (transaction) |
| 207 transaction->setActive(false); | 208 transaction->setActive(false); |
| 208 } | 209 } |
| 209 } | 210 } |
| 210 } | 211 } |
| 211 | 212 |
| 212 DOMStringList* IDBDatabase::objectStoreNames() const { | 213 DOMStringList* IDBDatabase::objectStoreNames() const { |
| 213 DOMStringList* objectStoreNames = DOMStringList::create(); | 214 DOMStringList* objectStoreNames = DOMStringList::create(); |
| 214 for (const auto& it : m_metadata.objectStores) | 215 for (const auto& it : m_metadata.objectStores) |
| 215 objectStoreNames->append(it.value->name); | 216 objectStoreNames->append(it.value->name); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 SyntaxError, "The keyPath option is not a valid key path."); | 273 SyntaxError, "The keyPath option is not a valid key path."); |
| 273 return nullptr; | 274 return nullptr; |
| 274 } | 275 } |
| 275 | 276 |
| 276 if (containsObjectStore(name)) { | 277 if (containsObjectStore(name)) { |
| 277 exceptionState.throwDOMException( | 278 exceptionState.throwDOMException( |
| 278 ConstraintError, IDBDatabase::objectStoreNameTakenErrorMessage); | 279 ConstraintError, IDBDatabase::objectStoreNameTakenErrorMessage); |
| 279 return nullptr; | 280 return nullptr; |
| 280 } | 281 } |
| 281 | 282 |
| 282 if (autoIncrement && ((keyPath.getType() == IDBKeyPath::StringType && | 283 if (autoIncrement && |
| 283 keyPath.string().isEmpty()) || | 284 ((keyPath.getType() == IDBKeyPath::StringType && |
| 284 keyPath.getType() == IDBKeyPath::ArrayType)) { | 285 keyPath.string().isEmpty()) || |
| 286 keyPath.getType() == IDBKeyPath::ArrayType)) { |
| 285 exceptionState.throwDOMException(InvalidAccessError, | 287 exceptionState.throwDOMException(InvalidAccessError, |
| 286 "The autoIncrement option was set but the " | 288 "The autoIncrement option was set but the " |
| 287 "keyPath option was empty or an array."); | 289 "keyPath option was empty or an array."); |
| 288 return nullptr; | 290 return nullptr; |
| 289 } | 291 } |
| 290 | 292 |
| 291 if (!m_backend) { | 293 if (!m_backend) { |
| 292 exceptionState.throwDOMException(InvalidStateError, | 294 exceptionState.throwDOMException(InvalidStateError, |
| 293 IDBDatabase::databaseClosedErrorMessage); | 295 IDBDatabase::databaseClosedErrorMessage); |
| 294 return nullptr; | 296 return nullptr; |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 598 | 600 |
| 599 void IDBDatabase::recordApiCallsHistogram(IndexedDatabaseMethods method) { | 601 void IDBDatabase::recordApiCallsHistogram(IndexedDatabaseMethods method) { |
| 600 DEFINE_THREAD_SAFE_STATIC_LOCAL( | 602 DEFINE_THREAD_SAFE_STATIC_LOCAL( |
| 601 EnumerationHistogram, apiCallsHistogram, | 603 EnumerationHistogram, apiCallsHistogram, |
| 602 new EnumerationHistogram("WebCore.IndexedDB.FrontEndAPICalls", | 604 new EnumerationHistogram("WebCore.IndexedDB.FrontEndAPICalls", |
| 603 IDBMethodsMax)); | 605 IDBMethodsMax)); |
| 604 apiCallsHistogram.count(method); | 606 apiCallsHistogram.count(method); |
| 605 } | 607 } |
| 606 | 608 |
| 607 } // namespace blink | 609 } // namespace blink |
| OLD | NEW |