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: 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, 3 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 void Database::closeImmediately() 105 void Database::closeImmediately()
106 { 106 {
107 ASSERT(executionContext()->isContextThread()); 107 ASSERT(executionContext()->isContextThread());
108 DatabaseThread* databaseThread = databaseContext()->databaseThread(); 108 DatabaseThread* databaseThread = databaseContext()->databaseThread();
109 if (databaseThread && !databaseThread->terminationRequested() && opened()) { 109 if (databaseThread && !databaseThread->terminationRequested() && opened()) {
110 logErrorMessage("forcibly closing database"); 110 logErrorMessage("forcibly closing database");
111 databaseThread->scheduleTask(DatabaseCloseTask::create(this, 0)); 111 databaseThread->scheduleTask(DatabaseCloseTask::create(this, 0));
112 } 112 }
113 } 113 }
114 114
115 void Database::changeVersion(const String& oldVersion, const String& newVersion, PassOwnPtrWillBeRawPtr<SQLTransactionCallback> callback, PassOwnPtrWillBeRawPtr <SQLTransactionErrorCallback> errorCallback, PassOwnPtrWillBeRawPtr<VoidCallback > successCallback) 115 void Database::changeVersion(const String& oldVersion, const String& newVersion, SQLTransactionCallback* callback, SQLTransactionErrorCallback* errorCallback, V oidCallback* successCallback)
116 { 116 {
117 ChangeVersionData data(oldVersion, newVersion); 117 ChangeVersionData data(oldVersion, newVersion);
118 runTransaction(callback, errorCallback, successCallback, false, &data); 118 runTransaction(callback, errorCallback, successCallback, false, &data);
119 } 119 }
120 120
121 void Database::transaction(PassOwnPtrWillBeRawPtr<SQLTransactionCallback> callba ck, PassOwnPtrWillBeRawPtr<SQLTransactionErrorCallback> errorCallback, PassOwnPt rWillBeRawPtr<VoidCallback> successCallback) 121 void Database::transaction(SQLTransactionCallback* callback, SQLTransactionError Callback* errorCallback, VoidCallback* successCallback)
122 { 122 {
123 runTransaction(callback, errorCallback, successCallback, false); 123 runTransaction(callback, errorCallback, successCallback, false);
124 } 124 }
125 125
126 void Database::readTransaction(PassOwnPtrWillBeRawPtr<SQLTransactionCallback> ca llback, PassOwnPtrWillBeRawPtr<SQLTransactionErrorCallback> errorCallback, PassO wnPtrWillBeRawPtr<VoidCallback> successCallback) 126 void Database::readTransaction(SQLTransactionCallback* callback, SQLTransactionE rrorCallback* errorCallback, VoidCallback* successCallback)
127 { 127 {
128 runTransaction(callback, errorCallback, successCallback, true); 128 runTransaction(callback, errorCallback, successCallback, true);
129 } 129 }
130 130
131 static void callTransactionErrorCallback(ExecutionContext*, PassOwnPtrWillBeRawP tr<SQLTransactionErrorCallback> callback, PassOwnPtr<SQLErrorData> errorData) 131 static void callTransactionErrorCallback(ExecutionContext*, SQLTransactionErrorC allback* callback, PassOwnPtr<SQLErrorData> errorData)
132 { 132 {
133 RefPtrWillBeRawPtr<SQLError> error = SQLError::create(*errorData); 133 RefPtrWillBeRawPtr<SQLError> error = SQLError::create(*errorData);
134 callback->handleEvent(error.get()); 134 callback->handleEvent(error.get());
135 } 135 }
136 136
137 void Database::runTransaction(PassOwnPtrWillBeRawPtr<SQLTransactionCallback> cal lback, PassOwnPtrWillBeRawPtr<SQLTransactionErrorCallback> errorCallback, 137 void Database::runTransaction(SQLTransactionCallback* callback, SQLTransactionEr rorCallback* errorCallback,
138 PassOwnPtrWillBeRawPtr<VoidCallback> successCallback, bool readOnly, const C hangeVersionData* changeVersionData) 138 VoidCallback* successCallback, bool readOnly, const ChangeVersionData* chang eVersionData)
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 ENABLE(ASSERT) 143 #if ENABLE(ASSERT)
144 SQLTransactionErrorCallback* originalErrorCallback = errorCallback.get(); 144 SQLTransactionErrorCallback* originalErrorCallback = errorCallback;
145 #endif 145 #endif
146 RefPtrWillBeRawPtr<SQLTransaction> transaction = SQLTransaction::create(this , callback, successCallback, errorCallback, readOnly); 146 RefPtrWillBeRawPtr<SQLTransaction> transaction = SQLTransaction::create(this , callback, successCallback, errorCallback, readOnly);
147 RefPtrWillBeRawPtr<SQLTransactionBackend> transactionBackend = backend()->ru nTransaction(transaction, readOnly, changeVersionData); 147 RefPtrWillBeRawPtr<SQLTransactionBackend> transactionBackend = backend()->ru nTransaction(transaction, readOnly, changeVersionData);
148 if (!transactionBackend) { 148 if (!transactionBackend) {
149 OwnPtrWillBeRawPtr<SQLTransactionErrorCallback> callback = transaction-> releaseErrorCallback(); 149 SQLTransactionErrorCallback* callback = transaction->releaseErrorCallbac k();
150 ASSERT(callback == originalErrorCallback); 150 ASSERT(callback == originalErrorCallback);
151 if (callback) { 151 if (callback) {
152 OwnPtr<SQLErrorData> error = SQLErrorData::create(SQLError::UNKNOWN_ ERR, "database has been closed"); 152 OwnPtr<SQLErrorData> error = SQLErrorData::create(SQLError::UNKNOWN_ ERR, "database has been closed");
153 executionContext()->postTask(createCrossThreadTask(&callTransactionE rrorCallback, callback.release(), error.release())); 153 executionContext()->postTask(createCrossThreadTask(&callTransactionE rrorCallback, callback, error.release()));
154 } 154 }
155 } 155 }
156 } 156 }
157 157
158 // This object is constructed in a database thread, and destructed in the 158 // This object is constructed in a database thread, and destructed in the
159 // context thread. 159 // context thread.
160 class DeliverPendingCallbackTask FINAL : public ExecutionContextTask { 160 class DeliverPendingCallbackTask FINAL : public ExecutionContextTask {
161 public: 161 public:
162 static PassOwnPtr<DeliverPendingCallbackTask> create(PassRefPtrWillBeRawPtr< SQLTransaction> transaction) 162 static PassOwnPtr<DeliverPendingCallbackTask> create(PassRefPtrWillBeRawPtr< SQLTransaction> transaction)
163 { 163 {
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 backend()->reportStartTransactionResult(errorSite, webSqlErrorCode, sqliteEr rorCode); 242 backend()->reportStartTransactionResult(errorSite, webSqlErrorCode, sqliteEr rorCode);
243 } 243 }
244 244
245 void Database::reportCommitTransactionResult(int errorSite, int webSqlErrorCode, int sqliteErrorCode) 245 void Database::reportCommitTransactionResult(int errorSite, int webSqlErrorCode, int sqliteErrorCode)
246 { 246 {
247 backend()->reportCommitTransactionResult(errorSite, webSqlErrorCode, sqliteE rrorCode); 247 backend()->reportCommitTransactionResult(errorSite, webSqlErrorCode, sqliteE rrorCode);
248 } 248 }
249 249
250 250
251 } // namespace blink 251 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698