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

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

Issue 2099093002: Remove an ExecutionContextTask subclass in DatabaseTracker (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ECT_TaskName
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/modules/webdatabase/DatabaseTracker.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/modules/webdatabase/DatabaseTracker.cpp
diff --git a/third_party/WebKit/Source/modules/webdatabase/DatabaseTracker.cpp b/third_party/WebKit/Source/modules/webdatabase/DatabaseTracker.cpp
index 3c31da4684da9313397612866157f75d57771d1b..4d0008813ff1bc4e5438b73cc5b4be80dde61949 100644
--- a/third_party/WebKit/Source/modules/webdatabase/DatabaseTracker.cpp
+++ b/third_party/WebKit/Source/modules/webdatabase/DatabaseTracker.cpp
@@ -30,6 +30,7 @@
#include "modules/webdatabase/DatabaseTracker.h"
+#include "core/dom/CrossThreadTask.h"
#include "core/dom/Document.h"
#include "core/dom/ExecutionContext.h"
#include "core/dom/ExecutionContextTask.h"
@@ -45,6 +46,7 @@
#include "public/platform/WebSecurityOrigin.h"
#include "public/platform/WebTraceLocation.h"
#include "wtf/Assertions.h"
+#include "wtf/Functional.h"
#include "wtf/PtrUtil.h"
#include "wtf/StdLibExtras.h"
@@ -166,31 +168,6 @@ unsigned long long DatabaseTracker::getMaxSizeForDatabase(const Database* databa
return databaseSize + spaceAvailable;
}
-class DatabaseTracker::CloseOneDatabaseImmediatelyTask final : public ExecutionContextTask {
-public:
- static std::unique_ptr<CloseOneDatabaseImmediatelyTask> create(const String& originString, const String& name, Database* database)
- {
- return wrapUnique(new CloseOneDatabaseImmediatelyTask(originString, name, database));
- }
-
- void performTask(ExecutionContext*) override
- {
- DatabaseTracker::tracker().closeOneDatabaseImmediately(m_originString, m_name, m_database);
- }
-
-private:
- CloseOneDatabaseImmediatelyTask(const String& originString, const String& name, Database* database)
- : m_originString(originString.isolatedCopy())
- , m_name(name.isolatedCopy())
- , m_database(database)
- {
- }
-
- String m_originString;
- String m_name;
- CrossThreadPersistent<Database> m_database;
-};
-
void DatabaseTracker::closeDatabasesImmediately(SecurityOrigin* origin, const String& name)
{
String originString = origin->toRawString();
@@ -208,7 +185,7 @@ void DatabaseTracker::closeDatabasesImmediately(SecurityOrigin* origin, const St
// We have to call closeImmediately() on the context thread.
for (DatabaseSet::iterator it = databaseSet->begin(); it != databaseSet->end(); ++it)
- (*it)->getDatabaseContext()->getExecutionContext()->postTask(BLINK_FROM_HERE, CloseOneDatabaseImmediatelyTask::create(originString, name, *it));
+ (*it)->getDatabaseContext()->getExecutionContext()->postTask(BLINK_FROM_HERE, createCrossThreadTask(&DatabaseTracker::closeOneDatabaseImmediately, crossThreadUnretained(this), originString, name, *it));
hiroshige 2016/06/26 10:51:02 This CL passes |this| across thread, instead of ca
haraken 2016/06/27 01:13:52 Why don't you use wrapCrossThreadPersistent?
hiroshige 2016/06/27 07:20:06 Because DatabaseTracker is not GCed type.
}
void DatabaseTracker::forEachOpenDatabaseInPage(Page* page, std::unique_ptr<DatabaseCallback> callback)
« no previous file with comments | « third_party/WebKit/Source/modules/webdatabase/DatabaseTracker.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698