refactor: remove banned std::to_string() calls (#41087)
* refactor: do not use banned std::to_string() in ServiceWorkerContext::GetAllRunningWorkerInfo() * refactor: do not use banned std::to_string() in REPORT_AND_RETURN_IF_FAILED() * refactor: do not use banned std::to_string() in JSChunkedDataPipeGetter::OnWriteChunkComplete() * refactor: do not use banned std::to_string() in SetCrashKey() * chore: remove unused #include
This commit is contained in:
parent
d13a93fb61
commit
4164ef93ad
18 changed files with 31 additions and 35 deletions
|
@ -7,6 +7,7 @@
|
||||||
#include <string_view>
|
#include <string_view>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
|
#include "base/strings/string_number_conversions.h"
|
||||||
#include "chrome/browser/browser_process.h"
|
#include "chrome/browser/browser_process.h"
|
||||||
#include "content/public/browser/console_message.h"
|
#include "content/public/browser/console_message.h"
|
||||||
#include "content/public/browser/storage_partition.h"
|
#include "content/public/browser/storage_partition.h"
|
||||||
|
@ -120,7 +121,7 @@ v8::Local<v8::Value> ServiceWorkerContext::GetAllRunningWorkerInfo(
|
||||||
service_worker_context_->GetRunningServiceWorkerInfos();
|
service_worker_context_->GetRunningServiceWorkerInfos();
|
||||||
for (const auto& iter : info_map) {
|
for (const auto& iter : info_map) {
|
||||||
builder.Set(
|
builder.Set(
|
||||||
std::to_string(iter.first),
|
base::NumberToString(iter.first),
|
||||||
ServiceWorkerRunningInfoToDict(isolate, std::move(iter.second)));
|
ServiceWorkerRunningInfoToDict(isolate, std::move(iter.second)));
|
||||||
}
|
}
|
||||||
return builder.Build();
|
return builder.Build();
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
#include "base/files/file_path.h"
|
#include "base/files/file_path.h"
|
||||||
#include "base/files/file_util.h"
|
#include "base/files/file_util.h"
|
||||||
#include "base/memory/raw_ptr.h"
|
#include "base/memory/raw_ptr.h"
|
||||||
#include "base/strings/string_number_conversions.h"
|
|
||||||
#include "base/strings/string_util.h"
|
#include "base/strings/string_util.h"
|
||||||
#include "base/strings/stringprintf.h"
|
#include "base/strings/stringprintf.h"
|
||||||
#include "base/uuid.h"
|
#include "base/uuid.h"
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
#include "base/i18n/rtl.h"
|
#include "base/i18n/rtl.h"
|
||||||
#include "base/mac/mac_util.h"
|
#include "base/mac/mac_util.h"
|
||||||
#include "base/mac/mac_util.mm"
|
#include "base/mac/mac_util.mm"
|
||||||
#include "base/strings/string_number_conversions.h"
|
|
||||||
#include "base/strings/sys_string_conversions.h"
|
#include "base/strings/sys_string_conversions.h"
|
||||||
#include "chrome/browser/browser_process.h"
|
#include "chrome/browser/browser_process.h"
|
||||||
#include "net/base/mac/url_conversions.h"
|
#include "net/base/mac/url_conversions.h"
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
#include "base/no_destructor.h"
|
#include "base/no_destructor.h"
|
||||||
#include "base/path_service.h"
|
#include "base/path_service.h"
|
||||||
#include "base/strings/escape.h"
|
#include "base/strings/escape.h"
|
||||||
|
#include "base/strings/string_number_conversions.h"
|
||||||
#include "base/strings/string_util.h"
|
#include "base/strings/string_util.h"
|
||||||
#include "chrome/common/chrome_paths.h"
|
#include "chrome/common/chrome_paths.h"
|
||||||
#include "chrome/common/pref_names.h"
|
#include "chrome/common/pref_names.h"
|
||||||
|
|
|
@ -12,7 +12,6 @@
|
||||||
|
|
||||||
#include "base/command_line.h"
|
#include "base/command_line.h"
|
||||||
#include "base/containers/contains.h"
|
#include "base/containers/contains.h"
|
||||||
#include "base/strings/string_number_conversions.h"
|
|
||||||
#include "base/strings/string_util.h"
|
#include "base/strings/string_util.h"
|
||||||
#include "base/strings/stringprintf.h"
|
#include "base/strings/stringprintf.h"
|
||||||
#include "base/strings/utf_string_conversions.h"
|
#include "base/strings/utf_string_conversions.h"
|
||||||
|
|
|
@ -15,6 +15,8 @@
|
||||||
|
|
||||||
#include "base/environment.h"
|
#include "base/environment.h"
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
|
#include "base/strings/strcat.h"
|
||||||
|
#include "base/strings/string_number_conversions.h"
|
||||||
#include "base/strings/string_util_win.h"
|
#include "base/strings/string_util_win.h"
|
||||||
#include "base/strings/utf_string_conversions.h"
|
#include "base/strings/utf_string_conversions.h"
|
||||||
#include "content/public/browser/browser_task_traits.h"
|
#include "content/public/browser/browser_task_traits.h"
|
||||||
|
@ -38,23 +40,22 @@ using Microsoft::WRL::Wrappers::HStringReference;
|
||||||
|
|
||||||
namespace winui = ABI::Windows::UI;
|
namespace winui = ABI::Windows::UI;
|
||||||
|
|
||||||
#define RETURN_IF_FAILED(hr) \
|
#define RETURN_IF_FAILED(hr) \
|
||||||
do { \
|
do { \
|
||||||
HRESULT _hrTemp = hr; \
|
if (const HRESULT _hrTemp = hr; FAILED(_hrTemp)) { \
|
||||||
if (FAILED(_hrTemp)) { \
|
return _hrTemp; \
|
||||||
return _hrTemp; \
|
} \
|
||||||
} \
|
|
||||||
} while (false)
|
} while (false)
|
||||||
#define REPORT_AND_RETURN_IF_FAILED(hr, msg) \
|
|
||||||
do { \
|
#define REPORT_AND_RETURN_IF_FAILED(hr, msg) \
|
||||||
HRESULT _hrTemp = hr; \
|
do { \
|
||||||
std::string _msgTemp = msg; \
|
if (const HRESULT _hrTemp = hr; FAILED(_hrTemp)) { \
|
||||||
if (FAILED(_hrTemp)) { \
|
std::string _err = \
|
||||||
std::string _err = _msgTemp + ",ERROR " + std::to_string(_hrTemp); \
|
base::StrCat({msg, ", ERROR ", base::NumberToString(_hrTemp)}); \
|
||||||
DebugLog(_err); \
|
DebugLog(_err); \
|
||||||
Notification::NotificationFailed(_err); \
|
Notification::NotificationFailed(_err); \
|
||||||
return _hrTemp; \
|
return _hrTemp; \
|
||||||
} \
|
} \
|
||||||
} while (false)
|
} while (false)
|
||||||
|
|
||||||
namespace electron {
|
namespace electron {
|
||||||
|
|
|
@ -11,7 +11,6 @@
|
||||||
|
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
#include "base/stl_util.h"
|
#include "base/stl_util.h"
|
||||||
#include "base/strings/string_number_conversions.h"
|
|
||||||
#include "base/strings/string_split.h"
|
#include "base/strings/string_split.h"
|
||||||
#include "base/strings/string_util.h"
|
#include "base/strings/string_util.h"
|
||||||
#include "shell/common/keyboard_util.h"
|
#include "shell/common/keyboard_util.h"
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
#include "base/metrics/histogram.h"
|
#include "base/metrics/histogram.h"
|
||||||
#include "base/stl_util.h"
|
#include "base/stl_util.h"
|
||||||
#include "base/strings/pattern.h"
|
#include "base/strings/pattern.h"
|
||||||
|
#include "base/strings/string_number_conversions.h"
|
||||||
#include "base/strings/string_util.h"
|
#include "base/strings/string_util.h"
|
||||||
#include "base/strings/stringprintf.h"
|
#include "base/strings/stringprintf.h"
|
||||||
#include "base/strings/utf_string_conversions.h"
|
#include "base/strings/utf_string_conversions.h"
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
#include "base/json/json_writer.h"
|
#include "base/json/json_writer.h"
|
||||||
#include "base/strings/escape.h"
|
#include "base/strings/escape.h"
|
||||||
#include "base/strings/pattern.h"
|
#include "base/strings/pattern.h"
|
||||||
#include "base/strings/string_number_conversions.h"
|
|
||||||
#include "base/strings/utf_string_conversions.h"
|
#include "base/strings/utf_string_conversions.h"
|
||||||
#include "base/values.h"
|
#include "base/values.h"
|
||||||
#include "build/build_config.h"
|
#include "build/build_config.h"
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
#include <objbase.h>
|
#include <objbase.h>
|
||||||
|
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
#include "base/strings/string_number_conversions.h"
|
|
||||||
#include "base/strings/string_util_win.h"
|
#include "base/strings/string_util_win.h"
|
||||||
#include "base/strings/utf_string_conversions.h"
|
#include "base/strings/utf_string_conversions.h"
|
||||||
#include "base/win/windows_version.h"
|
#include "base/win/windows_version.h"
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
#include "base/containers/contains.h"
|
#include "base/containers/contains.h"
|
||||||
#include "base/functional/bind.h"
|
#include "base/functional/bind.h"
|
||||||
#include "base/observer_list.h"
|
#include "base/observer_list.h"
|
||||||
#include "base/strings/string_number_conversions.h"
|
|
||||||
#include "base/strings/string_util.h"
|
#include "base/strings/string_util.h"
|
||||||
#include "base/strings/stringprintf.h"
|
#include "base/strings/stringprintf.h"
|
||||||
#include "base/strings/utf_string_conversions.h"
|
#include "base/strings/utf_string_conversions.h"
|
||||||
|
|
|
@ -13,7 +13,6 @@
|
||||||
#include "base/command_line.h"
|
#include "base/command_line.h"
|
||||||
#include "base/containers/fixed_flat_map.h"
|
#include "base/containers/fixed_flat_map.h"
|
||||||
#include "base/memory/ptr_util.h"
|
#include "base/memory/ptr_util.h"
|
||||||
#include "base/strings/string_number_conversions.h"
|
|
||||||
#include "base/strings/utf_string_conversions.h"
|
#include "base/strings/utf_string_conversions.h"
|
||||||
#include "cc/base/switches.h"
|
#include "cc/base/switches.h"
|
||||||
#include "content/public/browser/render_frame_host.h"
|
#include "content/public/browser/render_frame_host.h"
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
#include "base/memory/raw_ptr.h"
|
#include "base/memory/raw_ptr.h"
|
||||||
#include "base/no_destructor.h"
|
#include "base/no_destructor.h"
|
||||||
#include "base/sequence_checker.h"
|
#include "base/sequence_checker.h"
|
||||||
|
#include "base/strings/string_number_conversions.h"
|
||||||
#include "gin/handle.h"
|
#include "gin/handle.h"
|
||||||
#include "gin/object_template_builder.h"
|
#include "gin/object_template_builder.h"
|
||||||
#include "gin/wrappable.h"
|
#include "gin/wrappable.h"
|
||||||
|
@ -263,7 +264,7 @@ class JSChunkedDataPipeGetter : public gin::Wrappable<JSChunkedDataPipeGetter>,
|
||||||
promise.Resolve();
|
promise.Resolve();
|
||||||
} else {
|
} else {
|
||||||
promise.RejectWithErrorMessage("mojo result not ok: " +
|
promise.RejectWithErrorMessage("mojo result not ok: " +
|
||||||
std::to_string(result));
|
base::NumberToString(result));
|
||||||
Finished();
|
Finished();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,6 @@
|
||||||
#include "base/json/json_reader.h"
|
#include "base/json/json_reader.h"
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
#include "base/pickle.h"
|
#include "base/pickle.h"
|
||||||
#include "base/strings/string_number_conversions.h"
|
|
||||||
#include "base/values.h"
|
#include "base/values.h"
|
||||||
#include "electron/fuses.h"
|
#include "electron/fuses.h"
|
||||||
#include "shell/common/asar/asar_util.h"
|
#include "shell/common/asar/asar_util.h"
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
#include "shell/common/crash_keys.h"
|
#include "shell/common/crash_keys.h"
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
#include <deque>
|
#include <deque>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
@ -12,6 +13,7 @@
|
||||||
#include "base/environment.h"
|
#include "base/environment.h"
|
||||||
#include "base/no_destructor.h"
|
#include "base/no_destructor.h"
|
||||||
#include "base/strings/string_split.h"
|
#include "base/strings/string_split.h"
|
||||||
|
#include "base/strings/stringprintf.h"
|
||||||
#include "components/crash/core/common/crash_key.h"
|
#include "components/crash/core/common/crash_key.h"
|
||||||
#include "content/public/common/content_switches.h"
|
#include "content/public/common/content_switches.h"
|
||||||
#include "electron/buildflags/buildflags.h"
|
#include "electron/buildflags/buildflags.h"
|
||||||
|
@ -55,11 +57,12 @@ void SetCrashKey(const std::string& key, const std::string& value) {
|
||||||
if (key.size() >= kMaxCrashKeyNameLength) {
|
if (key.size() >= kMaxCrashKeyNameLength) {
|
||||||
node::Environment* env =
|
node::Environment* env =
|
||||||
node::Environment::GetCurrent(JavascriptEnvironment::GetIsolate());
|
node::Environment::GetCurrent(JavascriptEnvironment::GetIsolate());
|
||||||
EmitWarning(env,
|
EmitWarning(
|
||||||
"The crash key name, \"" + key + "\", is longer than " +
|
env,
|
||||||
std::to_string(kMaxCrashKeyNameLength) +
|
base::StringPrintf("The crash key name, \"%s\", is longer than %" PRIu32
|
||||||
" bytes, ignoring it.",
|
" bytes, ignoring it.",
|
||||||
"electron");
|
key.c_str(), kMaxCrashKeyNameLength),
|
||||||
|
"electron");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "base/containers/fixed_flat_map.h"
|
#include "base/containers/fixed_flat_map.h"
|
||||||
#include "base/strings/string_number_conversions.h"
|
|
||||||
#include "base/strings/string_util.h"
|
#include "base/strings/string_util.h"
|
||||||
#include "shell/common/keyboard_util.h"
|
#include "shell/common/keyboard_util.h"
|
||||||
#include "third_party/blink/public/common/input/web_input_event.h"
|
#include "third_party/blink/public/common/input/web_input_event.h"
|
||||||
|
|
|
@ -14,7 +14,6 @@
|
||||||
#include "base/containers/contains.h"
|
#include "base/containers/contains.h"
|
||||||
#include "base/feature_list.h"
|
#include "base/feature_list.h"
|
||||||
#include "base/no_destructor.h"
|
#include "base/no_destructor.h"
|
||||||
#include "base/strings/string_number_conversions.h"
|
|
||||||
#include "base/trace_event/trace_event.h"
|
#include "base/trace_event/trace_event.h"
|
||||||
#include "content/public/renderer/render_frame.h"
|
#include "content/public/renderer/render_frame.h"
|
||||||
#include "content/public/renderer/render_frame_observer.h"
|
#include "content/public/renderer/render_frame_observer.h"
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
|
|
||||||
#include "base/command_line.h"
|
#include "base/command_line.h"
|
||||||
#include "base/memory/ref_counted_memory.h"
|
#include "base/memory/ref_counted_memory.h"
|
||||||
#include "base/strings/string_number_conversions.h"
|
|
||||||
#include "base/trace_event/trace_event.h"
|
#include "base/trace_event/trace_event.h"
|
||||||
#include "content/public/renderer/render_frame.h"
|
#include "content/public/renderer/render_frame.h"
|
||||||
#include "electron/buildflags/buildflags.h"
|
#include "electron/buildflags/buildflags.h"
|
||||||
|
|
Loading…
Reference in a new issue