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

Side by Side Diff: Source/WebCore/storage/DatabaseSync.cpp

Issue 7563014: Merge 92155 - [Chromium] WebSQLDatabase version handling is broken in multi-process browsers. (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/835/
Patch Set: Created 9 years, 4 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
« no previous file with comments | « Source/WebCore/storage/Database.cpp ('k') | Source/WebCore/storage/SQLTransaction.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) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * 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 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 60
61 if (!database->performOpenAndVerify(!creationCallback, ec)) { 61 if (!database->performOpenAndVerify(!creationCallback, ec)) {
62 LOG(StorageAPI, "Failed to open and verify version (expected %s) of data base %s", expectedVersion.ascii().data(), database->databaseDebugName().ascii(). data()); 62 LOG(StorageAPI, "Failed to open and verify version (expected %s) of data base %s", expectedVersion.ascii().data(), database->databaseDebugName().ascii(). data());
63 DatabaseTracker::tracker().removeOpenDatabase(database.get()); 63 DatabaseTracker::tracker().removeOpenDatabase(database.get());
64 return 0; 64 return 0;
65 } 65 }
66 66
67 DatabaseTracker::tracker().setDatabaseDetails(context->securityOrigin(), nam e, displayName, estimatedSize); 67 DatabaseTracker::tracker().setDatabaseDetails(context->securityOrigin(), nam e, displayName, estimatedSize);
68 68
69 if (database->isNew() && creationCallback.get()) { 69 if (database->isNew() && creationCallback.get()) {
70 database->m_expectedVersion = "";
71 LOG(StorageAPI, "Invoking the creation callback for database %p\n", data base.get()); 70 LOG(StorageAPI, "Invoking the creation callback for database %p\n", data base.get());
72 creationCallback->handleEvent(database.get()); 71 creationCallback->handleEvent(database.get());
73 } 72 }
74 73
75 return database; 74 return database;
76 } 75 }
77 76
78 DatabaseSync::DatabaseSync(ScriptExecutionContext* context, const String& name, const String& expectedVersion, 77 DatabaseSync::DatabaseSync(ScriptExecutionContext* context, const String& name, const String& expectedVersion,
79 const String& displayName, unsigned long estimatedSiz e) 78 const String& displayName, unsigned long estimatedSiz e)
80 : AbstractDatabase(context, name, expectedVersion, displayName, estimatedSiz e) 79 : AbstractDatabase(context, name, expectedVersion, displayName, estimatedSiz e)
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 } 115 }
117 116
118 if ((ec = transaction->execute())) 117 if ((ec = transaction->execute()))
119 return; 118 return;
120 119
121 if (!setVersionInDatabase(newVersion)) { 120 if (!setVersionInDatabase(newVersion)) {
122 ec = SQLException::UNKNOWN_ERR; 121 ec = SQLException::UNKNOWN_ERR;
123 return; 122 return;
124 } 123 }
125 124
126 if ((ec = transaction->commit())) 125 if ((ec = transaction->commit())) {
126 setCachedVersion(oldVersion);
127 return; 127 return;
128 }
128 129
129 setExpectedVersion(newVersion); 130 setExpectedVersion(newVersion);
130 } 131 }
131 132
132 void DatabaseSync::transaction(PassRefPtr<SQLTransactionSyncCallback> callback, ExceptionCode& ec) 133 void DatabaseSync::transaction(PassRefPtr<SQLTransactionSyncCallback> callback, ExceptionCode& ec)
133 { 134 {
134 runTransaction(callback, false, ec); 135 runTransaction(callback, false, ec);
135 } 136 }
136 137
137 void DatabaseSync::readTransaction(PassRefPtr<SQLTransactionSyncCallback> callba ck, ExceptionCode& ec) 138 void DatabaseSync::readTransaction(PassRefPtr<SQLTransactionSyncCallback> callba ck, ExceptionCode& ec)
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 return; 191 return;
191 192
192 DatabaseTracker::tracker().removeOpenDatabase(this); 193 DatabaseTracker::tracker().removeOpenDatabase(this);
193 194
194 closeDatabase(); 195 closeDatabase();
195 } 196 }
196 197
197 } // namespace WebCore 198 } // namespace WebCore
198 199
199 #endif // ENABLE(DATABASE) 200 #endif // ENABLE(DATABASE)
OLDNEW
« no previous file with comments | « Source/WebCore/storage/Database.cpp ('k') | Source/WebCore/storage/SQLTransaction.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698