Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(49)

Side by Side Diff: third_party/WebKit/Source/modules/webdatabase/DatabaseTracker.cpp

Issue 2080463002: DatabaseTracker: Use 'raw' string as key for origin (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2743
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/webdatabase/SQLTransactionClient.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * 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 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 { 83 {
84 return String(Platform::current()->databaseCreateOriginIdentifier(WebSecurit yOrigin(origin))) + "/" + name + "#"; 84 return String(Platform::current()->databaseCreateOriginIdentifier(WebSecurit yOrigin(origin))) + "/" + name + "#";
85 } 85 }
86 86
87 void DatabaseTracker::addOpenDatabase(Database* database) 87 void DatabaseTracker::addOpenDatabase(Database* database)
88 { 88 {
89 MutexLocker openDatabaseMapLock(m_openDatabaseMapGuard); 89 MutexLocker openDatabaseMapLock(m_openDatabaseMapGuard);
90 if (!m_openDatabaseMap) 90 if (!m_openDatabaseMap)
91 m_openDatabaseMap = adoptPtr(new DatabaseOriginMap); 91 m_openDatabaseMap = adoptPtr(new DatabaseOriginMap);
92 92
93 String originString = database->getSecurityOrigin()->toString(); 93 String originString = database->getSecurityOrigin()->toRawString();
94 DatabaseNameMap* nameMap = m_openDatabaseMap->get(originString); 94 DatabaseNameMap* nameMap = m_openDatabaseMap->get(originString);
95 if (!nameMap) { 95 if (!nameMap) {
96 nameMap = new DatabaseNameMap(); 96 nameMap = new DatabaseNameMap();
97 m_openDatabaseMap->set(originString, nameMap); 97 m_openDatabaseMap->set(originString, nameMap);
98 } 98 }
99 99
100 String name(database->stringIdentifier()); 100 String name(database->stringIdentifier());
101 DatabaseSet* databaseSet = nameMap->get(name); 101 DatabaseSet* databaseSet = nameMap->get(name);
102 if (!databaseSet) { 102 if (!databaseSet) {
103 databaseSet = new DatabaseSet(); 103 databaseSet = new DatabaseSet();
104 nameMap->set(name, databaseSet); 104 nameMap->set(name, databaseSet);
105 } 105 }
106 106
107 databaseSet->add(database); 107 databaseSet->add(database);
108 } 108 }
109 109
110 void DatabaseTracker::removeOpenDatabase(Database* database) 110 void DatabaseTracker::removeOpenDatabase(Database* database)
111 { 111 {
112 { 112 {
113 MutexLocker openDatabaseMapLock(m_openDatabaseMapGuard); 113 MutexLocker openDatabaseMapLock(m_openDatabaseMapGuard);
114 String originString = database->getSecurityOrigin()->toString(); 114 String originString = database->getSecurityOrigin()->toRawString();
115 ASSERT(m_openDatabaseMap); 115 ASSERT(m_openDatabaseMap);
116 DatabaseNameMap* nameMap = m_openDatabaseMap->get(originString); 116 DatabaseNameMap* nameMap = m_openDatabaseMap->get(originString);
117 if (!nameMap) 117 if (!nameMap)
118 return; 118 return;
119 119
120 String name(database->stringIdentifier()); 120 String name(database->stringIdentifier());
121 DatabaseSet* databaseSet = nameMap->get(name); 121 DatabaseSet* databaseSet = nameMap->get(name);
122 if (!databaseSet) 122 if (!databaseSet)
123 return; 123 return;
124 124
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 { 186 {
187 } 187 }
188 188
189 String m_originString; 189 String m_originString;
190 String m_name; 190 String m_name;
191 CrossThreadPersistent<Database> m_database; 191 CrossThreadPersistent<Database> m_database;
192 }; 192 };
193 193
194 void DatabaseTracker::closeDatabasesImmediately(SecurityOrigin* origin, const St ring& name) 194 void DatabaseTracker::closeDatabasesImmediately(SecurityOrigin* origin, const St ring& name)
195 { 195 {
196 String originString = origin->toString(); 196 String originString = origin->toRawString();
197 MutexLocker openDatabaseMapLock(m_openDatabaseMapGuard); 197 MutexLocker openDatabaseMapLock(m_openDatabaseMapGuard);
198 if (!m_openDatabaseMap) 198 if (!m_openDatabaseMap)
199 return; 199 return;
200 200
201 DatabaseNameMap* nameMap = m_openDatabaseMap->get(originString); 201 DatabaseNameMap* nameMap = m_openDatabaseMap->get(originString);
202 if (!nameMap) 202 if (!nameMap)
203 return; 203 return;
204 204
205 DatabaseSet* databaseSet = nameMap->get(name); 205 DatabaseSet* databaseSet = nameMap->get(name);
206 if (!databaseSet) 206 if (!databaseSet)
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 DatabaseSet::iterator found = databaseSet->find(database); 247 DatabaseSet::iterator found = databaseSet->find(database);
248 if (found == databaseSet->end()) 248 if (found == databaseSet->end())
249 return; 249 return;
250 } 250 }
251 251
252 // And we have to call closeImmediately() without our collection lock being held. 252 // And we have to call closeImmediately() without our collection lock being held.
253 database->closeImmediately(); 253 database->closeImmediately();
254 } 254 }
255 255
256 } // namespace blink 256 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/webdatabase/SQLTransactionClient.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698