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

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

Issue 563703002: Oilpan: Enable oilpan for callback classes (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « Source/modules/webdatabase/Database.h ('k') | Source/modules/webdatabase/DatabaseCallback.h » ('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) 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 774 matching lines...) Expand 10 before | Expand all | Expand 10 after
785 ASSERT(executionContext()->isContextThread()); 785 ASSERT(executionContext()->isContextThread());
786 if (databaseContext()->databaseThreadAvailable() && opened()) { 786 if (databaseContext()->databaseThreadAvailable() && opened()) {
787 logErrorMessage("forcibly closing database"); 787 logErrorMessage("forcibly closing database");
788 databaseContext()->databaseThread()->scheduleTask(DatabaseCloseTask::cre ate(this, 0)); 788 databaseContext()->databaseThread()->scheduleTask(DatabaseCloseTask::cre ate(this, 0));
789 } 789 }
790 } 790 }
791 791
792 void Database::changeVersion( 792 void Database::changeVersion(
793 const String& oldVersion, 793 const String& oldVersion,
794 const String& newVersion, 794 const String& newVersion,
795 PassOwnPtrWillBeRawPtr<SQLTransactionCallback> callback, 795 SQLTransactionCallback* callback,
796 PassOwnPtrWillBeRawPtr<SQLTransactionErrorCallback> errorCallback, 796 SQLTransactionErrorCallback* errorCallback,
797 PassOwnPtrWillBeRawPtr<VoidCallback> successCallback) 797 VoidCallback* successCallback)
798 { 798 {
799 ChangeVersionData data(oldVersion, newVersion); 799 ChangeVersionData data(oldVersion, newVersion);
800 runTransaction(callback, errorCallback, successCallback, false, &data); 800 runTransaction(callback, errorCallback, successCallback, false, &data);
801 } 801 }
802 802
803 void Database::transaction( 803 void Database::transaction(
804 PassOwnPtrWillBeRawPtr<SQLTransactionCallback> callback, 804 SQLTransactionCallback* callback,
805 PassOwnPtrWillBeRawPtr<SQLTransactionErrorCallback> errorCallback, 805 SQLTransactionErrorCallback* errorCallback,
806 PassOwnPtrWillBeRawPtr<VoidCallback> successCallback) 806 VoidCallback* successCallback)
807 { 807 {
808 runTransaction(callback, errorCallback, successCallback, false); 808 runTransaction(callback, errorCallback, successCallback, false);
809 } 809 }
810 810
811 void Database::readTransaction( 811 void Database::readTransaction(
812 PassOwnPtrWillBeRawPtr<SQLTransactionCallback> callback, 812 SQLTransactionCallback* callback,
813 PassOwnPtrWillBeRawPtr<SQLTransactionErrorCallback> errorCallback, 813 SQLTransactionErrorCallback* errorCallback,
814 PassOwnPtrWillBeRawPtr<VoidCallback> successCallback) 814 VoidCallback* successCallback)
815 { 815 {
816 runTransaction(callback, errorCallback, successCallback, true); 816 runTransaction(callback, errorCallback, successCallback, true);
817 } 817 }
818 818
819 static void callTransactionErrorCallback(ExecutionContext*, PassOwnPtrWillBeRawP tr<SQLTransactionErrorCallback> callback, PassOwnPtr<SQLErrorData> errorData) 819 static void callTransactionErrorCallback(ExecutionContext*, SQLTransactionErrorC allback* callback, PassOwnPtr<SQLErrorData> errorData)
820 { 820 {
821 RefPtrWillBeRawPtr<SQLError> error = SQLError::create(*errorData); 821 RefPtrWillBeRawPtr<SQLError> error = SQLError::create(*errorData);
822 callback->handleEvent(error.get()); 822 callback->handleEvent(error.get());
823 } 823 }
824 824
825 void Database::runTransaction( 825 void Database::runTransaction(
826 PassOwnPtrWillBeRawPtr<SQLTransactionCallback> callback, 826 SQLTransactionCallback* callback,
827 PassOwnPtrWillBeRawPtr<SQLTransactionErrorCallback> errorCallback, 827 SQLTransactionErrorCallback* errorCallback,
828 PassOwnPtrWillBeRawPtr<VoidCallback> successCallback, 828 VoidCallback* successCallback,
829 bool readOnly, 829 bool readOnly,
830 const ChangeVersionData* changeVersionData) 830 const ChangeVersionData* changeVersionData)
831 { 831 {
832 // FIXME: Rather than passing errorCallback to SQLTransaction and then 832 // FIXME: Rather than passing errorCallback to SQLTransaction and then
833 // sometimes firing it ourselves, this code should probably be pushed down 833 // sometimes firing it ourselves, this code should probably be pushed down
834 // into Database so that we only create the SQLTransaction if we're 834 // into Database so that we only create the SQLTransaction if we're
835 // actually going to run it. 835 // actually going to run it.
836 #if ENABLE(ASSERT) 836 #if ENABLE(ASSERT)
837 SQLTransactionErrorCallback* originalErrorCallback = errorCallback.get(); 837 SQLTransactionErrorCallback* originalErrorCallback = errorCallback;
838 #endif 838 #endif
839 RefPtrWillBeRawPtr<SQLTransaction> transaction = SQLTransaction::create(this , callback, successCallback, errorCallback, readOnly); 839 RefPtrWillBeRawPtr<SQLTransaction> transaction = SQLTransaction::create(this , callback, successCallback, errorCallback, readOnly);
840 RefPtrWillBeRawPtr<SQLTransactionBackend> transactionBackend = runTransactio n(transaction, readOnly, changeVersionData); 840 RefPtrWillBeRawPtr<SQLTransactionBackend> transactionBackend = runTransactio n(transaction, readOnly, changeVersionData);
841 if (!transactionBackend) { 841 if (!transactionBackend) {
842 OwnPtrWillBeRawPtr<SQLTransactionErrorCallback> callback = transaction-> releaseErrorCallback(); 842 SQLTransactionErrorCallback* callback = transaction->releaseErrorCallbac k();
843 ASSERT(callback == originalErrorCallback); 843 ASSERT(callback == originalErrorCallback);
844 if (callback) { 844 if (callback) {
845 OwnPtr<SQLErrorData> error = SQLErrorData::create(SQLError::UNKNOWN_ ERR, "database has been closed"); 845 OwnPtr<SQLErrorData> error = SQLErrorData::create(SQLError::UNKNOWN_ ERR, "database has been closed");
846 executionContext()->postTask(createCrossThreadTask(&callTransactionE rrorCallback, callback.release(), error.release())); 846 executionContext()->postTask(createCrossThreadTask(&callTransactionE rrorCallback, callback, error.release()));
847 } 847 }
848 } 848 }
849 } 849 }
850 850
851 // This object is constructed in a database thread, and destructed in the 851 // This object is constructed in a database thread, and destructed in the
852 // context thread. 852 // context thread.
853 class DeliverPendingCallbackTask FINAL : public ExecutionContextTask { 853 class DeliverPendingCallbackTask FINAL : public ExecutionContextTask {
854 public: 854 public:
855 static PassOwnPtr<DeliverPendingCallbackTask> create(PassRefPtrWillBeRawPtr< SQLTransaction> transaction) 855 static PassOwnPtr<DeliverPendingCallbackTask> create(PassRefPtrWillBeRawPtr< SQLTransaction> transaction)
856 { 856 {
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
925 SecurityOrigin* Database::securityOrigin() const 925 SecurityOrigin* Database::securityOrigin() const
926 { 926 {
927 if (executionContext()->isContextThread()) 927 if (executionContext()->isContextThread())
928 return m_contextThreadSecurityOrigin.get(); 928 return m_contextThreadSecurityOrigin.get();
929 if (databaseContext()->databaseThread()->isDatabaseThread()) 929 if (databaseContext()->databaseThread()->isDatabaseThread())
930 return m_databaseThreadSecurityOrigin.get(); 930 return m_databaseThreadSecurityOrigin.get();
931 return 0; 931 return 0;
932 } 932 }
933 933
934 } // namespace blink 934 } // namespace blink
OLDNEW
« no previous file with comments | « Source/modules/webdatabase/Database.h ('k') | Source/modules/webdatabase/DatabaseCallback.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698