| 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 |
| 44 bool ChangeVersionWrapper::performPreflight(SQLTransactionBackend* transaction) | 48 bool ChangeVersionWrapper::performPreflight(SQLTransactionBackend* transaction) |
| 45 { | 49 { |
| 46 ASSERT(transaction && transaction->database()); | 50 ASSERT(transaction && transaction->database()); |
| 47 | 51 |
| 48 DatabaseBackend* database = transaction->database(); | 52 DatabaseBackend* database = transaction->database(); |
| 49 | 53 |
| 50 String actualVersion; | 54 String actualVersion; |
| 51 if (!database->getVersionFromDatabase(actualVersion)) { | 55 if (!database->getVersionFromDatabase(actualVersion)) { |
| 52 int sqliteError = database->sqliteDatabase().lastError(); | 56 int sqliteError = database->sqliteDatabase().lastError(); |
| 53 database->reportChangeVersionResult(1, SQLError::UNKNOWN_ERR, sqliteErro
r); | 57 database->reportChangeVersionResult(1, SQLError::UNKNOWN_ERR, sqliteErro
r); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 84 database->reportChangeVersionResult(0, -1, 0); // OK | 88 database->reportChangeVersionResult(0, -1, 0); // OK |
| 85 return true; | 89 return true; |
| 86 } | 90 } |
| 87 | 91 |
| 88 void ChangeVersionWrapper::handleCommitFailedAfterPostflight(SQLTransactionBacke
nd* transaction) | 92 void ChangeVersionWrapper::handleCommitFailedAfterPostflight(SQLTransactionBacke
nd* transaction) |
| 89 { | 93 { |
| 90 transaction->database()->setCachedVersion(m_oldVersion); | 94 transaction->database()->setCachedVersion(m_oldVersion); |
| 91 } | 95 } |
| 92 | 96 |
| 93 } // namespace blink | 97 } // namespace blink |
| OLD | NEW |