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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 | 47 |
48 namespace WebCore { | 48 namespace WebCore { |
49 | 49 |
50 DatabaseManager& DatabaseManager::manager() | 50 DatabaseManager& DatabaseManager::manager() |
51 { | 51 { |
52 AtomicallyInitializedStatic(DatabaseManager*, dbManager = new DatabaseManage
r); | 52 AtomicallyInitializedStatic(DatabaseManager*, dbManager = new DatabaseManage
r); |
53 return *dbManager; | 53 return *dbManager; |
54 } | 54 } |
55 | 55 |
56 DatabaseManager::DatabaseManager() | 56 DatabaseManager::DatabaseManager() |
57 #if !ASSERT_DISABLED | 57 #if ASSERT_ENABLED |
58 : m_databaseContextRegisteredCount(0) | 58 : m_databaseContextRegisteredCount(0) |
59 , m_databaseContextInstanceCount(0) | 59 , m_databaseContextInstanceCount(0) |
60 #endif | 60 #endif |
61 { | 61 { |
62 m_server = new DatabaseServer; | 62 m_server = new DatabaseServer; |
63 ASSERT(m_server); // We should always have a server to work with. | 63 ASSERT(m_server); // We should always have a server to work with. |
64 } | 64 } |
65 | 65 |
66 DatabaseManager::~DatabaseManager() | 66 DatabaseManager::~DatabaseManager() |
67 { | 67 { |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 | 117 |
118 void DatabaseManager::registerDatabaseContext(DatabaseContext* databaseContext) | 118 void DatabaseManager::registerDatabaseContext(DatabaseContext* databaseContext) |
119 { | 119 { |
120 MutexLocker locker(m_contextMapLock); | 120 MutexLocker locker(m_contextMapLock); |
121 ExecutionContext* context = databaseContext->executionContext(); | 121 ExecutionContext* context = databaseContext->executionContext(); |
122 #if ENABLE(OILPAN) | 122 #if ENABLE(OILPAN) |
123 m_contextMap.set(context, adoptPtr(new Persistent<DatabaseContext>(databaseC
ontext))); | 123 m_contextMap.set(context, adoptPtr(new Persistent<DatabaseContext>(databaseC
ontext))); |
124 #else | 124 #else |
125 m_contextMap.set(context, databaseContext); | 125 m_contextMap.set(context, databaseContext); |
126 #endif | 126 #endif |
127 #if !ASSERT_DISABLED | 127 #if ASSERT_ENABLED |
128 m_databaseContextRegisteredCount++; | 128 m_databaseContextRegisteredCount++; |
129 #endif | 129 #endif |
130 } | 130 } |
131 | 131 |
132 void DatabaseManager::unregisterDatabaseContext(DatabaseContext* databaseContext
) | 132 void DatabaseManager::unregisterDatabaseContext(DatabaseContext* databaseContext
) |
133 { | 133 { |
134 MutexLocker locker(m_contextMapLock); | 134 MutexLocker locker(m_contextMapLock); |
135 ExecutionContext* context = databaseContext->executionContext(); | 135 ExecutionContext* context = databaseContext->executionContext(); |
136 ASSERT(m_contextMap.get(context)); | 136 ASSERT(m_contextMap.get(context)); |
137 #if !ASSERT_DISABLED | 137 #if ASSERT_ENABLED |
138 m_databaseContextRegisteredCount--; | 138 m_databaseContextRegisteredCount--; |
139 #endif | 139 #endif |
140 m_contextMap.remove(context); | 140 m_contextMap.remove(context); |
141 } | 141 } |
142 | 142 |
143 #if !ASSERT_DISABLED | 143 #if ASSERT_ENABLED |
144 void DatabaseManager::didConstructDatabaseContext() | 144 void DatabaseManager::didConstructDatabaseContext() |
145 { | 145 { |
146 MutexLocker lock(m_contextMapLock); | 146 MutexLocker lock(m_contextMapLock); |
147 m_databaseContextInstanceCount++; | 147 m_databaseContextInstanceCount++; |
148 } | 148 } |
149 | 149 |
150 void DatabaseManager::didDestructDatabaseContext() | 150 void DatabaseManager::didDestructDatabaseContext() |
151 { | 151 { |
152 MutexLocker lock(m_contextMapLock); | 152 MutexLocker lock(m_contextMapLock); |
153 m_databaseContextInstanceCount--; | 153 m_databaseContextInstanceCount--; |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 { | 273 { |
274 m_server->interruptAllDatabasesForContext(databaseContext->backend()); | 274 m_server->interruptAllDatabasesForContext(databaseContext->backend()); |
275 } | 275 } |
276 | 276 |
277 void DatabaseManager::logErrorMessage(ExecutionContext* context, const String& m
essage) | 277 void DatabaseManager::logErrorMessage(ExecutionContext* context, const String& m
essage) |
278 { | 278 { |
279 context->addConsoleMessage(StorageMessageSource, ErrorMessageLevel, message)
; | 279 context->addConsoleMessage(StorageMessageSource, ErrorMessageLevel, message)
; |
280 } | 280 } |
281 | 281 |
282 } // namespace WebCore | 282 } // namespace WebCore |
OLD | NEW |