refactor: remove banned std::to_string() calls (#41109)

* refactor: do not use banned std::to_string() in ServiceWorkerContext::GetAllRunningWorkerInfo()

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* refactor: do not use banned std::to_string() in REPORT_AND_RETURN_IF_FAILED()

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* refactor: do not use banned std::to_string() in JSChunkedDataPipeGetter::OnWriteChunkComplete()

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* refactor: do not use banned std::to_string() in SetCrashKey()

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* chore: remove unused #include

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* fixup! refactor: do not use banned std::to_string() in REPORT_AND_RETURN_IF_FAILED()

Co-authored-by: Charles Kerr <charles@charleskerr.com>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
This commit is contained in:
trop[bot]
2024-01-25 09:45:14 +09:00
committed by GitHub
parent dd142b0327
commit 1ff780d3dd
18 changed files with 31 additions and 35 deletions

View File

@@ -15,6 +15,7 @@
#include "base/memory/raw_ptr.h"
#include "base/no_destructor.h"
#include "base/sequence_checker.h"
#include "base/strings/string_number_conversions.h"
#include "gin/handle.h"
#include "gin/object_template_builder.h"
#include "gin/wrappable.h"
@@ -263,7 +264,7 @@ class JSChunkedDataPipeGetter : public gin::Wrappable<JSChunkedDataPipeGetter>,
promise.Resolve();
} else {
promise.RejectWithErrorMessage("mojo result not ok: " +
std::to_string(result));
base::NumberToString(result));
Finished();
}
}

View File

@@ -15,7 +15,6 @@
#include "base/json/json_reader.h"
#include "base/logging.h"
#include "base/pickle.h"
#include "base/strings/string_number_conversions.h"
#include "base/values.h"
#include "electron/fuses.h"
#include "shell/common/asar/asar_util.h"

View File

@@ -4,6 +4,7 @@
#include "shell/common/crash_keys.h"
#include <cstdint>
#include <deque>
#include <map>
#include <string>
@@ -12,6 +13,7 @@
#include "base/environment.h"
#include "base/no_destructor.h"
#include "base/strings/string_split.h"
#include "base/strings/stringprintf.h"
#include "components/crash/core/common/crash_key.h"
#include "content/public/common/content_switches.h"
#include "electron/buildflags/buildflags.h"
@@ -55,11 +57,12 @@ void SetCrashKey(const std::string& key, const std::string& value) {
if (key.size() >= kMaxCrashKeyNameLength) {
node::Environment* env =
node::Environment::GetCurrent(JavascriptEnvironment::GetIsolate());
EmitWarning(env,
"The crash key name, \"" + key + "\", is longer than " +
std::to_string(kMaxCrashKeyNameLength) +
" bytes, ignoring it.",
"electron");
EmitWarning(
env,
base::StringPrintf("The crash key name, \"%s\", is longer than %" PRIu32
" bytes, ignoring it.",
key.c_str(), kMaxCrashKeyNameLength),
"electron");
return;
}

View File

@@ -5,7 +5,6 @@
#include <string>
#include "base/containers/fixed_flat_map.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "shell/common/keyboard_util.h"
#include "third_party/blink/public/common/input/web_input_event.h"