Merge "[TeX] Improved readability for Histogram metric APIs" am: cb5b0686e5

Original change: https://android-review.googlesource.com/c/platform/system/core/+/2430774

Change-Id: I98441c509a6f25eee6159e5a80a70e4123ee3914
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Treehugger Robot 2023-02-11 05:38:59 +00:00 committed by Automerger Merge Worker
commit 129ce46e17
2 changed files with 8 additions and 6 deletions

View file

@ -26,8 +26,8 @@
namespace android {
namespace expresslog {
Histogram::UniformOptions* Histogram::UniformOptions::create(int binCount, float minValue,
float exclusiveMaxValue) {
std::shared_ptr<Histogram::UniformOptions> Histogram::UniformOptions::create(
int binCount, float minValue, float exclusiveMaxValue) {
if (binCount < 1) {
ALOGE("Bin count should be positive number");
return nullptr;
@ -38,7 +38,8 @@ Histogram::UniformOptions* Histogram::UniformOptions::create(int binCount, float
return nullptr;
}
return new UniformOptions(binCount, minValue, exclusiveMaxValue);
return std::shared_ptr<UniformOptions>(
new UniformOptions(binCount, minValue, exclusiveMaxValue));
}
Histogram::UniformOptions::UniformOptions(int binCount, float minValue, float exclusiveMaxValue)

View file

@ -46,10 +46,9 @@ public:
/** Used by Histogram to map data sample to corresponding bin for uniform bins */
class UniformOptions : public BinOptions {
UniformOptions(int binCount, float minValue, float exclusiveMaxValue);
public:
static UniformOptions* create(int binCount, float minValue, float exclusiveMaxValue);
static std::shared_ptr<UniformOptions> create(int binCount, float minValue,
float exclusiveMaxValue);
int getBinsCount() const override {
return mBinCount;
@ -58,6 +57,8 @@ public:
int getBinForSample(float sample) const override;
private:
UniformOptions(int binCount, float minValue, float exclusiveMaxValue);
const int mBinCount;
const float mMinValue;
const float mExclusiveMaxValue;