| OLD | NEW |
| 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 20 matching lines...) Expand all Loading... |
| 31 #include "modules/webdatabase/Database.h" | 31 #include "modules/webdatabase/Database.h" |
| 32 #include "modules/webdatabase/DatabaseContext.h" | 32 #include "modules/webdatabase/DatabaseContext.h" |
| 33 #include "modules/webdatabase/DatabaseThread.h" | 33 #include "modules/webdatabase/DatabaseThread.h" |
| 34 #include "modules/webdatabase/StorageLog.h" | 34 #include "modules/webdatabase/StorageLog.h" |
| 35 | 35 |
| 36 namespace blink { | 36 namespace blink { |
| 37 | 37 |
| 38 DatabaseTask::DatabaseTask(Database* database, TaskSynchronizer* synchronizer) | 38 DatabaseTask::DatabaseTask(Database* database, TaskSynchronizer* synchronizer) |
| 39 : m_database(database) | 39 : m_database(database) |
| 40 , m_synchronizer(synchronizer) | 40 , m_synchronizer(synchronizer) |
| 41 #if !LOG_DISABLED | 41 #if DCHECK_IS_ON() |
| 42 , m_complete(false) | 42 , m_complete(false) |
| 43 #endif | 43 #endif |
| 44 { | 44 { |
| 45 } | 45 } |
| 46 | 46 |
| 47 DatabaseTask::~DatabaseTask() | 47 DatabaseTask::~DatabaseTask() |
| 48 { | 48 { |
| 49 #if !LOG_DISABLED | 49 #if DCHECK_IS_ON() |
| 50 ASSERT(m_complete || !m_synchronizer); | 50 ASSERT(m_complete || !m_synchronizer); |
| 51 #endif | 51 #endif |
| 52 } | 52 } |
| 53 | 53 |
| 54 void DatabaseTask::run() | 54 void DatabaseTask::run() |
| 55 { | 55 { |
| 56 // Database tasks are meant to be used only once, so make sure this one hasn
't been performed before. | 56 // Database tasks are meant to be used only once, so make sure this one hasn
't been performed before. |
| 57 #if !LOG_DISABLED | 57 #if DCHECK_IS_ON() |
| 58 ASSERT(!m_complete); | 58 ASSERT(!m_complete); |
| 59 #endif | 59 #endif |
| 60 | 60 |
| 61 if (!m_synchronizer && !m_database->getDatabaseContext()->databaseThread()->
isDatabaseOpen(m_database.get())) { | 61 if (!m_synchronizer && !m_database->getDatabaseContext()->databaseThread()->
isDatabaseOpen(m_database.get())) { |
| 62 taskCancelled(); | 62 taskCancelled(); |
| 63 #if !LOG_DISABLED | 63 #if DCHECK_IS_ON() |
| 64 m_complete = true; | 64 m_complete = true; |
| 65 #endif | 65 #endif |
| 66 return; | 66 return; |
| 67 } | 67 } |
| 68 #if DCHECK_IS_ON() | 68 #if DCHECK_IS_ON() |
| 69 STORAGE_DVLOG(1) << "Performing " << debugTaskName() << " " << this; | 69 STORAGE_DVLOG(1) << "Performing " << debugTaskName() << " " << this; |
| 70 #endif | 70 #endif |
| 71 m_database->resetAuthorizer(); | 71 m_database->resetAuthorizer(); |
| 72 doPerformTask(); | 72 doPerformTask(); |
| 73 | 73 |
| 74 if (m_synchronizer) | 74 if (m_synchronizer) |
| 75 m_synchronizer->taskCompleted(); | 75 m_synchronizer->taskCompleted(); |
| 76 | 76 |
| 77 #if !LOG_DISABLED | 77 #if DCHECK_IS_ON() |
| 78 m_complete = true; | 78 m_complete = true; |
| 79 #endif | 79 #endif |
| 80 } | 80 } |
| 81 | 81 |
| 82 // *** DatabaseOpenTask *** | 82 // *** DatabaseOpenTask *** |
| 83 // Opens the database file and verifies the version matches the expected version
. | 83 // Opens the database file and verifies the version matches the expected version
. |
| 84 | 84 |
| 85 Database::DatabaseOpenTask::DatabaseOpenTask(Database* database, bool setVersion
InNewDatabase, TaskSynchronizer* synchronizer, DatabaseError& error, String& err
orMessage, bool& success) | 85 Database::DatabaseOpenTask::DatabaseOpenTask(Database* database, bool setVersion
InNewDatabase, TaskSynchronizer* synchronizer, DatabaseError& error, String& err
orMessage, bool& success) |
| 86 : DatabaseTask(database, synchronizer) | 86 : DatabaseTask(database, synchronizer) |
| 87 , m_setVersionInNewDatabase(setVersionInNewDatabase) | 87 , m_setVersionInNewDatabase(setVersionInNewDatabase) |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 } | 181 } |
| 182 | 182 |
| 183 #if DCHECK_IS_ON() | 183 #if DCHECK_IS_ON() |
| 184 const char* Database::DatabaseTableNamesTask::debugTaskName() const | 184 const char* Database::DatabaseTableNamesTask::debugTaskName() const |
| 185 { | 185 { |
| 186 return "DatabaseTableNamesTask"; | 186 return "DatabaseTableNamesTask"; |
| 187 } | 187 } |
| 188 #endif | 188 #endif |
| 189 | 189 |
| 190 } // namespace blink | 190 } // namespace blink |
| OLD | NEW |