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

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

Issue 1909813002: Enable per thread heap for database thread (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
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
OLDNEW
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 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 , m_name(name.isolatedCopy()) 208 , m_name(name.isolatedCopy())
209 , m_expectedVersion(expectedVersion.isolatedCopy()) 209 , m_expectedVersion(expectedVersion.isolatedCopy())
210 , m_displayName(displayName.isolatedCopy()) 210 , m_displayName(displayName.isolatedCopy())
211 , m_estimatedSize(estimatedSize) 211 , m_estimatedSize(estimatedSize)
212 , m_guid(0) 212 , m_guid(0)
213 , m_opened(0) 213 , m_opened(0)
214 , m_new(false) 214 , m_new(false)
215 , m_transactionInProgress(false) 215 , m_transactionInProgress(false)
216 , m_isTransactionQueueEnabled(true) 216 , m_isTransactionQueueEnabled(true)
217 { 217 {
218 DCHECK(isMainThread());
218 m_contextThreadSecurityOrigin = m_databaseContext->getSecurityOrigin()->isol atedCopy(); 219 m_contextThreadSecurityOrigin = m_databaseContext->getSecurityOrigin()->isol atedCopy();
219 220
220 m_databaseAuthorizer = DatabaseAuthorizer::create(infoTableName); 221 m_databaseAuthorizer = DatabaseAuthorizer::create(infoTableName);
221 222
222 if (m_name.isNull()) 223 if (m_name.isNull())
223 m_name = ""; 224 m_name = "";
224 225
225 { 226 {
226 SafePointAwareMutexLocker locker(guidMutex()); 227 SafePointAwareMutexLocker locker(guidMutex());
227 m_guid = guidForOriginAndName(getSecurityOrigin()->toString(), name); 228 m_guid = guidForOriginAndName(getSecurityOrigin()->toString(), name);
(...skipping 19 matching lines...) Expand all
247 // database should have already been closed. 248 // database should have already been closed.
248 249
249 ASSERT(!m_opened); 250 ASSERT(!m_opened);
250 } 251 }
251 252
252 DEFINE_TRACE(Database) 253 DEFINE_TRACE(Database)
253 { 254 {
254 visitor->trace(m_databaseContext); 255 visitor->trace(m_databaseContext);
255 visitor->trace(m_sqliteDatabase); 256 visitor->trace(m_sqliteDatabase);
256 visitor->trace(m_databaseAuthorizer); 257 visitor->trace(m_databaseAuthorizer);
257 visitor->trace(m_transactionQueue);
258 } 258 }
259 259
260 bool Database::openAndVerifyVersion(bool setVersionInNewDatabase, DatabaseError& error, String& errorMessage) 260 bool Database::openAndVerifyVersion(bool setVersionInNewDatabase, DatabaseError& error, String& errorMessage)
261 { 261 {
262 TaskSynchronizer synchronizer; 262 TaskSynchronizer synchronizer;
263 if (!getDatabaseContext()->databaseThreadAvailable()) 263 if (!getDatabaseContext()->databaseThreadAvailable())
264 return false; 264 return false;
265 265
266 DatabaseTracker::tracker().prepareToOpenDatabase(this); 266 DatabaseTracker::tracker().prepareToOpenDatabase(this);
267 bool success = false; 267 bool success = false;
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 } 404 }
405 ~DoneCreatingDatabaseOnExitCaller() 405 ~DoneCreatingDatabaseOnExitCaller()
406 { 406 {
407 if (!m_openSucceeded) 407 if (!m_openSucceeded)
408 DatabaseTracker::tracker().failedToOpenDatabase(m_database); 408 DatabaseTracker::tracker().failedToOpenDatabase(m_database);
409 } 409 }
410 410
411 void setOpenSucceeded() { m_openSucceeded = true; } 411 void setOpenSucceeded() { m_openSucceeded = true; }
412 412
413 private: 413 private:
414 Member<Database> m_database; 414 CrossThreadPersistent<Database> m_database;
415 bool m_openSucceeded; 415 bool m_openSucceeded;
416 }; 416 };
417 417
418 bool Database::performOpenAndVerify(bool shouldSetVersionInNewDatabase, Database Error& error, String& errorMessage) 418 bool Database::performOpenAndVerify(bool shouldSetVersionInNewDatabase, Database Error& error, String& errorMessage)
419 { 419 {
420 double callStartTime = WTF::monotonicallyIncreasingTime(); 420 double callStartTime = WTF::monotonicallyIncreasingTime();
421 DoneCreatingDatabaseOnExitCaller onExitCaller(this); 421 DoneCreatingDatabaseOnExitCaller onExitCaller(this);
422 ASSERT(errorMessage.isEmpty()); 422 ASSERT(errorMessage.isEmpty());
423 ASSERT(error == DatabaseError::None); // Better not have any errors already. 423 ASSERT(error == DatabaseError::None); // Better not have any errors already.
424 // Presumed failure. We'll clear it if we succeed below. 424 // Presumed failure. We'll clear it if we succeed below.
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after
902 return m_databaseThreadSecurityOrigin.get(); 902 return m_databaseThreadSecurityOrigin.get();
903 return 0; 903 return 0;
904 } 904 }
905 905
906 bool Database::opened() 906 bool Database::opened()
907 { 907 {
908 return static_cast<bool>(acquireLoad(&m_opened)); 908 return static_cast<bool>(acquireLoad(&m_opened));
909 } 909 }
910 910
911 } // namespace blink 911 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698