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
|
@ -15,6 +15,8 @@
|
|||
|
||||
#include "base/environment.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/utf_string_conversions.h"
|
||||
#include "content/public/browser/browser_task_traits.h"
|
||||
|
@ -38,23 +40,22 @@ using Microsoft::WRL::Wrappers::HStringReference;
|
|||
|
||||
namespace winui = ABI::Windows::UI;
|
||||
|
||||
#define RETURN_IF_FAILED(hr) \
|
||||
do { \
|
||||
HRESULT _hrTemp = hr; \
|
||||
if (FAILED(_hrTemp)) { \
|
||||
return _hrTemp; \
|
||||
} \
|
||||
#define RETURN_IF_FAILED(hr) \
|
||||
do { \
|
||||
if (const HRESULT _hrTemp = hr; FAILED(_hrTemp)) { \
|
||||
return _hrTemp; \
|
||||
} \
|
||||
} while (false)
|
||||
#define REPORT_AND_RETURN_IF_FAILED(hr, msg) \
|
||||
do { \
|
||||
HRESULT _hrTemp = hr; \
|
||||
std::string _msgTemp = msg; \
|
||||
if (FAILED(_hrTemp)) { \
|
||||
std::string _err = _msgTemp + ",ERROR " + std::to_string(_hrTemp); \
|
||||
DebugLog(_err); \
|
||||
Notification::NotificationFailed(_err); \
|
||||
return _hrTemp; \
|
||||
} \
|
||||
|
||||
#define REPORT_AND_RETURN_IF_FAILED(hr, msg) \
|
||||
do { \
|
||||
if (const HRESULT _hrTemp = hr; FAILED(_hrTemp)) { \
|
||||
std::string _err = \
|
||||
base::StrCat({msg, ", ERROR ", base::NumberToString(_hrTemp)}); \
|
||||
DebugLog(_err); \
|
||||
Notification::NotificationFailed(_err); \
|
||||
return _hrTemp; \
|
||||
} \
|
||||
} while (false)
|
||||
|
||||
namespace electron {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue