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

Side by Side Diff: Source/WebCore/Modules/webdatabase/DatabaseBackendBase.cpp

Issue 13643002: Rename LOG() to LOG_INFO() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink@master
Patch Set: rebase Created 7 years, 8 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) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * Copyright (C) 2013 Apple Inc. All rights reserved. 3 * Copyright (C) 2013 Apple Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 m_sqliteDatabase.setBusyTimeout(maxSqliteBusyWaitTime); 329 m_sqliteDatabase.setBusyTimeout(maxSqliteBusyWaitTime);
330 330
331 String currentVersion; 331 String currentVersion;
332 { 332 {
333 MutexLocker locker(guidMutex()); 333 MutexLocker locker(guidMutex());
334 334
335 GuidVersionMap::iterator entry = guidToVersionMap().find(m_guid); 335 GuidVersionMap::iterator entry = guidToVersionMap().find(m_guid);
336 if (entry != guidToVersionMap().end()) { 336 if (entry != guidToVersionMap().end()) {
337 // Map null string to empty string (see updateGuidVersionMap()). 337 // Map null string to empty string (see updateGuidVersionMap()).
338 currentVersion = entry->value.isNull() ? emptyString() : entry->valu e.isolatedCopy(); 338 currentVersion = entry->value.isNull() ? emptyString() : entry->valu e.isolatedCopy();
339 LOG(StorageAPI, "Current cached version for guid %i is %s", m_guid, currentVersion.ascii().data()); 339 LOG_INFO(StorageAPI, "Current cached version for guid %i is %s", m_g uid, currentVersion.ascii().data());
340 340
341 #if PLATFORM(CHROMIUM) 341 #if PLATFORM(CHROMIUM)
342 // Note: In multi-process browsers the cached value may be inaccurat e, but 342 // Note: In multi-process browsers the cached value may be inaccurat e, but
343 // we cannot read the actual version from the database without poten tially 343 // we cannot read the actual version from the database without poten tially
344 // inducing a form of deadlock, a busytimeout error when trying to 344 // inducing a form of deadlock, a busytimeout error when trying to
345 // access the database. So we'll use the cached value if we're unabl e to read 345 // access the database. So we'll use the cached value if we're unabl e to read
346 // the value from the database file without waiting. 346 // the value from the database file without waiting.
347 // FIXME: Add an async openDatabase method to the DatabaseAPI. 347 // FIXME: Add an async openDatabase method to the DatabaseAPI.
348 const int noSqliteBusyWaitTime = 0; 348 const int noSqliteBusyWaitTime = 0;
349 m_sqliteDatabase.setBusyTimeout(noSqliteBusyWaitTime); 349 m_sqliteDatabase.setBusyTimeout(noSqliteBusyWaitTime);
350 String versionFromDatabase; 350 String versionFromDatabase;
351 if (getVersionFromDatabase(versionFromDatabase, false)) { 351 if (getVersionFromDatabase(versionFromDatabase, false)) {
352 currentVersion = versionFromDatabase; 352 currentVersion = versionFromDatabase;
353 updateGuidVersionMap(m_guid, currentVersion); 353 updateGuidVersionMap(m_guid, currentVersion);
354 } 354 }
355 m_sqliteDatabase.setBusyTimeout(maxSqliteBusyWaitTime); 355 m_sqliteDatabase.setBusyTimeout(maxSqliteBusyWaitTime);
356 #endif 356 #endif
357 } else { 357 } else {
358 LOG(StorageAPI, "No cached version for guid %i", m_guid); 358 LOG_INFO(StorageAPI, "No cached version for guid %i", m_guid);
359 359
360 SQLiteTransaction transaction(m_sqliteDatabase); 360 SQLiteTransaction transaction(m_sqliteDatabase);
361 transaction.begin(); 361 transaction.begin();
362 if (!transaction.inProgress()) { 362 if (!transaction.inProgress()) {
363 reportOpenDatabaseResult(2, INVALID_STATE_ERR, m_sqliteDatabase. lastError()); 363 reportOpenDatabaseResult(2, INVALID_STATE_ERR, m_sqliteDatabase. lastError());
364 errorMessage = formatErrorMessage("unable to open database, fail ed to start transaction", m_sqliteDatabase.lastError(), m_sqliteDatabase.lastErr orMsg()); 364 errorMessage = formatErrorMessage("unable to open database, fail ed to start transaction", m_sqliteDatabase.lastError(), m_sqliteDatabase.lastErr orMsg());
365 m_sqliteDatabase.close(); 365 m_sqliteDatabase.close();
366 return false; 366 return false;
367 } 367 }
368 368
(...skipping 10 matching lines...) Expand all
379 } 379 }
380 } else if (!getVersionFromDatabase(currentVersion, false)) { 380 } else if (!getVersionFromDatabase(currentVersion, false)) {
381 reportOpenDatabaseResult(4, INVALID_STATE_ERR, m_sqliteDatabase. lastError()); 381 reportOpenDatabaseResult(4, INVALID_STATE_ERR, m_sqliteDatabase. lastError());
382 errorMessage = formatErrorMessage("unable to open database, fail ed to read current version", m_sqliteDatabase.lastError(), m_sqliteDatabase.last ErrorMsg()); 382 errorMessage = formatErrorMessage("unable to open database, fail ed to read current version", m_sqliteDatabase.lastError(), m_sqliteDatabase.last ErrorMsg());
383 transaction.rollback(); 383 transaction.rollback();
384 m_sqliteDatabase.close(); 384 m_sqliteDatabase.close();
385 return false; 385 return false;
386 } 386 }
387 387
388 if (currentVersion.length()) { 388 if (currentVersion.length()) {
389 LOG(StorageAPI, "Retrieved current version %s from database %s", currentVersion.ascii().data(), databaseDebugName().ascii().data()); 389 LOG_INFO(StorageAPI, "Retrieved current version %s from database %s", currentVersion.ascii().data(), databaseDebugName().ascii().data());
390 } else if (!m_new || shouldSetVersionInNewDatabase) { 390 } else if (!m_new || shouldSetVersionInNewDatabase) {
391 LOG(StorageAPI, "Setting version %s in database %s that was just created", m_expectedVersion.ascii().data(), databaseDebugName().ascii().data()) ; 391 LOG_INFO(StorageAPI, "Setting version %s in database %s that was just created", m_expectedVersion.ascii().data(), databaseDebugName().ascii().da ta());
392 if (!setVersionInDatabase(m_expectedVersion, false)) { 392 if (!setVersionInDatabase(m_expectedVersion, false)) {
393 reportOpenDatabaseResult(5, INVALID_STATE_ERR, m_sqliteDatab ase.lastError()); 393 reportOpenDatabaseResult(5, INVALID_STATE_ERR, m_sqliteDatab ase.lastError());
394 errorMessage = formatErrorMessage("unable to open database, failed to write current version", m_sqliteDatabase.lastError(), m_sqliteDatabase .lastErrorMsg()); 394 errorMessage = formatErrorMessage("unable to open database, failed to write current version", m_sqliteDatabase.lastError(), m_sqliteDatabase .lastErrorMsg());
395 transaction.rollback(); 395 transaction.rollback();
396 m_sqliteDatabase.close(); 396 m_sqliteDatabase.close();
397 return false; 397 return false;
398 } 398 }
399 currentVersion = m_expectedVersion; 399 currentVersion = m_expectedVersion;
400 } 400 }
401 updateGuidVersionMap(m_guid, currentVersion); 401 updateGuidVersionMap(m_guid, currentVersion);
402 transaction.commit(); 402 transaction.commit();
403 } 403 }
404 } 404 }
405 405
406 if (currentVersion.isNull()) { 406 if (currentVersion.isNull()) {
407 LOG(StorageAPI, "Database %s does not have its version set", databaseDeb ugName().ascii().data()); 407 LOG_INFO(StorageAPI, "Database %s does not have its version set", databa seDebugName().ascii().data());
408 currentVersion = ""; 408 currentVersion = "";
409 } 409 }
410 410
411 // If the expected version isn't the empty string, ensure that the current d atabase version we have matches that version. Otherwise, set an exception. 411 // If the expected version isn't the empty string, ensure that the current d atabase version we have matches that version. Otherwise, set an exception.
412 // If the expected version is the empty string, then we always return with w hatever version of the database we have. 412 // If the expected version is the empty string, then we always return with w hatever version of the database we have.
413 if ((!m_new || shouldSetVersionInNewDatabase) && m_expectedVersion.length() && m_expectedVersion != currentVersion) { 413 if ((!m_new || shouldSetVersionInNewDatabase) && m_expectedVersion.length() && m_expectedVersion != currentVersion) {
414 reportOpenDatabaseResult(6, INVALID_STATE_ERR, 0); 414 reportOpenDatabaseResult(6, INVALID_STATE_ERR, 0);
415 errorMessage = "unable to open database, version mismatch, '" + m_expect edVersion + "' does not match the currentVersion of '" + currentVersion + "'"; 415 errorMessage = "unable to open database, version mismatch, '" + m_expect edVersion + "' does not match the currentVersion of '" + currentVersion + "'";
416 m_sqliteDatabase.close(); 416 m_sqliteDatabase.close();
417 return false; 417 return false;
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
650 void DatabaseBackendBase::reportVacuumDatabaseResult(int sqliteErrorCode) 650 void DatabaseBackendBase::reportVacuumDatabaseResult(int sqliteErrorCode)
651 { 651 {
652 DatabaseObserver::reportVacuumDatabaseResult(this, sqliteErrorCode); 652 DatabaseObserver::reportVacuumDatabaseResult(this, sqliteErrorCode);
653 } 653 }
654 654
655 #endif // PLATFORM(CHROMIUM) 655 #endif // PLATFORM(CHROMIUM)
656 656
657 } // namespace WebCore 657 } // namespace WebCore
658 658
659 #endif // ENABLE(SQL_DATABASE) 659 #endif // ENABLE(SQL_DATABASE)
OLDNEW
« no previous file with comments | « Source/WebCore/Modules/webdatabase/DatabaseBackend.cpp ('k') | Source/WebCore/Modules/webdatabase/DatabaseManager.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698