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

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

Powered by Google App Engine
This is Rietveld 408576698