| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Apple Inc. All rights reserved. | 2 * Copyright (C) 2013 Apple 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 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 | 194 |
| 195 static DatabaseGuid guidForOriginAndName(const String& origin, | 195 static DatabaseGuid guidForOriginAndName(const String& origin, |
| 196 const String& name) { | 196 const String& name) { |
| 197 // Ensure the the mutex is locked. | 197 // Ensure the the mutex is locked. |
| 198 ASSERT(guidMutex().locked()); | 198 ASSERT(guidMutex().locked()); |
| 199 | 199 |
| 200 String stringID = origin + "/" + name; | 200 String stringID = origin + "/" + name; |
| 201 | 201 |
| 202 typedef HashMap<String, int> IDGuidMap; | 202 typedef HashMap<String, int> IDGuidMap; |
| 203 DEFINE_STATIC_LOCAL_WITH_LOCK(IDGuidMap, stringIdentifierToGUIDMap, ()); | 203 DEFINE_STATIC_LOCAL_WITH_LOCK(IDGuidMap, stringIdentifierToGUIDMap, ()); |
| 204 DatabaseGuid guid = stringIdentifierToGUIDMap.get(stringID); | 204 DatabaseGuid guid = stringIdentifierToGUIDMap.at(stringID); |
| 205 if (!guid) { | 205 if (!guid) { |
| 206 static int currentNewGUID = 1; | 206 static int currentNewGUID = 1; |
| 207 guid = currentNewGUID++; | 207 guid = currentNewGUID++; |
| 208 stringIdentifierToGUIDMap.set(stringID, guid); | 208 stringIdentifierToGUIDMap.set(stringID, guid); |
| 209 } | 209 } |
| 210 | 210 |
| 211 return guid; | 211 return guid; |
| 212 } | 212 } |
| 213 | 213 |
| 214 Database::Database(DatabaseContext* databaseContext, | 214 Database::Database(DatabaseContext* databaseContext, |
| (...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 662 | 662 |
| 663 return result; | 663 return result; |
| 664 } | 664 } |
| 665 | 665 |
| 666 void Database::setExpectedVersion(const String& version) { | 666 void Database::setExpectedVersion(const String& version) { |
| 667 m_expectedVersion = version.isolatedCopy(); | 667 m_expectedVersion = version.isolatedCopy(); |
| 668 } | 668 } |
| 669 | 669 |
| 670 String Database::getCachedVersion() const { | 670 String Database::getCachedVersion() const { |
| 671 MutexLocker locker(guidMutex()); | 671 MutexLocker locker(guidMutex()); |
| 672 return guidToVersionMap().get(m_guid).isolatedCopy(); | 672 return guidToVersionMap().at(m_guid).isolatedCopy(); |
| 673 } | 673 } |
| 674 | 674 |
| 675 void Database::setCachedVersion(const String& actualVersion) { | 675 void Database::setCachedVersion(const String& actualVersion) { |
| 676 // Update the in memory database version map. | 676 // Update the in memory database version map. |
| 677 MutexLocker locker(guidMutex()); | 677 MutexLocker locker(guidMutex()); |
| 678 updateGuidVersionMap(m_guid, actualVersion); | 678 updateGuidVersionMap(m_guid, actualVersion); |
| 679 } | 679 } |
| 680 | 680 |
| 681 bool Database::getActualVersionForTransaction(String& actualVersion) { | 681 bool Database::getActualVersionForTransaction(String& actualVersion) { |
| 682 ASSERT(m_sqliteDatabase.transactionInProgress()); | 682 ASSERT(m_sqliteDatabase.transactionInProgress()); |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 945 if (getDatabaseContext()->databaseThread()->isDatabaseThread()) | 945 if (getDatabaseContext()->databaseThread()->isDatabaseThread()) |
| 946 return m_databaseThreadSecurityOrigin.get(); | 946 return m_databaseThreadSecurityOrigin.get(); |
| 947 return nullptr; | 947 return nullptr; |
| 948 } | 948 } |
| 949 | 949 |
| 950 bool Database::opened() { | 950 bool Database::opened() { |
| 951 return static_cast<bool>(acquireLoad(&m_opened)); | 951 return static_cast<bool>(acquireLoad(&m_opened)); |
| 952 } | 952 } |
| 953 | 953 |
| 954 } // namespace blink | 954 } // namespace blink |
| OLD | NEW |