| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2012 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 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 #include "modules/webdatabase/DatabaseClient.h" | 37 #include "modules/webdatabase/DatabaseClient.h" |
| 38 #include "modules/webdatabase/DatabaseContext.h" | 38 #include "modules/webdatabase/DatabaseContext.h" |
| 39 #include "modules/webdatabase/DatabaseTask.h" | 39 #include "modules/webdatabase/DatabaseTask.h" |
| 40 #include "modules/webdatabase/DatabaseTracker.h" | 40 #include "modules/webdatabase/DatabaseTracker.h" |
| 41 #include "platform/Logging.h" | 41 #include "platform/Logging.h" |
| 42 #include "platform/weborigin/SecurityOrigin.h" | 42 #include "platform/weborigin/SecurityOrigin.h" |
| 43 #include "wtf/MainThread.h" | 43 #include "wtf/MainThread.h" |
| 44 | 44 |
| 45 namespace blink { | 45 namespace blink { |
| 46 | 46 |
| 47 static DatabaseManager* s_databaseManager; |
| 48 |
| 47 DatabaseManager& DatabaseManager::manager() | 49 DatabaseManager& DatabaseManager::manager() |
| 48 { | 50 { |
| 49 ASSERT(isMainThread()); | 51 ASSERT(isMainThread()); |
| 50 DEFINE_STATIC_LOCAL(DatabaseManager, dbManager, ()); | 52 if (!s_databaseManager) |
| 51 return dbManager; | 53 s_databaseManager = new DatabaseManager(); |
| 54 return *s_databaseManager; |
| 55 } |
| 56 |
| 57 void DatabaseManager::terminateDatabaseThread() |
| 58 { |
| 59 ASSERT(isMainThread()); |
| 60 if (!s_databaseManager || s_databaseManager->m_contextMap.isEmpty()) |
| 61 return; |
| 62 // We have at most one DatabaseContext, which is for the main thread. |
| 63 ASSERT(s_databaseManager->m_contextMap.size() == 1); |
| 64 (*s_databaseManager->m_contextMap.values().begin())->stopDatabases(); |
| 52 } | 65 } |
| 53 | 66 |
| 54 DatabaseManager::DatabaseManager() | 67 DatabaseManager::DatabaseManager() |
| 55 #if ENABLE(ASSERT) | 68 #if ENABLE(ASSERT) |
| 56 : m_databaseContextRegisteredCount(0) | 69 : m_databaseContextRegisteredCount(0) |
| 57 , m_databaseContextInstanceCount(0) | 70 , m_databaseContextInstanceCount(0) |
| 58 #endif | 71 #endif |
| 59 { | 72 { |
| 60 } | 73 } |
| 61 | 74 |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 { | 231 { |
| 219 return DatabaseTracker::tracker().fullPathForDatabase(origin, name, createIf
DoesNotExist); | 232 return DatabaseTracker::tracker().fullPathForDatabase(origin, name, createIf
DoesNotExist); |
| 220 } | 233 } |
| 221 | 234 |
| 222 void DatabaseManager::logErrorMessage(ExecutionContext* context, const String& m
essage) | 235 void DatabaseManager::logErrorMessage(ExecutionContext* context, const String& m
essage) |
| 223 { | 236 { |
| 224 context->addConsoleMessage(ConsoleMessage::create(StorageMessageSource, Erro
rMessageLevel, message)); | 237 context->addConsoleMessage(ConsoleMessage::create(StorageMessageSource, Erro
rMessageLevel, message)); |
| 225 } | 238 } |
| 226 | 239 |
| 227 } // namespace blink | 240 } // namespace blink |
| OLD | NEW |