Replace base::StringPiece in //dbus with std::string_view
Bug: 691162 Change-Id: I37d4fed4cf78ada804b58525253b3f6f0300d9ff Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5040200 Reviewed-by: Ryo Hashimoto <hashimoto@chromium.org> Commit-Queue: Hyowon Kim <hyowon@igalia.com> Cr-Commit-Position: refs/heads/main@{#1228616}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
8a8c48939e
commit
eb6a4c4c4e
@ -513,7 +513,7 @@ void MessageWriter::AppendDouble(double value) {
|
||||
AppendBasic(DBUS_TYPE_DOUBLE, &value);
|
||||
}
|
||||
|
||||
void MessageWriter::AppendString(base::StringPiece value) {
|
||||
void MessageWriter::AppendString(std::string_view value) {
|
||||
// D-Bus Specification (0.19) says a string "must be valid UTF-8".
|
||||
CHECK(base::IsStringUTF8(value));
|
||||
const char* pointer = value.data() ? value.data() : "";
|
||||
|
@ -15,7 +15,6 @@
|
||||
|
||||
#include "base/files/scoped_file.h"
|
||||
#include "base/memory/raw_ptr.h"
|
||||
#include "base/strings/string_piece.h"
|
||||
#include "dbus/dbus_export.h"
|
||||
#include "dbus/object_path.h"
|
||||
|
||||
@ -288,7 +287,7 @@ class CHROME_DBUS_EXPORT MessageWriter {
|
||||
void AppendInt64(int64_t value);
|
||||
void AppendUint64(uint64_t value);
|
||||
void AppendDouble(double value);
|
||||
void AppendString(base::StringPiece value);
|
||||
void AppendString(std::string_view value);
|
||||
void AppendObjectPath(const ObjectPath& value);
|
||||
|
||||
// Appends a file descriptor to the message.
|
||||
|
@ -13,7 +13,6 @@
|
||||
#include "base/functional/bind.h"
|
||||
#include "base/functional/callback_helpers.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/strings/string_piece.h"
|
||||
#include "base/strings/stringprintf.h"
|
||||
#include "base/task/sequenced_task_runner.h"
|
||||
#include "base/threading/scoped_blocking_call.h"
|
||||
@ -555,10 +554,10 @@ DBusHandlerResult ObjectProxy::HandleMessageThunk(DBusConnection* connection,
|
||||
}
|
||||
|
||||
void ObjectProxy::LogMethodCallFailure(
|
||||
const base::StringPiece& interface_name,
|
||||
const base::StringPiece& method_name,
|
||||
const base::StringPiece& error_name,
|
||||
const base::StringPiece& error_message) const {
|
||||
const std::string_view& interface_name,
|
||||
const std::string_view& method_name,
|
||||
const std::string_view& error_name,
|
||||
const std::string_view& error_message) const {
|
||||
if (ignore_service_unknown_errors_ &&
|
||||
(error_name == kErrorServiceUnknown || error_name == kErrorObjectUnknown))
|
||||
return;
|
||||
|
@ -15,7 +15,6 @@
|
||||
|
||||
#include "base/functional/callback.h"
|
||||
#include "base/memory/ref_counted.h"
|
||||
#include "base/strings/string_piece.h"
|
||||
#include "base/task/sequenced_task_runner.h"
|
||||
#include "base/time/time.h"
|
||||
#include "base/types/expected.h"
|
||||
@ -290,10 +289,10 @@ class CHROME_DBUS_EXPORT ObjectProxy
|
||||
void* user_data);
|
||||
|
||||
// Helper method for logging response errors appropriately.
|
||||
void LogMethodCallFailure(const base::StringPiece& interface_name,
|
||||
const base::StringPiece& method_name,
|
||||
const base::StringPiece& error_name,
|
||||
const base::StringPiece& error_message) const;
|
||||
void LogMethodCallFailure(const std::string_view& interface_name,
|
||||
const std::string_view& method_name,
|
||||
const std::string_view& error_name,
|
||||
const std::string_view& error_message) const;
|
||||
|
||||
// Used as ResponseOrErrorCallback by CallMethod().
|
||||
// Logs error message, and drops |error_response| from the arguments to pass
|
||||
|
@ -80,7 +80,7 @@ std::string GetTypeSignature(base::ValueView value) {
|
||||
|
||||
std::string operator()(double) { return "d"; }
|
||||
|
||||
std::string operator()(base::StringPiece) { return "s"; }
|
||||
std::string operator()(std::string_view) { return "s"; }
|
||||
|
||||
std::string operator()(const base::Value::BlobStorage&) { return "ay"; }
|
||||
|
||||
@ -232,7 +232,7 @@ void AppendBasicTypeValueData(MessageWriter* writer, base::ValueView value) {
|
||||
|
||||
void operator()(double value) { writer->AppendDouble(value); }
|
||||
|
||||
void operator()(base::StringPiece value) { writer->AppendString(value); }
|
||||
void operator()(std::string_view value) { writer->AppendString(value); }
|
||||
|
||||
void operator()(const base::Value::BlobStorage&) {
|
||||
DLOG(ERROR) << "Unexpected type: " << base::Value::Type::BINARY;
|
||||
@ -278,7 +278,7 @@ void AppendValueData(MessageWriter* writer, base::ValueView value) {
|
||||
return AppendBasicTypeValueData(writer, value);
|
||||
}
|
||||
|
||||
void operator()(base::StringPiece value) {
|
||||
void operator()(std::string_view value) {
|
||||
return AppendBasicTypeValueData(writer, value);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user