| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2013 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 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 23 matching lines...) Expand all Loading... |
| 34 #include "wtf/RefPtr.h" | 34 #include "wtf/RefPtr.h" |
| 35 | 35 |
| 36 namespace blink { | 36 namespace blink { |
| 37 | 37 |
| 38 ChangeVersionWrapper::ChangeVersionWrapper(const String& oldVersion, const Strin
g& newVersion) | 38 ChangeVersionWrapper::ChangeVersionWrapper(const String& oldVersion, const Strin
g& newVersion) |
| 39 : m_oldVersion(oldVersion.isolatedCopy()) | 39 : m_oldVersion(oldVersion.isolatedCopy()) |
| 40 , m_newVersion(newVersion.isolatedCopy()) | 40 , m_newVersion(newVersion.isolatedCopy()) |
| 41 { | 41 { |
| 42 } | 42 } |
| 43 | 43 |
| 44 ChangeVersionWrapper::~ChangeVersionWrapper() | |
| 45 { | |
| 46 } | |
| 47 | |
| 48 bool ChangeVersionWrapper::performPreflight(SQLTransactionBackend* transaction) | 44 bool ChangeVersionWrapper::performPreflight(SQLTransactionBackend* transaction) |
| 49 { | 45 { |
| 50 ASSERT(transaction && transaction->database()); | 46 ASSERT(transaction && transaction->database()); |
| 51 | 47 |
| 52 DatabaseBackend* database = transaction->database(); | 48 DatabaseBackend* database = transaction->database(); |
| 53 | 49 |
| 54 String actualVersion; | 50 String actualVersion; |
| 55 if (!database->getVersionFromDatabase(actualVersion)) { | 51 if (!database->getVersionFromDatabase(actualVersion)) { |
| 56 int sqliteError = database->sqliteDatabase().lastError(); | 52 int sqliteError = database->sqliteDatabase().lastError(); |
| 57 database->reportChangeVersionResult(1, SQLError::UNKNOWN_ERR, sqliteErro
r); | 53 database->reportChangeVersionResult(1, SQLError::UNKNOWN_ERR, sqliteErro
r); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 88 database->reportChangeVersionResult(0, -1, 0); // OK | 84 database->reportChangeVersionResult(0, -1, 0); // OK |
| 89 return true; | 85 return true; |
| 90 } | 86 } |
| 91 | 87 |
| 92 void ChangeVersionWrapper::handleCommitFailedAfterPostflight(SQLTransactionBacke
nd* transaction) | 88 void ChangeVersionWrapper::handleCommitFailedAfterPostflight(SQLTransactionBacke
nd* transaction) |
| 93 { | 89 { |
| 94 transaction->database()->setCachedVersion(m_oldVersion); | 90 transaction->database()->setCachedVersion(m_oldVersion); |
| 95 } | 91 } |
| 96 | 92 |
| 97 } // namespace blink | 93 } // namespace blink |
| OLD | NEW |