| 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 18 matching lines...) Expand all Loading... |
| 29 #include "modules/webdatabase/DatabaseThread.h" | 29 #include "modules/webdatabase/DatabaseThread.h" |
| 30 | 30 |
| 31 #include "modules/webdatabase/Database.h" | 31 #include "modules/webdatabase/Database.h" |
| 32 #include "modules/webdatabase/DatabaseTask.h" | 32 #include "modules/webdatabase/DatabaseTask.h" |
| 33 #include "modules/webdatabase/SQLTransactionClient.h" | 33 #include "modules/webdatabase/SQLTransactionClient.h" |
| 34 #include "modules/webdatabase/SQLTransactionCoordinator.h" | 34 #include "modules/webdatabase/SQLTransactionCoordinator.h" |
| 35 #include "platform/Logging.h" | 35 #include "platform/Logging.h" |
| 36 #include "platform/ThreadSafeFunctional.h" | 36 #include "platform/ThreadSafeFunctional.h" |
| 37 #include "platform/WebThreadSupportingGC.h" | 37 #include "platform/WebThreadSupportingGC.h" |
| 38 #include "public/platform/Platform.h" | 38 #include "public/platform/Platform.h" |
| 39 #include "wtf/PtrUtil.h" | |
| 40 #include <memory> | |
| 41 | 39 |
| 42 namespace blink { | 40 namespace blink { |
| 43 | 41 |
| 44 DatabaseThread::DatabaseThread() | 42 DatabaseThread::DatabaseThread() |
| 45 : m_transactionClient(wrapUnique(new SQLTransactionClient())) | 43 : m_transactionClient(adoptPtr(new SQLTransactionClient())) |
| 46 , m_cleanupSync(nullptr) | 44 , m_cleanupSync(nullptr) |
| 47 , m_terminationRequested(false) | 45 , m_terminationRequested(false) |
| 48 { | 46 { |
| 49 DCHECK(isMainThread()); | 47 DCHECK(isMainThread()); |
| 50 } | 48 } |
| 51 | 49 |
| 52 DatabaseThread::~DatabaseThread() | 50 DatabaseThread::~DatabaseThread() |
| 53 { | 51 { |
| 54 ASSERT(m_openDatabaseSet.isEmpty()); | 52 ASSERT(m_openDatabaseSet.isEmpty()); |
| 55 ASSERT(!m_thread); | 53 ASSERT(!m_thread); |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 return !m_terminationRequested && m_openDatabaseSet.contains(database); | 153 return !m_terminationRequested && m_openDatabaseSet.contains(database); |
| 156 } | 154 } |
| 157 | 155 |
| 158 bool DatabaseThread::isDatabaseThread() const | 156 bool DatabaseThread::isDatabaseThread() const |
| 159 { | 157 { |
| 160 // This function is called only from the main thread or the database | 158 // This function is called only from the main thread or the database |
| 161 // thread. If we are not in the main thread, we are in the database thread. | 159 // thread. If we are not in the main thread, we are in the database thread. |
| 162 return !isMainThread(); | 160 return !isMainThread(); |
| 163 } | 161 } |
| 164 | 162 |
| 165 void DatabaseThread::scheduleTask(std::unique_ptr<DatabaseTask> task) | 163 void DatabaseThread::scheduleTask(PassOwnPtr<DatabaseTask> task) |
| 166 { | 164 { |
| 167 ASSERT(m_thread); | 165 ASSERT(m_thread); |
| 168 #if ENABLE(ASSERT) | 166 #if ENABLE(ASSERT) |
| 169 { | 167 { |
| 170 MutexLocker lock(m_terminationRequestedMutex); | 168 MutexLocker lock(m_terminationRequestedMutex); |
| 171 ASSERT(!m_terminationRequested); | 169 ASSERT(!m_terminationRequested); |
| 172 } | 170 } |
| 173 #endif | 171 #endif |
| 174 // WebThread takes ownership of the task. | 172 // WebThread takes ownership of the task. |
| 175 m_thread->postTask(BLINK_FROM_HERE, threadSafeBind(&DatabaseTask::run, std::
move(task))); | 173 m_thread->postTask(BLINK_FROM_HERE, threadSafeBind(&DatabaseTask::run, std::
move(task))); |
| 176 } | 174 } |
| 177 | 175 |
| 178 } // namespace blink | 176 } // namespace blink |
| OLD | NEW |