Commit 583f6edf authored by Alexey Baskakov's avatar Alexey Baskakov Committed by Commit Bot

WebApp: Add more checks of database is opened.

In next CLs: Add more started/shutdown checks in WebAppInstallFinalizer,
WebAppInstallManager, ManifestUpdateManager.

Bug: 1084939
Change-Id: I720cbdd79998e895f5b9171e3173f89c6977be6b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2210085
Auto-Submit: Alexey Baskakov <loyso@chromium.org>
Reviewed-by: default avatarAlan Cutter <alancutter@chromium.org>
Commit-Queue: Alexey Baskakov <loyso@chromium.org>
Cr-Commit-Position: refs/heads/master@{#770931}
parent ec4eb0e5
...@@ -53,7 +53,7 @@ void WebAppDatabase::Write( ...@@ -53,7 +53,7 @@ void WebAppDatabase::Write(
std::unique_ptr<syncer::MetadataChangeList> metadata_change_list, std::unique_ptr<syncer::MetadataChangeList> metadata_change_list,
CompletionCallback callback) { CompletionCallback callback) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
DCHECK(opened_); CHECK(opened_);
std::unique_ptr<syncer::ModelTypeStore::WriteBatch> write_batch = std::unique_ptr<syncer::ModelTypeStore::WriteBatch> write_batch =
store_->CreateWriteBatch(); store_->CreateWriteBatch();
......
...@@ -59,6 +59,8 @@ class WebAppDatabase { ...@@ -59,6 +59,8 @@ class WebAppDatabase {
static std::unique_ptr<WebApp> ParseWebApp(const AppId& app_id, static std::unique_ptr<WebApp> ParseWebApp(const AppId& app_id,
const std::string& value); const std::string& value);
bool is_opened() const { return opened_; }
private: private:
static std::unique_ptr<WebApp> CreateWebApp(const WebAppProto& local_data); static std::unique_ptr<WebApp> CreateWebApp(const WebAppProto& local_data);
......
...@@ -129,8 +129,11 @@ WebAppSyncBridge::WebAppSyncBridge( ...@@ -129,8 +129,11 @@ WebAppSyncBridge::WebAppSyncBridge(
WebAppSyncBridge::~WebAppSyncBridge() = default; WebAppSyncBridge::~WebAppSyncBridge() = default;
std::unique_ptr<WebAppRegistryUpdate> WebAppSyncBridge::BeginUpdate() { std::unique_ptr<WebAppRegistryUpdate> WebAppSyncBridge::BeginUpdate() {
DCHECK(database_->is_opened());
DCHECK(!is_in_update_); DCHECK(!is_in_update_);
is_in_update_ = true; is_in_update_ = true;
return std::make_unique<WebAppRegistryUpdate>( return std::make_unique<WebAppRegistryUpdate>(
registrar_, util::PassKey<WebAppSyncBridge>()); registrar_, util::PassKey<WebAppSyncBridge>());
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment