blob: d99abe9cdfa95d4bfd0e4ada54b807cd5d20b445 [file] [log] [blame]
// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "third_party/blink/public/common/shared_storage/shared_storage_utils.h"
#include "base/metrics/histogram_functions.h"
#include "third_party/blink/public/common/features.h"
namespace blink {
bool IsValidSharedStorageURLsArrayLength(size_t length) {
return length > 0u &&
length <=
static_cast<size_t>(
features::kSharedStorageURLSelectionOperationInputURLSizeLimit
.Get());
}
bool IsValidSharedStorageKeyStringLength(size_t length) {
return length > 0u &&
length <=
static_cast<size_t>(features::kMaxSharedStorageStringLength.Get());
}
bool IsValidSharedStorageValueStringLength(size_t length) {
return length <=
static_cast<size_t>(features::kMaxSharedStorageStringLength.Get());
}
void LogSharedStorageWorkletError(SharedStorageWorkletErrorType error_type) {
base::UmaHistogramEnumeration("Storage.SharedStorage.Worklet.Error.Type",
error_type);
}
} // namespace blink