Skip to content

Commit

Permalink
PinManager: Renamed some classes and structs
Browse files Browse the repository at this point in the history
Use shorter names for better readability and consistency.

DriveFsPinManager -> PinManager (which is already in the
drivefs::pinning namespace).
PinManager::StableId -> Id
PinManager::Progress -> File

Bug: b:265590115
Test: out/Default/chromeos_unittests --gtest_filter=DriveFsPinManagerTest.*
Change-Id: I350775c0582aa1b9bc710510df7c88d596a4bb19
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4190765
Reviewed-by: Ben Reich <benreich@chromium.org>
Commit-Queue: François Degros <fdegros@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1096607}
  • Loading branch information
fdegros authored and Chromium LUCI CQ committed Jan 25, 2023
1 parent 7f138cb commit 2c81b1f
Show file tree
Hide file tree
Showing 6 changed files with 278 additions and 295 deletions.
2 changes: 1 addition & 1 deletion chrome/browser/ash/drive/drive_integration_service.cc
Expand Up @@ -1074,7 +1074,7 @@ void DriveIntegrationService::OnMounted(const base::FilePath& mount_path) {
}

if (ash::features::IsDriveFsBulkPinningEnabled()) {
pin_manager_ = std::make_unique<drivefs::pinning::DriveFsPinManager>(
pin_manager_ = std::make_unique<drivefs::pinning::PinManager>(
profile_->GetPath(), GetDriveFsInterface());
GetDriveFsHost()->AddObserver(pin_manager_.get());
ToggleBulkPinning();
Expand Down
6 changes: 3 additions & 3 deletions chrome/browser/ash/drive/drive_integration_service.h
Expand Up @@ -178,8 +178,8 @@ class DriveIntegrationService : public KeyedService,
// Returns the DriveFsHost if it is enabled.
drivefs::DriveFsHost* GetDriveFsHost() const;

// Returns the `DriveFsPinManager` iff DriveFS is mounted.
drivefs::pinning::DriveFsPinManager* GetPinManager() const {
// Returns the PinManager if DriveFS is mounted and bulk-pinning is enabled.
drivefs::pinning::PinManager* GetPinManager() const {
return pin_manager_.get();
}

Expand Down Expand Up @@ -415,7 +415,7 @@ class DriveIntegrationService : public KeyedService,

std::unique_ptr<DriveFsHolder> drivefs_holder_;
std::unique_ptr<PreferenceWatcher> preference_watcher_;
std::unique_ptr<drivefs::pinning::DriveFsPinManager> pin_manager_;
std::unique_ptr<drivefs::pinning::PinManager> pin_manager_;
int drivefs_total_failures_count_ = 0;
int drivefs_consecutive_failures_count_ = 0;
bool remount_when_online_ = false;
Expand Down
10 changes: 5 additions & 5 deletions chrome/browser/ui/webui/ash/drive_internals_ui.cc
Expand Up @@ -69,7 +69,7 @@ namespace {

using content::BrowserThread;
using drive::DriveIntegrationService;
using drivefs::pinning::DriveFsPinManager;
using drivefs::pinning::PinManager;

constexpr char kKey[] = "key";
constexpr char kValue[] = "value";
Expand Down Expand Up @@ -248,11 +248,11 @@ void ZipLogs(Profile* profile,

// Class to handle messages from chrome://drive-internals.
class DriveInternalsWebUIHandler : public content::WebUIMessageHandler,
public DriveFsPinManager::Observer {
public PinManager::Observer {
public:
~DriveInternalsWebUIHandler() override {
if (pin_manager_) {
VLOG(1) << "DriveInternalsWebUIHandler dropped before DriveFsPinManager";
VLOG(1) << "DriveInternalsWebUIHandler dropped before PinManager";
pin_manager_->RemoveObserver(this);
}
}
Expand Down Expand Up @@ -628,7 +628,7 @@ class DriveInternalsWebUIHandler : public content::WebUIMessageHandler,

void OnDrop() override {
if (pin_manager_) {
VLOG(1) << "DriveFsPinManager dropped before DriveInternalsWebUIHandler";
VLOG(1) << "PinManager dropped before DriveInternalsWebUIHandler";
pin_manager_ = nullptr;
}
}
Expand Down Expand Up @@ -971,7 +971,7 @@ class DriveInternalsWebUIHandler : public content::WebUIMessageHandler,
}

// DriveFS bulk-pinning manager.
base::raw_ptr<DriveFsPinManager> pin_manager_ = nullptr;
base::raw_ptr<PinManager> pin_manager_ = nullptr;

// The last event sent to the JavaScript side.
int last_sent_event_id_ = -1;
Expand Down

0 comments on commit 2c81b1f

Please sign in to comment.