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

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

Issue 2049003002: Wrap GCed raw pointer parameters of WTF::bind with Persistent (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: revert "unretained" part and "disallow pointers" part Created 4 years, 6 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
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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 if (m_openDatabaseSet.size() > 0) { 105 if (m_openDatabaseSet.size() > 0) {
106 // As the call to close will modify the original set, we must take a cop y to iterate over. 106 // As the call to close will modify the original set, we must take a cop y to iterate over.
107 HashSet<CrossThreadPersistent<Database>> openSetCopy; 107 HashSet<CrossThreadPersistent<Database>> openSetCopy;
108 openSetCopy.swap(m_openDatabaseSet); 108 openSetCopy.swap(m_openDatabaseSet);
109 HashSet<CrossThreadPersistent<Database>>::iterator end = openSetCopy.end (); 109 HashSet<CrossThreadPersistent<Database>>::iterator end = openSetCopy.end ();
110 for (HashSet<CrossThreadPersistent<Database>>::iterator it = openSetCopy .begin(); it != end; ++it) 110 for (HashSet<CrossThreadPersistent<Database>>::iterator it = openSetCopy .begin(); it != end; ++it)
111 (*it)->close(); 111 (*it)->close();
112 } 112 }
113 m_openDatabaseSet.clear(); 113 m_openDatabaseSet.clear();
114 114
115 m_thread->postTask(BLINK_FROM_HERE, WTF::bind(&DatabaseThread::cleanupDataba seThreadCompleted, this)); 115 m_thread->postTask(BLINK_FROM_HERE, WTF::bind(&DatabaseThread::cleanupDataba seThreadCompleted, wrapCrossThreadPersistent(this)));
116 } 116 }
117 117
118 void DatabaseThread::cleanupDatabaseThreadCompleted() 118 void DatabaseThread::cleanupDatabaseThreadCompleted()
119 { 119 {
120 m_thread->shutdown(); 120 m_thread->shutdown();
121 if (m_cleanupSync) // Someone wanted to know when we were done cleaning up. 121 if (m_cleanupSync) // Someone wanted to know when we were done cleaning up.
122 m_cleanupSync->taskCompleted(); 122 m_cleanupSync->taskCompleted();
123 } 123 }
124 124
125 void DatabaseThread::recordDatabaseOpen(Database* database) 125 void DatabaseThread::recordDatabaseOpen(Database* database)
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 { 167 {
168 MutexLocker lock(m_terminationRequestedMutex); 168 MutexLocker lock(m_terminationRequestedMutex);
169 ASSERT(!m_terminationRequested); 169 ASSERT(!m_terminationRequested);
170 } 170 }
171 #endif 171 #endif
172 // WebThread takes ownership of the task. 172 // WebThread takes ownership of the task.
173 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)));
174 } 174 }
175 175
176 } // namespace blink 176 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698