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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 { | 50 { |
51 ASSERT(isMainThread()); | 51 ASSERT(isMainThread()); |
52 if (!s_databaseManager) | 52 if (!s_databaseManager) |
53 s_databaseManager = new DatabaseManager(); | 53 s_databaseManager = new DatabaseManager(); |
54 return *s_databaseManager; | 54 return *s_databaseManager; |
55 } | 55 } |
56 | 56 |
57 void DatabaseManager::terminateDatabaseThread() | 57 void DatabaseManager::terminateDatabaseThread() |
58 { | 58 { |
59 ASSERT(isMainThread()); | 59 ASSERT(isMainThread()); |
60 if (!s_databaseManager || s_databaseManager->m_contextMap.isEmpty()) | 60 if (!s_databaseManager) |
61 return; | 61 return; |
62 // We have at most one DatabaseContext, which is for the main thread. | 62 for (const Member<DatabaseContext>& context : s_databaseManager->m_contextMa
p.values()) |
63 ASSERT(s_databaseManager->m_contextMap.size() == 1); | 63 context->stopDatabases(); |
64 (*s_databaseManager->m_contextMap.values().begin())->stopDatabases(); | |
65 } | 64 } |
66 | 65 |
67 DatabaseManager::DatabaseManager() | 66 DatabaseManager::DatabaseManager() |
68 #if ENABLE(ASSERT) | 67 #if ENABLE(ASSERT) |
69 : m_databaseContextRegisteredCount(0) | 68 : m_databaseContextRegisteredCount(0) |
70 , m_databaseContextInstanceCount(0) | 69 , m_databaseContextInstanceCount(0) |
71 #endif | 70 #endif |
72 { | 71 { |
73 } | 72 } |
74 | 73 |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 { | 230 { |
232 return DatabaseTracker::tracker().fullPathForDatabase(origin, name, createIf
DoesNotExist); | 231 return DatabaseTracker::tracker().fullPathForDatabase(origin, name, createIf
DoesNotExist); |
233 } | 232 } |
234 | 233 |
235 void DatabaseManager::logErrorMessage(ExecutionContext* context, const String& m
essage) | 234 void DatabaseManager::logErrorMessage(ExecutionContext* context, const String& m
essage) |
236 { | 235 { |
237 context->addConsoleMessage(ConsoleMessage::create(StorageMessageSource, Erro
rMessageLevel, message)); | 236 context->addConsoleMessage(ConsoleMessage::create(StorageMessageSource, Erro
rMessageLevel, message)); |
238 } | 237 } |
239 | 238 |
240 } // namespace blink | 239 } // namespace blink |
OLD | NEW |