| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -598,11 +598,11 @@ inline bool Environment::is_main_thread() const { | |||
| 598 | 598 | return thread_id_ == 0; | |
| 599 | 599 | } | |
| 600 | 600 | ||
| 601 | - inline uint64_t Environment::thread_id() const { | ||
| 601 | + inline double Environment::thread_id() const { | ||
| 602 | 602 | return thread_id_; | |
| 603 | 603 | } | |
| 604 | 604 | ||
| 605 | - inline void Environment::set_thread_id(uint64_t id) { | ||
| 605 | + inline void Environment::set_thread_id(double id) { | ||
| 606 | 606 | thread_id_ = id; | |
| 607 | 607 | } | |
| 608 | 608 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -726,8 +726,8 @@ class Environment { | |||
| 726 | 726 | bool is_stopping_worker() const; | |
| 727 | 727 | ||
| 728 | 728 | inline bool is_main_thread() const; | |
| 729 | - inline uint64_t thread_id() const; | ||
| 730 | - inline void set_thread_id(uint64_t id); | ||
| 729 | + inline double thread_id() const; | ||
| 730 | + inline void set_thread_id(double id); | ||
| 731 | 731 | inline worker::Worker* worker_context() const; | |
| 732 | 732 | inline void set_worker_context(worker::Worker* context); | |
| 733 | 733 | inline void add_sub_worker_context(worker::Worker* context); | |
@@ -881,7 +881,7 @@ class Environment { | |||
| 881 | 881 | std::unordered_map<std::string, uint64_t> performance_marks_; | |
| 882 | 882 | ||
| 883 | 883 | bool can_call_into_js_ = true; | |
| 884 | - uint64_t thread_id_ = 0; | ||
| 884 | + double thread_id_ = 0; | ||
| 885 | 885 | std::unordered_set<worker::Worker*> sub_worker_contexts_; | |
| 886 | 886 | ||
| 887 | 887 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -9,8 +9,6 @@ | |||
| 9 | 9 | #include "async_wrap.h" | |
| 10 | 10 | #include "async_wrap-inl.h" | |
| 11 | 11 | ||
| 12 | - #include <string> | ||
| 13 | - | ||
| 14 | 12 | using v8::ArrayBuffer; | |
| 15 | 13 | using v8::Context; | |
| 16 | 14 | using v8::Function; | |
@@ -32,7 +30,7 @@ namespace worker { | |||
| 32 | 30 | ||
| 33 | 31 | namespace { | |
| 34 | 32 | ||
| 35 | - uint64_t next_thread_id = 1; | ||
| 33 | + double next_thread_id = 1; | ||
| 36 | 34 | Mutex next_thread_id_mutex; | |
| 37 | 35 | ||
| 38 | 36 | } // anonymous namespace | |
@@ -46,8 +44,7 @@ Worker::Worker(Environment* env, Local<Object> wrap) | |||
| 46 | 44 | } | |
| 47 | 45 | wrap->Set(env->context(), | |
| 48 | 46 | env->thread_id_string(), | |
| 49 | - Number::New(env->isolate(), | ||
| 50 | - static_cast<double>(thread_id_))).FromJust(); | ||
| 47 | + Number::New(env->isolate(), thread_id_)).FromJust(); | ||
| 51 | 48 | ||
| 52 | 49 | // Set up everything that needs to be set up in the parent environment. | |
| 53 | 50 | parent_port_ = MessagePort::New(env, env->context()); | |
@@ -115,11 +112,6 @@ bool Worker::is_stopped() const { | |||
| 115 | 112 | } | |
| 116 | 113 | ||
| 117 | 114 | void Worker::Run() { | |
| 118 | - std::string name = "WorkerThread "; | ||
| 119 | - name += std::to_string(thread_id_); | ||
| 120 | - TRACE_EVENT_METADATA1( | ||
| 121 | - "__metadata", "thread_name", "name", | ||
| 122 | - TRACE_STR_COPY(name.c_str())); | ||
| 123 | 115 | MultiIsolatePlatform* platform = isolate_data_->platform(); | |
| 124 | 116 | CHECK_NE(platform, nullptr); | |
| 125 | 117 | ||
@@ -426,8 +418,7 @@ void InitWorker(Local<Object> target, | |||
| 426 | 418 | auto thread_id_string = FIXED_ONE_BYTE_STRING(env->isolate(), "threadId"); | |
| 427 | 419 | target->Set(env->context(), | |
| 428 | 420 | thread_id_string, | |
| 429 | - Number::New(env->isolate(), | ||
| 430 | - static_cast<double>(env->thread_id()))).FromJust(); | ||
| 421 | + Number::New(env->isolate(), env->thread_id())).FromJust(); | ||
| 431 | 422 | } | |
| 432 | 423 | ||
| 433 | 424 | } // anonymous namespace | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -62,7 +62,7 @@ class Worker : public AsyncWrap { | |||
| 62 | 62 | ||
| 63 | 63 | bool thread_joined_ = true; | |
| 64 | 64 | int exit_code_ = 0; | |
| 65 | - uint64_t thread_id_ = -1; | ||
| 65 | + double thread_id_ = -1; | ||
| 66 | 66 | ||
| 67 | 67 | std::unique_ptr<MessagePortData> child_port_data_; | |
| 68 | 68 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments