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

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

Issue 198673002: Rename DatabaseTaskSynchronizer to TaskSynchronizer and move it to platform/ (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 months 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) 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 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 // stopDatabases(), we can't clear the m_databaseThread ref till we get to 208 // stopDatabases(), we can't clear the m_databaseThread ref till we get to
209 // the destructor. This is because the Databases that are managed by 209 // the destructor. This is because the Databases that are managed by
210 // DatabaseThread still rely on this ref between the context and the thread 210 // DatabaseThread still rely on this ref between the context and the thread
211 // to execute the task for closing the database. By the time we get to the 211 // to execute the task for closing the database. By the time we get to the
212 // destructor, we're guaranteed that the databases are destructed (which is 212 // destructor, we're guaranteed that the databases are destructed (which is
213 // why our ref count is 0 then and we're destructing). Then, the 213 // why our ref count is 0 then and we're destructing). Then, the
214 // m_databaseThread RefPtr destructor will deref and delete the 214 // m_databaseThread RefPtr destructor will deref and delete the
215 // DatabaseThread. 215 // DatabaseThread.
216 216
217 if (m_databaseThread && !m_hasRequestedTermination) { 217 if (m_databaseThread && !m_hasRequestedTermination) {
218 DatabaseTaskSynchronizer sync; 218 TaskSynchronizer sync;
219 m_databaseThread->requestTermination(&sync); 219 m_databaseThread->requestTermination(&sync);
220 m_hasRequestedTermination = true; 220 m_hasRequestedTermination = true;
221 sync.waitForTaskCompletion(); 221 sync.waitForTaskCompletion();
222 } 222 }
223 } 223 }
224 224
225 bool DatabaseContext::allowDatabaseAccess() const 225 bool DatabaseContext::allowDatabaseAccess() const
226 { 226 {
227 if (executionContext()->isDocument()) 227 if (executionContext()->isDocument())
228 return toDocument(executionContext())->isActive(); 228 return toDocument(executionContext())->isActive();
229 ASSERT(executionContext()->isWorkerGlobalScope()); 229 ASSERT(executionContext()->isWorkerGlobalScope());
230 // allowDatabaseAccess is not yet implemented for workers. 230 // allowDatabaseAccess is not yet implemented for workers.
231 return true; 231 return true;
232 } 232 }
233 233
234 SecurityOrigin* DatabaseContext::securityOrigin() const 234 SecurityOrigin* DatabaseContext::securityOrigin() const
235 { 235 {
236 return executionContext()->securityOrigin(); 236 return executionContext()->securityOrigin();
237 } 237 }
238 238
239 bool DatabaseContext::isContextThread() const 239 bool DatabaseContext::isContextThread() const
240 { 240 {
241 return executionContext()->isContextThread(); 241 return executionContext()->isContextThread();
242 } 242 }
243 243
244 } // namespace WebCore 244 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698