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

Unified Diff: third_party/WebKit/Source/modules/webdatabase/Database.cpp

Issue 2288983004: Merge TaskSynchronizer into WaitableEvent. (Closed)
Patch Set: fix Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/modules/webdatabase/Database.cpp
diff --git a/third_party/WebKit/Source/modules/webdatabase/Database.cpp b/third_party/WebKit/Source/modules/webdatabase/Database.cpp
index 5ee76aab0674fc34ff620b5c13738c5cfb7b3635..3f3b630df32067a79dd643ac02a1637db06e425f 100644
--- a/third_party/WebKit/Source/modules/webdatabase/Database.cpp
+++ b/third_party/WebKit/Source/modules/webdatabase/Database.cpp
@@ -48,6 +48,7 @@
#include "modules/webdatabase/StorageLog.h"
#include "modules/webdatabase/sqlite/SQLiteStatement.h"
#include "modules/webdatabase/sqlite/SQLiteTransaction.h"
+#include "platform/WaitableEvent.h"
#include "platform/heap/SafePoint.h"
#include "public/platform/Platform.h"
#include "public/platform/WebDatabaseObserver.h"
@@ -259,15 +260,15 @@ DEFINE_TRACE(Database)
bool Database::openAndVerifyVersion(bool setVersionInNewDatabase, DatabaseError& error, String& errorMessage)
{
- TaskSynchronizer synchronizer;
+ WaitableEvent event;
if (!getDatabaseContext()->databaseThreadAvailable())
return false;
DatabaseTracker::tracker().prepareToOpenDatabase(this);
bool success = false;
- std::unique_ptr<DatabaseOpenTask> task = DatabaseOpenTask::create(this, setVersionInNewDatabase, &synchronizer, error, errorMessage, success);
+ std::unique_ptr<DatabaseOpenTask> task = DatabaseOpenTask::create(this, setVersionInNewDatabase, &event, error, errorMessage, success);
getDatabaseContext()->databaseThread()->scheduleTask(std::move(task));
- synchronizer.waitForTaskCompletion();
+ event.wait();
return success;
}
@@ -883,13 +884,13 @@ Vector<String> Database::tableNames()
// take strict turns in dealing with them. However, if the code changes,
// this may not be true anymore.
Vector<String> result;
- TaskSynchronizer synchronizer;
+ WaitableEvent event;
if (!getDatabaseContext()->databaseThreadAvailable())
return result;
- std::unique_ptr<DatabaseTableNamesTask> task = DatabaseTableNamesTask::create(this, &synchronizer, result);
+ std::unique_ptr<DatabaseTableNamesTask> task = DatabaseTableNamesTask::create(this, &event, result);
getDatabaseContext()->databaseThread()->scheduleTask(std::move(task));
- synchronizer.waitForTaskCompletion();
+ event.wait();
return result;
}

Powered by Google App Engine
This is Rietveld 408576698