Convert base::StringPiece to std::string_view in //components 3/5
The changes of this CL are made using the following script. Script: https://issues.chromium.org/issues/40506050#comment343 Bug: 40506050 Change-Id: I7b21541a0723d312206c786d3af570f552ceef4e Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5498922 Auto-Submit: Helmut Januschka <helmut@januschka.com> Commit-Queue: Helmut Januschka <helmut@januschka.com> Reviewed-by: Nico Weber <thakis@chromium.org> Cr-Commit-Position: refs/heads/main@{#1295637}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
68ba09c5a4
commit
3ae90009a0
components
prefs
default_pref_store.ccdefault_pref_store.hin_memory_pref_store.ccin_memory_pref_store.hjson_pref_store.ccjson_pref_store.hoverlay_user_pref_store.ccoverlay_user_pref_store.hpref_name_set.hpref_service.ccpref_service.hpref_store.hpref_value_map.ccpref_value_map.hpref_value_store.ccpref_value_store.hsegregated_pref_store.ccsegregated_pref_store.htesting_pref_store.cctesting_pref_store.hvalue_map_pref_store.ccvalue_map_pref_store.h
printing
safe_browsing
content
browser
renderer
core
safe_search_api
search_engines
android
keyword_table.ccsearch_engine_choice
search_host_to_urls_map.ccsearch_host_to_urls_map.htemplate_url.cctemplate_url.htemplate_url_data.cctemplate_url_data.htemplate_url_data_unittest.cctemplate_url_data_util.ccsearch_provider_logos
segmentation_platform
embedder
default_model
internal
data_collection
database
execution
processing
metrics
segmentation_platform_service_test_base.ccsegmentation_ukm_helper_unittest.ccselection
stats.ccpublic
sessions
shared_highlighting
signin
core
browser
internal
identity_manager
public
speech
@ -5,8 +5,10 @@
|
||||
#include "components/sessions/core/command_storage_backend.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <limits>
|
||||
#include <string_view>
|
||||
#include <utility>
|
||||
|
||||
#include "base/feature_list.h"
|
||||
@ -333,8 +335,8 @@ SessionFileReader::CreateCommandFromEncrypted(const char* data,
|
||||
memset(nonce, 0, kNonceLength);
|
||||
memcpy(nonce, &command_counter_, sizeof(command_counter_));
|
||||
std::string plain_text;
|
||||
if (!aead_->Open(base::StringPiece(data, length),
|
||||
base::StringPiece(nonce, kNonceLength), base::StringPiece(),
|
||||
if (!aead_->Open(std::string_view(data, length),
|
||||
std::string_view(nonce, kNonceLength), std::string_view(),
|
||||
&plain_text)) {
|
||||
DVLOG(1) << "SessionFileReader::ReadCommand, decryption failed";
|
||||
return nullptr;
|
||||
@ -821,8 +823,8 @@ bool CommandStorageBackend::AppendEncryptedCommandToFile(
|
||||
command_size);
|
||||
|
||||
std::string cipher_text;
|
||||
aead_->Seal(base::StringPiece(&command_and_id.front(), command_and_id.size()),
|
||||
base::StringPiece(nonce, kNonceLength), base::StringPiece(),
|
||||
aead_->Seal(std::string_view(&command_and_id.front(), command_and_id.size()),
|
||||
std::string_view(nonce, kNonceLength), std::string_view(),
|
||||
&cipher_text);
|
||||
DCHECK_LE(cipher_text.size(), std::numeric_limits<size_type>::max());
|
||||
const size_type command_and_id_size =
|
||||
|
@ -9,8 +9,8 @@
|
||||
#include <stdint.h>
|
||||
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
|
||||
#include "base/strings/string_piece.h"
|
||||
#include "components/sessions/core/sessions_export.h"
|
||||
|
||||
namespace base {
|
||||
@ -52,8 +52,8 @@ class SESSIONS_EXPORT SessionCommand {
|
||||
// The contents of the command.
|
||||
char* contents() { return const_cast<char*>(contents_.c_str()); }
|
||||
const char* contents() const { return contents_.c_str(); }
|
||||
base::StringPiece contents_as_string_piece() const {
|
||||
return base::StringPiece(contents_);
|
||||
std::string_view contents_as_string_piece() const {
|
||||
return std::string_view(contents_);
|
||||
}
|
||||
// Identifier for the command.
|
||||
id_type id() const { return id_; }
|
||||
|
Reference in New Issue
Block a user