Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichaël Zasso <targos@protonmail.com>2021-02-12 22:57:53 +0300
committerMichaël Zasso <targos@protonmail.com>2021-02-20 12:50:28 +0300
commitd1f1fcfe0cea492152bcc8d008dc2ef59e2e0786 (patch)
treeee759f9140a3d9fe5b75f73d7fc57d86a918ff3c /src/inspector
parent5421e15bdc6122420d90ec462c3622b57d59c9d6 (diff)
src: avoid implicit type conversions (take 2)
This fixes more C4244 MSVC warnings in the code base. Refs: https://github.com/nodejs/node/pull/37149 PR-URL: https://github.com/nodejs/node/pull/37334 Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'src/inspector')
-rw-r--r--src/inspector/worker_inspector.cc27
-rw-r--r--src/inspector/worker_inspector.h15
2 files changed, 23 insertions, 19 deletions
diff --git a/src/inspector/worker_inspector.cc b/src/inspector/worker_inspector.cc
index deeddcc0836..ff292ea4422 100644
--- a/src/inspector/worker_inspector.cc
+++ b/src/inspector/worker_inspector.cc
@@ -11,7 +11,7 @@ namespace {
class WorkerStartedRequest : public Request {
public:
WorkerStartedRequest(
- int id,
+ uint64_t id,
const std::string& url,
std::shared_ptr<node::inspector::MainThreadHandle> worker_thread,
bool waiting)
@@ -28,7 +28,7 @@ class WorkerStartedRequest : public Request {
return "Worker " + std::to_string(id);
}
- int id_;
+ uint64_t id_;
WorkerInfo info_;
bool waiting_;
};
@@ -42,22 +42,25 @@ void Report(const std::unique_ptr<WorkerDelegate>& delegate,
class WorkerFinishedRequest : public Request {
public:
- explicit WorkerFinishedRequest(int worker_id) : worker_id_(worker_id) {}
+ explicit WorkerFinishedRequest(uint64_t worker_id) : worker_id_(worker_id) {}
void Call(MainThreadInterface* thread) override {
thread->inspector_agent()->GetWorkerManager()->WorkerFinished(worker_id_);
}
private:
- int worker_id_;
+ uint64_t worker_id_;
};
} // namespace
-
ParentInspectorHandle::ParentInspectorHandle(
- int id, const std::string& url,
- std::shared_ptr<MainThreadHandle> parent_thread, bool wait_for_connect)
- : id_(id), url_(url), parent_thread_(parent_thread),
+ uint64_t id,
+ const std::string& url,
+ std::shared_ptr<MainThreadHandle> parent_thread,
+ bool wait_for_connect)
+ : id_(id),
+ url_(url),
+ parent_thread_(parent_thread),
wait_(wait_for_connect) {}
ParentInspectorHandle::~ParentInspectorHandle() {
@@ -78,11 +81,11 @@ std::unique_ptr<inspector::InspectorSession> ParentInspectorHandle::Connect(
return parent_thread_->Connect(std::move(delegate), prevent_shutdown);
}
-void WorkerManager::WorkerFinished(int session_id) {
+void WorkerManager::WorkerFinished(uint64_t session_id) {
children_.erase(session_id);
}
-void WorkerManager::WorkerStarted(int session_id,
+void WorkerManager::WorkerStarted(uint64_t session_id,
const WorkerInfo& info,
bool waiting) {
if (info.worker_thread->Expired())
@@ -93,8 +96,8 @@ void WorkerManager::WorkerStarted(int session_id,
}
}
-std::unique_ptr<ParentInspectorHandle>
-WorkerManager::NewParentHandle(int thread_id, const std::string& url) {
+std::unique_ptr<ParentInspectorHandle> WorkerManager::NewParentHandle(
+ uint64_t thread_id, const std::string& url) {
bool wait = !delegates_waiting_on_start_.empty();
return std::make_unique<ParentInspectorHandle>(thread_id, url, thread_, wait);
}
diff --git a/src/inspector/worker_inspector.h b/src/inspector/worker_inspector.h
index b01063e01fc..540d98c742f 100644
--- a/src/inspector/worker_inspector.h
+++ b/src/inspector/worker_inspector.h
@@ -53,12 +53,13 @@ struct WorkerInfo {
class ParentInspectorHandle {
public:
- ParentInspectorHandle(int id, const std::string& url,
+ ParentInspectorHandle(uint64_t id,
+ const std::string& url,
std::shared_ptr<MainThreadHandle> parent_thread,
bool wait_for_connect);
~ParentInspectorHandle();
std::unique_ptr<ParentInspectorHandle> NewParentInspectorHandle(
- int thread_id, const std::string& url) {
+ uint64_t thread_id, const std::string& url) {
return std::make_unique<ParentInspectorHandle>(thread_id,
url,
parent_thread_,
@@ -75,7 +76,7 @@ class ParentInspectorHandle {
bool prevent_shutdown);
private:
- int id_;
+ uint64_t id_;
std::string url_;
std::shared_ptr<MainThreadHandle> parent_thread_;
bool wait_;
@@ -87,9 +88,9 @@ class WorkerManager : public std::enable_shared_from_this<WorkerManager> {
: thread_(thread) {}
std::unique_ptr<ParentInspectorHandle> NewParentHandle(
- int thread_id, const std::string& url);
- void WorkerStarted(int session_id, const WorkerInfo& info, bool waiting);
- void WorkerFinished(int session_id);
+ uint64_t thread_id, const std::string& url);
+ void WorkerStarted(uint64_t session_id, const WorkerInfo& info, bool waiting);
+ void WorkerFinished(uint64_t session_id);
std::unique_ptr<WorkerManagerEventHandle> SetAutoAttach(
std::unique_ptr<WorkerDelegate> attach_delegate);
void SetWaitOnStartForDelegate(int id, bool wait);
@@ -100,7 +101,7 @@ class WorkerManager : public std::enable_shared_from_this<WorkerManager> {
private:
std::shared_ptr<MainThreadHandle> thread_;
- std::unordered_map<int, WorkerInfo> children_;
+ std::unordered_map<uint64_t, WorkerInfo> children_;
std::unordered_map<int, std::unique_ptr<WorkerDelegate>> delegates_;
// If any one needs it, workers stop for all
std::unordered_set<int> delegates_waiting_on_start_;