Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add GetPersistentSetting() to h5vcc_settings. #1969

Merged
merged 1 commit into from
Nov 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions cobalt/h5vcc/h5vcc_settings.cc
Original file line number Diff line number Diff line change
Expand Up @@ -104,5 +104,22 @@
return false;
}

void H5vccSettings::SetPersistentSettingAsInt(const std::string& key,
int value) const {
if (persistent_settings_) {
persistent_settings_->SetPersistentSetting(
key, std::make_unique<base::Value>(value));

Check warning on line 111 in cobalt/h5vcc/h5vcc_settings.cc

View check run for this annotation

Codecov / codecov/patch

cobalt/h5vcc/h5vcc_settings.cc#L108-L111

Added lines #L108 - L111 were not covered by tests
}
}

int H5vccSettings::GetPersistentSettingAsInt(const std::string& key,
int default_setting) const {
if (persistent_settings_) {
return persistent_settings_->GetPersistentSettingAsInt(key,
default_setting);

Check warning on line 119 in cobalt/h5vcc/h5vcc_settings.cc

View check run for this annotation

Codecov / codecov/patch

cobalt/h5vcc/h5vcc_settings.cc#L116-L119

Added lines #L116 - L119 were not covered by tests
}
return default_setting;

Check warning on line 121 in cobalt/h5vcc/h5vcc_settings.cc

View check run for this annotation

Codecov / codecov/patch

cobalt/h5vcc/h5vcc_settings.cc#L121

Added line #L121 was not covered by tests
}

} // namespace h5vcc
} // namespace cobalt
5 changes: 5 additions & 0 deletions cobalt/h5vcc/h5vcc_settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ class H5vccSettings : public script::Wrappable {
// invalid or not set to the expected value.
bool Set(const std::string& name, SetValueType value) const;

void SetPersistentSettingAsInt(const std::string& key, int value) const;
joeltine marked this conversation as resolved.
Show resolved Hide resolved

int GetPersistentSettingAsInt(const std::string& key,
int default_setting) const;

DEFINE_WRAPPABLE_TYPE(H5vccSettings);

private:
Expand Down
2 changes: 2 additions & 0 deletions cobalt/h5vcc/h5vcc_settings.idl
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,6 @@

interface H5vccSettings {
boolean set(DOMString name, (long or DOMString) value);
void setPersistentSettingAsInt(DOMString name, long value);
long getPersistentSettingAsInt(DOMString name, long default_setting);
};