OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. |
3 * Copyright (C) 2011 Google, Inc. All Rights Reserved. | 3 * Copyright (C) 2011 Google, Inc. All Rights Reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
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 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 // stopDatabases(), we can't clear the m_databaseThread ref till we get to | 232 // stopDatabases(), we can't clear the m_databaseThread ref till we get to |
233 // the destructor. This is because the Databases that are managed by | 233 // the destructor. This is because the Databases that are managed by |
234 // DatabaseThread still rely on this ref between the context and the thread | 234 // DatabaseThread still rely on this ref between the context and the thread |
235 // to execute the task for closing the database. By the time we get to the | 235 // to execute the task for closing the database. By the time we get to the |
236 // destructor, we're guaranteed that the databases are destructed (which is | 236 // destructor, we're guaranteed that the databases are destructed (which is |
237 // why our ref count is 0 then and we're destructing). Then, the | 237 // why our ref count is 0 then and we're destructing). Then, the |
238 // m_databaseThread RefPtr destructor will deref and delete the | 238 // m_databaseThread RefPtr destructor will deref and delete the |
239 // DatabaseThread. | 239 // DatabaseThread. |
240 | 240 |
241 if (m_databaseThread && !m_hasRequestedTermination) { | 241 if (m_databaseThread && !m_hasRequestedTermination) { |
242 TaskSynchronizer sync; | 242 DatabaseTaskSynchronizer sync; |
243 m_databaseThread->requestTermination(&sync); | 243 m_databaseThread->requestTermination(&sync); |
244 m_hasRequestedTermination = true; | 244 m_hasRequestedTermination = true; |
245 sync.waitForTaskCompletion(); | 245 sync.waitForTaskCompletion(); |
246 } | 246 } |
247 } | 247 } |
248 | 248 |
249 bool DatabaseContext::allowDatabaseAccess() const | 249 bool DatabaseContext::allowDatabaseAccess() const |
250 { | 250 { |
251 if (executionContext()->isDocument()) | 251 if (executionContext()->isDocument()) |
252 return toDocument(executionContext())->isActive(); | 252 return toDocument(executionContext())->isActive(); |
253 ASSERT(executionContext()->isWorkerGlobalScope()); | 253 ASSERT(executionContext()->isWorkerGlobalScope()); |
254 // allowDatabaseAccess is not yet implemented for workers. | 254 // allowDatabaseAccess is not yet implemented for workers. |
255 return true; | 255 return true; |
256 } | 256 } |
257 | 257 |
258 SecurityOrigin* DatabaseContext::securityOrigin() const | 258 SecurityOrigin* DatabaseContext::securityOrigin() const |
259 { | 259 { |
260 return executionContext()->securityOrigin(); | 260 return executionContext()->securityOrigin(); |
261 } | 261 } |
262 | 262 |
263 bool DatabaseContext::isContextThread() const | 263 bool DatabaseContext::isContextThread() const |
264 { | 264 { |
265 return executionContext()->isContextThread(); | 265 return executionContext()->isContextThread(); |
266 } | 266 } |
267 | 267 |
268 } // namespace WebCore | 268 } // namespace WebCore |
OLD | NEW |