Skip to content

Commit

Permalink
Saved Desks: Remove vestigial DeleteAllEntries from public API
Browse files Browse the repository at this point in the history
This CL removes a vestigial DeleteAllEntries function from the
public API of the DeskSyncBridge.  This is done to maintain
a separation of concerns between the DeskSyncBridge and the
DeskModelWrapper.  The function itself is not completely removed
as the wrapper needs to access it in order to perform properly
however the function has been renamed to DeleteAllEntriesSync
to disambiguate its usage.

TESTED: DeskSyncBridgeTest.*,DeskModelWrapperTest.*
Bug: 1358677
Change-Id: Ib17b60bb89da8302ab74182114dbb0ea3ed99230
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3867389
Reviewed-by: Yanzhu Du <yzd@google.com>
Commit-Queue: Avynn Donaghe <avynn@google.com>
Cr-Commit-Position: refs/heads/main@{#1042371}
  • Loading branch information
avynn authored and Chromium LUCI CQ committed Sep 1, 2022
1 parent 25a0219 commit 932039a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion components/desks_storage/core/desk_model_wrapper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ void DeskModelWrapper::DeleteEntry(const base::GUID& uuid,
void DeskModelWrapper::DeleteAllEntries(
DeskModel::DeleteEntryCallback callback) {
DeskModel::DeleteEntryStatus desk_template_delete_status =
GetDeskTemplateModel()->DeleteAllEntries();
GetDeskTemplateModel()->DeleteAllEntriesSync();
if (desk_template_delete_status != DeskModel::DeleteEntryStatus::kOk) {
std::move(callback).Run(desk_template_delete_status);
return;
Expand Down
4 changes: 2 additions & 2 deletions components/desks_storage/core/desk_sync_bridge.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1180,11 +1180,11 @@ void DeskSyncBridge::DeleteEntry(const base::GUID& uuid,
}

void DeskSyncBridge::DeleteAllEntries(DeleteEntryCallback callback) {
DeleteEntryStatus status = DeleteAllEntries();
DeleteEntryStatus status = DeleteAllEntriesSync();
std::move(callback).Run(status);
}

DeskModel::DeleteEntryStatus DeskSyncBridge::DeleteAllEntries() {
DeskModel::DeleteEntryStatus DeskSyncBridge::DeleteAllEntriesSync() {
if (!IsReady()) {
// This sync bridge has not finished initializing.
// Cannot delete anything.
Expand Down
6 changes: 4 additions & 2 deletions components/desks_storage/core/desk_sync_bridge.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,14 @@ class DeskSyncBridge : public syncer::ModelTypeSyncBridge, public DeskModel {

const ash::DeskTemplate* GetUserEntryByUUID(const base::GUID& uuid) const;

DeskModel::DeleteEntryStatus DeleteAllEntries();

private:
friend class DeskModelWrapper;

using DeskEntries =
base::flat_map<base::GUID, std::unique_ptr<ash::DeskTemplate>>;

DeskModel::DeleteEntryStatus DeleteAllEntriesSync();

// Notify all observers that the model is loaded;
void NotifyDeskModelLoaded();

Expand Down

0 comments on commit 932039a

Please sign in to comment.