summaryrefslogtreecommitdiff
path: root/chromium/components/webdata/common
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2017-11-20 10:33:36 +0100
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2017-11-22 11:45:12 +0000
commitbe59a35641616a4cf23c4a13fa0632624b021c1b (patch)
tree9da183258bdf9cc413f7562079d25ace6955467f /chromium/components/webdata/common
parentd702e4b6a64574e97fc7df8fe3238cde70242080 (diff)
downloadqtwebengine-chromium-be59a35641616a4cf23c4a13fa0632624b021c1b.tar.gz
BASELINE: Update Chromium to 62.0.3202.101
Change-Id: I2d5eca8117600df6d331f6166ab24d943d9814ac Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'chromium/components/webdata/common')
-rw-r--r--chromium/components/webdata/common/web_data_request_manager.h5
-rw-r--r--chromium/components/webdata/common/web_data_service_base.cc7
-rw-r--r--chromium/components/webdata/common/web_data_service_base.h14
-rw-r--r--chromium/components/webdata/common/web_database_service.cc37
-rw-r--r--chromium/components/webdata/common/web_database_service.h21
5 files changed, 40 insertions, 44 deletions
diff --git a/chromium/components/webdata/common/web_data_request_manager.h b/chromium/components/webdata/common/web_data_request_manager.h
index 2b96076ddfe..6f418efb47c 100644
--- a/chromium/components/webdata/common/web_data_request_manager.h
+++ b/chromium/components/webdata/common/web_data_request_manager.h
@@ -15,6 +15,7 @@
#include "base/atomicops.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
+#include "base/sequenced_task_runner.h"
#include "base/synchronization/lock.h"
#include "components/webdata/common/web_data_results.h"
#include "components/webdata/common/web_data_service_base.h"
@@ -24,10 +25,6 @@
class WebDataServiceConsumer;
class WebDataRequestManager;
-namespace base {
-class SequencedTaskRunner;
-}
-
//////////////////////////////////////////////////////////////////////////////
//
// WebData requests
diff --git a/chromium/components/webdata/common/web_data_service_base.cc b/chromium/components/webdata/common/web_data_service_base.cc
index f3cb0d58999..64ef475a253 100644
--- a/chromium/components/webdata/common/web_data_service_base.cc
+++ b/chromium/components/webdata/common/web_data_service_base.cc
@@ -22,13 +22,12 @@ using base::Time;
WebDataServiceBase::WebDataServiceBase(
scoped_refptr<WebDatabaseService> wdbs,
const ProfileErrorCallback& callback,
- const scoped_refptr<base::SingleThreadTaskRunner>& ui_thread)
- : base::RefCountedDeleteOnSequence<WebDataServiceBase>(ui_thread),
+ const scoped_refptr<base::SingleThreadTaskRunner>& ui_task_runner)
+ : base::RefCountedDeleteOnSequence<WebDataServiceBase>(ui_task_runner),
wdbs_(wdbs),
profile_error_callback_(callback) {}
-void WebDataServiceBase::ShutdownOnUIThread() {
-}
+void WebDataServiceBase::ShutdownOnUISequence() {}
void WebDataServiceBase::Init() {
DCHECK(wdbs_.get());
diff --git a/chromium/components/webdata/common/web_data_service_base.h b/chromium/components/webdata/common/web_data_service_base.h
index 0c442c698f3..ead8360b78e 100644
--- a/chromium/components/webdata/common/web_data_service_base.h
+++ b/chromium/components/webdata/common/web_data_service_base.h
@@ -21,7 +21,7 @@ class SingleThreadTaskRunner;
}
// Base for WebDataService class hierarchy.
-// WebDataServiceBase is destroyed on the UI thread.
+// WebDataServiceBase is destroyed on the UI sequence.
class WEBDATA_EXPORT WebDataServiceBase
: public base::RefCountedDeleteOnSequence<WebDataServiceBase> {
public:
@@ -46,11 +46,11 @@ class WEBDATA_EXPORT WebDataServiceBase
// WebDataServiceBase, which receive |wdbs| upon construction. The
// WebDataServiceWrapper handles the initializing and shutting down and of
// the |wdbs| object.
- // WebDataServiceBase is destroyed on |ui_thread|.
+ // WebDataServiceBase is destroyed on the UI sequence.
WebDataServiceBase(
scoped_refptr<WebDatabaseService> wdbs,
const ProfileErrorCallback& callback,
- const scoped_refptr<base::SingleThreadTaskRunner>& ui_thread);
+ const scoped_refptr<base::SingleThreadTaskRunner>& ui_task_runner);
// Cancel any pending request. You need to call this method if your
// WebDataServiceConsumer is about to be deleted.
@@ -58,7 +58,7 @@ class WEBDATA_EXPORT WebDataServiceBase
// Shutdown the web data service. The service can no longer be used after this
// call.
- virtual void ShutdownOnUIThread();
+ virtual void ShutdownOnUISequence();
// Initializes the web data service.
virtual void Init();
@@ -74,12 +74,12 @@ class WEBDATA_EXPORT WebDataServiceBase
virtual void RegisterDBLoadedCallback(const DBLoadedCallback& callback);
// Returns true if the database load has completetd successfully, and
- // ShutdownOnUIThread has not yet been called.
+ // ShutdownOnUISequence() has not yet been called.
virtual bool IsDatabaseLoaded();
// Returns a pointer to the DB (used by SyncableServices). May return NULL if
- // the database is not loaded or otherwise unavailable. Must be called on
- // DBThread.
+ // the database is not loaded or otherwise unavailable. Must be called on DB
+ // sequence.
virtual WebDatabase* GetDatabase();
protected:
diff --git a/chromium/components/webdata/common/web_database_service.cc b/chromium/components/webdata/common/web_database_service.cc
index 412ee9bdb04..ca409e51ef5 100644
--- a/chromium/components/webdata/common/web_database_service.cc
+++ b/chromium/components/webdata/common/web_database_service.cc
@@ -18,39 +18,37 @@
using base::Bind;
using base::FilePath;
-// Receives messages from the backend on the DB thread, posts them to
-// WebDatabaseService on the UI thread.
+// Receives messages from the backend on the DB sequence, posts them to
+// WebDatabaseService on the UI sequence.
class WebDatabaseService::BackendDelegate
: public WebDatabaseBackend::Delegate {
public:
BackendDelegate(const base::WeakPtr<WebDatabaseService>& web_database_service)
: web_database_service_(web_database_service),
- callback_thread_(base::ThreadTaskRunnerHandle::Get()) {}
+ callback_task_runner_(base::ThreadTaskRunnerHandle::Get()) {}
void DBLoaded(sql::InitStatus status,
const std::string& diagnostics) override {
- callback_thread_->PostTask(
+ callback_task_runner_->PostTask(
FROM_HERE, base::Bind(&WebDatabaseService::OnDatabaseLoadDone,
web_database_service_, status, diagnostics));
}
private:
const base::WeakPtr<WebDatabaseService> web_database_service_;
- scoped_refptr<base::SingleThreadTaskRunner> callback_thread_;
+ scoped_refptr<base::SingleThreadTaskRunner> callback_task_runner_;
};
WebDatabaseService::WebDatabaseService(
const base::FilePath& path,
- scoped_refptr<base::SingleThreadTaskRunner> ui_thread,
- scoped_refptr<base::SingleThreadTaskRunner> db_thread)
- : base::RefCountedDeleteOnSequence<WebDatabaseService>(ui_thread),
+ scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner,
+ scoped_refptr<base::SingleThreadTaskRunner> db_task_runner)
+ : base::RefCountedDeleteOnSequence<WebDatabaseService>(ui_task_runner),
path_(path),
db_loaded_(false),
- db_thread_(db_thread),
+ db_task_runner_(db_task_runner),
weak_ptr_factory_(this) {
- // WebDatabaseService should be instantiated on UI thread.
- DCHECK(ui_thread->BelongsToCurrentThread());
- // WebDatabaseService requires DB thread if instantiated.
- DCHECK(db_thread.get());
+ DCHECK(ui_task_runner->RunsTasksInCurrentSequence());
+ DCHECK(db_task_runner_.get());
}
WebDatabaseService::~WebDatabaseService() {
@@ -59,14 +57,15 @@ WebDatabaseService::~WebDatabaseService() {
void WebDatabaseService::AddTable(std::unique_ptr<WebDatabaseTable> table) {
if (!web_db_backend_.get()) {
web_db_backend_ = new WebDatabaseBackend(
- path_, new BackendDelegate(weak_ptr_factory_.GetWeakPtr()), db_thread_);
+ path_, new BackendDelegate(weak_ptr_factory_.GetWeakPtr()),
+ db_task_runner_);
}
web_db_backend_->AddTable(std::move(table));
}
void WebDatabaseService::LoadDatabase() {
DCHECK(web_db_backend_.get());
- db_thread_->PostTask(
+ db_task_runner_->PostTask(
FROM_HERE, Bind(&WebDatabaseBackend::InitDatabase, web_db_backend_));
}
@@ -77,12 +76,12 @@ void WebDatabaseService::ShutdownDatabase() {
weak_ptr_factory_.InvalidateWeakPtrs();
if (!web_db_backend_.get())
return;
- db_thread_->PostTask(
+ db_task_runner_->PostTask(
FROM_HERE, Bind(&WebDatabaseBackend::ShutdownDatabase, web_db_backend_));
}
WebDatabase* WebDatabaseService::GetDatabaseOnDB() const {
- DCHECK(db_thread_->BelongsToCurrentThread());
+ DCHECK(db_task_runner_->RunsTasksInCurrentSequence());
return web_db_backend_.get() ? web_db_backend_->database() : NULL;
}
@@ -96,7 +95,7 @@ void WebDatabaseService::ScheduleDBTask(
DCHECK(web_db_backend_.get());
std::unique_ptr<WebDataRequest> request =
web_db_backend_->request_manager()->NewRequest(nullptr);
- db_thread_->PostTask(
+ db_task_runner_->PostTask(
from_here, Bind(&WebDatabaseBackend::DBWriteTaskWrapper, web_db_backend_,
task, base::Passed(&request)));
}
@@ -110,7 +109,7 @@ WebDataServiceBase::Handle WebDatabaseService::ScheduleDBTaskWithResult(
std::unique_ptr<WebDataRequest> request =
web_db_backend_->request_manager()->NewRequest(consumer);
WebDataServiceBase::Handle handle = request->GetHandle();
- db_thread_->PostTask(
+ db_task_runner_->PostTask(
from_here, Bind(&WebDatabaseBackend::DBReadTaskWrapper, web_db_backend_,
task, base::Passed(&request)));
return handle;
diff --git a/chromium/components/webdata/common/web_database_service.h b/chromium/components/webdata/common/web_database_service.h
index 7a507ba3f69..c33d6f0d495 100644
--- a/chromium/components/webdata/common/web_database_service.h
+++ b/chromium/components/webdata/common/web_database_service.h
@@ -53,11 +53,12 @@ class WEBDATA_EXPORT WebDatabaseService
using DBLoadErrorCallback =
base::Callback<void(sql::InitStatus, const std::string&)>;
- // Takes the path to the WebDatabase file.
- // WebDatabaseService lives on |ui_thread| and posts tasks to |db_thread|.
- WebDatabaseService(const base::FilePath& path,
- scoped_refptr<base::SingleThreadTaskRunner> ui_thread,
- scoped_refptr<base::SingleThreadTaskRunner> db_thread);
+ // WebDatabaseService lives on the UI sequence and posts tasks to the DB
+ // sequence. |path| points to the WebDatabase file.
+ WebDatabaseService(
+ const base::FilePath& path,
+ scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner,
+ scoped_refptr<base::SingleThreadTaskRunner> db_task_runner);
// Adds |table| as a WebDatabaseTable that will participate in
// managing the database, transferring ownership. All calls to this
@@ -77,18 +78,18 @@ class WEBDATA_EXPORT WebDatabaseService
// Returns a pointer to the WebDatabaseBackend.
scoped_refptr<WebDatabaseBackend> GetBackend() const;
- // Schedule an update/write task on the DB thread.
+ // Schedule an update/write task on the DB sequence.
virtual void ScheduleDBTask(
const tracked_objects::Location& from_here,
const WriteTask& task);
- // Schedule a read task on the DB thread.
+ // Schedule a read task on the DB sequence.
virtual WebDataServiceBase::Handle ScheduleDBTaskWithResult(
const tracked_objects::Location& from_here,
const ReadTask& task,
WebDataServiceConsumer* consumer);
- // Cancel an existing request for a task on the DB thread.
+ // Cancel an existing request for a task on the DB sequence.
// TODO(caitkp): Think about moving the definition of the Handle type to
// somewhere else.
virtual void CancelRequest(WebDataServiceBase::Handle h);
@@ -126,7 +127,7 @@ class WEBDATA_EXPORT WebDatabaseService
base::FilePath path_;
// The primary owner is |WebDatabaseService| but is refcounted because
- // PostTask on DB thread may outlive us.
+ // PostTask on DB sequence may outlive us.
scoped_refptr<WebDatabaseBackend> web_db_backend_;
// Callbacks to be called once the DB has loaded.
@@ -138,7 +139,7 @@ class WEBDATA_EXPORT WebDatabaseService
// True if the WebDatabase has loaded.
bool db_loaded_;
- scoped_refptr<base::SingleThreadTaskRunner> db_thread_;
+ scoped_refptr<base::SingleThreadTaskRunner> db_task_runner_;
// All vended weak pointers are invalidated in ShutdownDatabase().
base::WeakPtrFactory<WebDatabaseService> weak_ptr_factory_;