Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(538)

Side by Side Diff: Source/modules/webdatabase/DatabaseThread.cpp

Issue 73623004: Make DatabaseTask inherit from WebTask (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 void DatabaseThread::databaseThread() 100 void DatabaseThread::databaseThread()
101 { 101 {
102 { 102 {
103 // Wait for DatabaseThread::start() to complete. 103 // Wait for DatabaseThread::start() to complete.
104 MutexLocker lock(m_threadCreationMutex); 104 MutexLocker lock(m_threadCreationMutex);
105 LOG(StorageAPI, "Started DatabaseThread %p", this); 105 LOG(StorageAPI, "Started DatabaseThread %p", this);
106 } 106 }
107 107
108 AutodrainedPool pool; 108 AutodrainedPool pool;
109 while (OwnPtr<DatabaseTask> task = m_queue.waitForMessage()) { 109 while (OwnPtr<DatabaseTask> task = m_queue.waitForMessage()) {
110 task->performTask(); 110 task->run();
111 pool.cycle(); 111 pool.cycle();
112 } 112 }
113 113
114 // Clean up the list of all pending transactions on this database thread 114 // Clean up the list of all pending transactions on this database thread
115 m_transactionCoordinator->shutdown(); 115 m_transactionCoordinator->shutdown();
116 116
117 LOG(StorageAPI, "About to detach thread %i and clear the ref to DatabaseThre ad %p, which currently has %i ref(s)", m_threadID, this, refCount()); 117 LOG(StorageAPI, "About to detach thread %i and clear the ref to DatabaseThre ad %p, which currently has %i ref(s)", m_threadID, this, refCount());
118 118
119 // Close the databases that we ran transactions on. This ensures that if any transactions are still open, they are rolled back and we don't leave the databa se in an 119 // Close the databases that we ran transactions on. This ensures that if any transactions are still open, they are rolled back and we don't leave the databa se in an
120 // inconsistent or locked state. 120 // inconsistent or locked state.
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 }; 176 };
177 177
178 void DatabaseThread::unscheduleDatabaseTasks(DatabaseBackend* database) 178 void DatabaseThread::unscheduleDatabaseTasks(DatabaseBackend* database)
179 { 179 {
180 // Note that the thread loop is running, so some tasks for the database 180 // Note that the thread loop is running, so some tasks for the database
181 // may still be executed. This is unavoidable. 181 // may still be executed. This is unavoidable.
182 SameDatabasePredicate predicate(database); 182 SameDatabasePredicate predicate(database);
183 m_queue.removeIf(predicate); 183 m_queue.removeIf(predicate);
184 } 184 }
185 } // namespace WebCore 185 } // namespace WebCore
OLDNEW
« Source/modules/webdatabase/DatabaseTask.h ('K') | « Source/modules/webdatabase/DatabaseTask.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698