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

Side by Side Diff: Source/WebCore/Modules/webdatabase/SQLTransactionBackend.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) 2007, 2008, 2013 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008, 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 * 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 473 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 // cleaning up and shutting down: 484 // cleaning up and shutting down:
485 if (m_database->opened() && !m_database->isInterrupted()) { 485 if (m_database->opened() && !m_database->isInterrupted()) {
486 setStateToRequestedState(); 486 setStateToRequestedState();
487 ASSERT(m_nextState == SQLTransactionState::AcquireLock 487 ASSERT(m_nextState == SQLTransactionState::AcquireLock
488 || m_nextState == SQLTransactionState::OpenTransactionAndPreflight 488 || m_nextState == SQLTransactionState::OpenTransactionAndPreflight
489 || m_nextState == SQLTransactionState::RunStatements 489 || m_nextState == SQLTransactionState::RunStatements
490 || m_nextState == SQLTransactionState::PostflightAndCommit 490 || m_nextState == SQLTransactionState::PostflightAndCommit
491 || m_nextState == SQLTransactionState::CleanupAndTerminate 491 || m_nextState == SQLTransactionState::CleanupAndTerminate
492 || m_nextState == SQLTransactionState::CleanupAfterTransactionErrorC allback); 492 || m_nextState == SQLTransactionState::CleanupAfterTransactionErrorC allback);
493 493
494 LOG(StorageAPI, "State %s\n", nameForSQLTransactionState(m_nextState)); 494 LOG_INFO(StorageAPI, "State %s\n", nameForSQLTransactionState(m_nextStat e));
495 return; 495 return;
496 } 496 }
497 497
498 // If we get here, then we should be shutting down. Do clean up if needed: 498 // If we get here, then we should be shutting down. Do clean up if needed:
499 if (m_nextState == SQLTransactionState::End) 499 if (m_nextState == SQLTransactionState::End)
500 return; 500 return;
501 m_nextState = SQLTransactionState::End; 501 m_nextState = SQLTransactionState::End;
502 502
503 // If the database was stopped, don't do anything and cancel queued work 503 // If the database was stopped, don't do anything and cancel queued work
504 LOG(StorageAPI, "Database was stopped or interrupted - cancelling work for t his transaction"); 504 LOG_INFO(StorageAPI, "Database was stopped or interrupted - cancelling work for this transaction");
505 505
506 // The current SQLite transaction should be stopped, as well 506 // The current SQLite transaction should be stopped, as well
507 if (m_sqliteTransaction) { 507 if (m_sqliteTransaction) {
508 m_sqliteTransaction->stop(); 508 m_sqliteTransaction->stop();
509 m_sqliteTransaction.clear(); 509 m_sqliteTransaction.clear();
510 } 510 }
511 511
512 // Terminate the frontend state machine. This also gets the frontend to 512 // Terminate the frontend state machine. This also gets the frontend to
513 // call computeNextStateAndCleanupIfNeeded() and clear its wrappers 513 // call computeNextStateAndCleanupIfNeeded() and clear its wrappers
514 // if needed. 514 // if needed.
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 { 558 {
559 m_lockAcquired = true; 559 m_lockAcquired = true;
560 requestTransitToState(SQLTransactionState::OpenTransactionAndPreflight); 560 requestTransitToState(SQLTransactionState::OpenTransactionAndPreflight);
561 } 561 }
562 562
563 SQLTransactionState SQLTransactionBackend::openTransactionAndPreflight() 563 SQLTransactionState SQLTransactionBackend::openTransactionAndPreflight()
564 { 564 {
565 ASSERT(!m_database->sqliteDatabase().transactionInProgress()); 565 ASSERT(!m_database->sqliteDatabase().transactionInProgress());
566 ASSERT(m_lockAcquired); 566 ASSERT(m_lockAcquired);
567 567
568 LOG(StorageAPI, "Opening and preflighting transaction %p", this); 568 LOG_INFO(StorageAPI, "Opening and preflighting transaction %p", this);
569 569
570 // If the database was deleted, jump to the error callback 570 // If the database was deleted, jump to the error callback
571 if (Database::from(m_database.get())->deleted()) { 571 if (Database::from(m_database.get())->deleted()) {
572 m_database->reportStartTransactionResult(1, SQLError::UNKNOWN_ERR, 0); 572 m_database->reportStartTransactionResult(1, SQLError::UNKNOWN_ERR, 0);
573 m_transactionError = SQLError::create(SQLError::UNKNOWN_ERR, "unable to open a transaction, because the user deleted the database"); 573 m_transactionError = SQLError::create(SQLError::UNKNOWN_ERR, "unable to open a transaction, because the user deleted the database");
574 return nextStateForTransactionError(); 574 return nextStateForTransactionError();
575 } 575 }
576 576
577 // Set the maximum usage for this transaction if this transactions is not re ad-only 577 // Set the maximum usage for this transaction if this transactions is not re ad-only
578 if (!m_readOnly) { 578 if (!m_readOnly) {
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
771 771
772 // Spec 4.3.2.8: Deliver success callback, if there is one. 772 // Spec 4.3.2.8: Deliver success callback, if there is one.
773 return SQLTransactionState::DeliverSuccessCallback; 773 return SQLTransactionState::DeliverSuccessCallback;
774 } 774 }
775 775
776 SQLTransactionState SQLTransactionBackend::cleanupAndTerminate() 776 SQLTransactionState SQLTransactionBackend::cleanupAndTerminate()
777 { 777 {
778 ASSERT(m_lockAcquired); 778 ASSERT(m_lockAcquired);
779 779
780 // Spec 4.3.2.9: End transaction steps. There is no next step. 780 // Spec 4.3.2.9: End transaction steps. There is no next step.
781 LOG(StorageAPI, "Transaction %p is complete\n", this); 781 LOG_INFO(StorageAPI, "Transaction %p is complete\n", this);
782 ASSERT(!m_database->sqliteDatabase().transactionInProgress()); 782 ASSERT(!m_database->sqliteDatabase().transactionInProgress());
783 783
784 // Phase 5 cleanup. See comment on the SQLTransaction life-cycle above. 784 // Phase 5 cleanup. See comment on the SQLTransaction life-cycle above.
785 doCleanup(); 785 doCleanup();
786 m_database->inProgressTransactionCompleted(); 786 m_database->inProgressTransactionCompleted();
787 return SQLTransactionState::End; 787 return SQLTransactionState::End;
788 } 788 }
789 789
790 SQLTransactionState SQLTransactionBackend::nextStateForTransactionError() 790 SQLTransactionState SQLTransactionBackend::nextStateForTransactionError()
791 { 791 {
792 ASSERT(m_transactionError); 792 ASSERT(m_transactionError);
793 if (m_hasErrorCallback) 793 if (m_hasErrorCallback)
794 return SQLTransactionState::DeliverTransactionErrorCallback; 794 return SQLTransactionState::DeliverTransactionErrorCallback;
795 795
796 // No error callback, so fast-forward to the next state and rollback the 796 // No error callback, so fast-forward to the next state and rollback the
797 // transaction. 797 // transaction.
798 return SQLTransactionState::CleanupAfterTransactionErrorCallback; 798 return SQLTransactionState::CleanupAfterTransactionErrorCallback;
799 } 799 }
800 800
801 SQLTransactionState SQLTransactionBackend::cleanupAfterTransactionErrorCallback( ) 801 SQLTransactionState SQLTransactionBackend::cleanupAfterTransactionErrorCallback( )
802 { 802 {
803 ASSERT(m_lockAcquired); 803 ASSERT(m_lockAcquired);
804 804
805 LOG(StorageAPI, "Transaction %p is complete with an error\n", this); 805 LOG_INFO(StorageAPI, "Transaction %p is complete with an error\n", this);
806 m_database->disableAuthorizer(); 806 m_database->disableAuthorizer();
807 if (m_sqliteTransaction) { 807 if (m_sqliteTransaction) {
808 // Spec 4.3.2.10: Rollback the transaction. 808 // Spec 4.3.2.10: Rollback the transaction.
809 m_sqliteTransaction->rollback(); 809 m_sqliteTransaction->rollback();
810 810
811 ASSERT(!m_database->sqliteDatabase().transactionInProgress()); 811 ASSERT(!m_database->sqliteDatabase().transactionInProgress());
812 m_sqliteTransaction.clear(); 812 m_sqliteTransaction.clear();
813 } 813 }
814 m_database->enableAuthorizer(); 814 m_database->enableAuthorizer();
815 815
816 releaseOriginLockIfNeeded(); 816 releaseOriginLockIfNeeded();
817 817
818 ASSERT(!m_database->sqliteDatabase().transactionInProgress()); 818 ASSERT(!m_database->sqliteDatabase().transactionInProgress());
819 819
820 return SQLTransactionState::CleanupAndTerminate; 820 return SQLTransactionState::CleanupAndTerminate;
821 } 821 }
822 822
823 // requestTransitToState() can be called from the frontend. Hence, it should 823 // requestTransitToState() can be called from the frontend. Hence, it should
824 // NOT be modifying SQLTransactionBackend in general. The only safe field to 824 // NOT be modifying SQLTransactionBackend in general. The only safe field to
825 // modify is m_requestedState which is meant for this purpose. 825 // modify is m_requestedState which is meant for this purpose.
826 void SQLTransactionBackend::requestTransitToState(SQLTransactionState nextState) 826 void SQLTransactionBackend::requestTransitToState(SQLTransactionState nextState)
827 { 827 {
828 LOG(StorageAPI, "Scheduling %s for transaction %p\n", nameForSQLTransactionS tate(nextState), this); 828 LOG_INFO(StorageAPI, "Scheduling %s for transaction %p\n", nameForSQLTransac tionState(nextState), this);
829 m_requestedState = nextState; 829 m_requestedState = nextState;
830 ASSERT(m_requestedState != SQLTransactionState::End); 830 ASSERT(m_requestedState != SQLTransactionState::End);
831 m_database->scheduleTransactionStep(this); 831 m_database->scheduleTransactionStep(this);
832 } 832 }
833 833
834 // This state function is used as a stub function to plug unimplemented states 834 // This state function is used as a stub function to plug unimplemented states
835 // in the state dispatch table. They are unimplemented because they should 835 // in the state dispatch table. They are unimplemented because they should
836 // never be reached in the course of correct execution. 836 // never be reached in the course of correct execution.
837 SQLTransactionState SQLTransactionBackend::unreachableState() 837 SQLTransactionState SQLTransactionBackend::unreachableState()
838 { 838 {
(...skipping 23 matching lines...) Expand all
862 if (m_originLock) { 862 if (m_originLock) {
863 m_originLock->unlock(); 863 m_originLock->unlock();
864 m_originLock.clear(); 864 m_originLock.clear();
865 } 865 }
866 #endif 866 #endif
867 } 867 }
868 868
869 } // namespace WebCore 869 } // namespace WebCore
870 870
871 #endif // ENABLE(SQL_DATABASE) 871 #endif // ENABLE(SQL_DATABASE)
OLDNEW
« no previous file with comments | « Source/WebCore/Modules/webdatabase/SQLTransaction.cpp ('k') | Source/WebCore/Modules/websockets/WebSocket.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698