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

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

Issue 196533003: Oilpan: Prepare to move AbstractSQLTransaction and SQLTransaction to Oilpan heap. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 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
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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 136
137 void Database::runTransaction(PassOwnPtr<SQLTransactionCallback> callback, PassO wnPtr<SQLTransactionErrorCallback> errorCallback, 137 void Database::runTransaction(PassOwnPtr<SQLTransactionCallback> callback, PassO wnPtr<SQLTransactionErrorCallback> errorCallback,
138 PassOwnPtr<VoidCallback> successCallback, bool readOnly, const ChangeVersion Data* changeVersionData) 138 PassOwnPtr<VoidCallback> successCallback, bool readOnly, const ChangeVersion Data* changeVersionData)
139 { 139 {
140 // FIXME: Rather than passing errorCallback to SQLTransaction and then somet imes firing it ourselves, 140 // FIXME: Rather than passing errorCallback to SQLTransaction and then somet imes firing it ourselves,
141 // this code should probably be pushed down into DatabaseBackend so that we only create the SQLTransaction 141 // this code should probably be pushed down into DatabaseBackend so that we only create the SQLTransaction
142 // if we're actually going to run it. 142 // if we're actually going to run it.
143 #if !ASSERT_DISABLED 143 #if !ASSERT_DISABLED
144 SQLTransactionErrorCallback* originalErrorCallback = errorCallback.get(); 144 SQLTransactionErrorCallback* originalErrorCallback = errorCallback.get();
145 #endif 145 #endif
146 RefPtr<SQLTransaction> transaction = SQLTransaction::create(this, callback, successCallback, errorCallback, readOnly); 146 RefPtrWillBeRawPtr<SQLTransaction> transaction = SQLTransaction::create(this , callback, successCallback, errorCallback, readOnly);
147 RefPtr<SQLTransactionBackend> transactionBackend = backend()->runTransaction (transaction, readOnly, changeVersionData); 147 RefPtr<SQLTransactionBackend> transactionBackend = backend()->runTransaction (transaction, readOnly, changeVersionData);
148 if (!transactionBackend) { 148 if (!transactionBackend) {
149 OwnPtr<SQLTransactionErrorCallback> callback = transaction->releaseError Callback(); 149 OwnPtr<SQLTransactionErrorCallback> callback = transaction->releaseError Callback();
150 ASSERT(callback == originalErrorCallback); 150 ASSERT(callback == originalErrorCallback);
151 if (callback) { 151 if (callback) {
152 RefPtr<SQLError> error = SQLError::create(SQLError::UNKNOWN_ERR, "da tabase has been closed"); 152 RefPtr<SQLError> error = SQLError::create(SQLError::UNKNOWN_ERR, "da tabase has been closed");
153 executionContext()->postTask(createCallbackTask(&callTransactionErro rCallback, callback.release(), error.release())); 153 executionContext()->postTask(createCallbackTask(&callTransactionErro rCallback, callback.release(), error.release()));
154 } 154 }
155 } 155 }
156 } 156 }
157 157
158 // This object is constructed in a database thread, and destructed in the
159 // context thread.
158 class DeliverPendingCallbackTask FINAL : public ExecutionContextTask { 160 class DeliverPendingCallbackTask FINAL : public ExecutionContextTask {
159 public: 161 public:
160 static PassOwnPtr<DeliverPendingCallbackTask> create(PassRefPtr<SQLTransacti on> transaction) 162 static PassOwnPtr<DeliverPendingCallbackTask> create(PassRefPtrWillBeRawPtr< SQLTransaction> transaction)
161 { 163 {
162 return adoptPtr(new DeliverPendingCallbackTask(transaction)); 164 return adoptPtr(new DeliverPendingCallbackTask(transaction));
163 } 165 }
164 166
165 virtual void performTask(ExecutionContext*) OVERRIDE 167 virtual void performTask(ExecutionContext*) OVERRIDE
166 { 168 {
167 m_transaction->performPendingCallback(); 169 m_transaction->performPendingCallback();
168 } 170 }
169 171
170 private: 172 private:
171 DeliverPendingCallbackTask(PassRefPtr<SQLTransaction> transaction) 173 DeliverPendingCallbackTask(PassRefPtrWillBeRawPtr<SQLTransaction> transactio n)
172 : m_transaction(transaction) 174 : m_transaction(transaction)
173 { 175 {
174 } 176 }
175 177
176 RefPtr<SQLTransaction> m_transaction; 178 RefPtrWillBeCrossThreadPersistent<SQLTransaction> m_transaction;
177 }; 179 };
178 180
179 void Database::scheduleTransactionCallback(SQLTransaction* transaction) 181 void Database::scheduleTransactionCallback(SQLTransaction* transaction)
180 { 182 {
181 executionContext()->postTask(DeliverPendingCallbackTask::create(transaction) ); 183 executionContext()->postTask(DeliverPendingCallbackTask::create(transaction) );
182 } 184 }
183 185
184 Vector<String> Database::performGetTableNames() 186 Vector<String> Database::performGetTableNames()
185 { 187 {
186 disableAuthorizer(); 188 disableAuthorizer();
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 backend()->reportStartTransactionResult(errorSite, webSqlErrorCode, sqliteEr rorCode); 242 backend()->reportStartTransactionResult(errorSite, webSqlErrorCode, sqliteEr rorCode);
241 } 243 }
242 244
243 void Database::reportCommitTransactionResult(int errorSite, int webSqlErrorCode, int sqliteErrorCode) 245 void Database::reportCommitTransactionResult(int errorSite, int webSqlErrorCode, int sqliteErrorCode)
244 { 246 {
245 backend()->reportCommitTransactionResult(errorSite, webSqlErrorCode, sqliteE rrorCode); 247 backend()->reportCommitTransactionResult(errorSite, webSqlErrorCode, sqliteE rrorCode);
246 } 248 }
247 249
248 250
249 } // namespace WebCore 251 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698