Backed out changeset 9846de3bd954 (bug 1372405)

This commit is contained in:
Carsten "Tomcat" Book
2017-06-20 08:27:02 +02:00
parent 0640fe35ce
commit bbe9441993
613 changed files with 3568 additions and 6338 deletions

View File

@@ -1830,41 +1830,39 @@ nsUrlClassifierDBService::AsyncClassifyLocalWithTables(nsIURI *aURI,
new nsMainThreadPtrHolder<nsIURIClassifierCallback>(
"nsIURIClassifierCallback", aCallback));
nsCOMPtr<nsIRunnable> r = NS_NewRunnableFunction(
"nsUrlClassifierDBService::AsyncClassifyLocalWithTables",
[worker, key, tables, callback, startTime]() -> void {
nsCOMPtr<nsIRunnable> r =
NS_NewRunnableFunction([worker, key, tables, callback, startTime] () -> void {
nsCString matchedLists;
nsAutoPtr<LookupResultArray> results(new LookupResultArray());
if (results) {
nsresult rv = worker->DoLocalLookup(key, tables, results);
if (NS_SUCCEEDED(rv)) {
for (uint32_t i = 0; i < results->Length(); i++) {
if (i > 0) {
matchedLists.AppendLiteral(",");
}
matchedLists.Append(results->ElementAt(i).mTableName);
nsCString matchedLists;
nsAutoPtr<LookupResultArray> results(new LookupResultArray());
if (results) {
nsresult rv = worker->DoLocalLookup(key, tables, results);
if (NS_SUCCEEDED(rv)) {
for (uint32_t i = 0; i < results->Length(); i++) {
if (i > 0) {
matchedLists.AppendLiteral(",");
}
matchedLists.Append(results->ElementAt(i).mTableName);
}
}
}
nsCOMPtr<nsIRunnable> cbRunnable = NS_NewRunnableFunction(
"nsUrlClassifierDBService::AsyncClassifyLocalWithTables",
[callback, matchedLists, startTime]() -> void {
// Measure the time diff between calling and callback.
AccumulateDelta_impl<Millisecond>::compute(
Telemetry::URLCLASSIFIER_ASYNC_CLASSIFYLOCAL_TIME, startTime);
nsCOMPtr<nsIRunnable> cbRunnable =
NS_NewRunnableFunction([callback, matchedLists, startTime] () -> void {
// Measure the time diff between calling and callback.
AccumulateDelta_impl<Millisecond>::compute(
Telemetry::URLCLASSIFIER_ASYNC_CLASSIFYLOCAL_TIME, startTime);
// |callback| is captured as const value so ...
auto cb = const_cast<nsIURIClassifierCallback*>(callback.get());
cb->OnClassifyComplete(NS_OK, // Not used.
matchedLists,
EmptyCString(), // provider. (Not used)
EmptyCString()); // prefix. (Not used)
});
// |callback| is captured as const value so ...
auto cb = const_cast<nsIURIClassifierCallback*>(callback.get());
cb->OnClassifyComplete(NS_OK, // Not used.
matchedLists,
EmptyCString(), // provider. (Not used)
EmptyCString()); // prefix. (Not used)
});
NS_DispatchToMainThread(cbRunnable);
});
NS_DispatchToMainThread(cbRunnable);
});
return gDbBackgroundThread->Dispatch(r, NS_DISPATCH_NORMAL);
}
@@ -2268,10 +2266,8 @@ nsUrlClassifierDBService::Shutdown()
// between main thread and the worker thread. (Both threads
// would access Classifier::mUpdateThread.)
using Worker = nsUrlClassifierDBServiceWorker;
RefPtr<nsIRunnable> r = NewRunnableMethod(
"nsUrlClassifierDBServiceWorker::FlushAndDisableAsyncUpdate",
mWorker,
&Worker::FlushAndDisableAsyncUpdate);
RefPtr<nsIRunnable> r =
NewRunnableMethod(mWorker, &Worker::FlushAndDisableAsyncUpdate);
SyncRunnable::DispatchToThread(gDbBackgroundThread, r);
// At this point the update thread has been shut down and