| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -523,8 +523,19 @@ NODE_EXTERN std::unique_ptr<InspectorParentHandle> GetInspectorParentHandle( | |||
| 523 | 523 | ||
| 524 | 524 | NODE_EXTERN std::unique_ptr<InspectorParentHandle> GetInspectorParentHandle( | |
| 525 | 525 | Environment* env, ThreadId thread_id, const char* url, const char* name) { | |
| 526 | - CHECK_NOT_NULL(env); | ||
| 526 | + if (url == nullptr) url = ""; | ||
| 527 | 527 | if (name == nullptr) name = ""; | |
| 528 | + std::string_view url_view(url); | ||
| 529 | + std::string_view name_view(name); | ||
| 530 | + return GetInspectorParentHandle(env, thread_id, url_view, name_view); | ||
| 531 | + } | ||
| 532 | + | ||
| 533 | + NODE_EXTERN std::unique_ptr<InspectorParentHandle> GetInspectorParentHandle( | ||
| 534 | + Environment* env, | ||
| 535 | + ThreadId thread_id, | ||
| 536 | + std::string_view url, | ||
| 537 | + std::string_view name) { | ||
| 538 | + CHECK_NOT_NULL(env); | ||
| 528 | 539 | CHECK_NE(thread_id.id, static_cast<uint64_t>(-1)); | |
| 529 | 540 | if (!env->should_create_inspector()) { | |
| 530 | 541 | return nullptr; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -57,10 +57,10 @@ class WorkerFinishedRequest : public Request { | |||
| 57 | 57 | ||
| 58 | 58 | ParentInspectorHandle::ParentInspectorHandle( | |
| 59 | 59 | uint64_t id, | |
| 60 | - const std::string& url, | ||
| 60 | + std::string_view url, | ||
| 61 | 61 | std::shared_ptr<MainThreadHandle> parent_thread, | |
| 62 | 62 | bool wait_for_connect, | |
| 63 | - const std::string& name, | ||
| 63 | + std::string_view name, | ||
| 64 | 64 | std::shared_ptr<NetworkResourceManager> network_resource_manager) | |
| 65 | 65 | : id_(id), | |
| 66 | 66 | url_(url), | |
@@ -104,8 +104,8 @@ void WorkerManager::WorkerStarted(uint64_t session_id, | |||
| 104 | 104 | ||
| 105 | 105 | std::unique_ptr<ParentInspectorHandle> WorkerManager::NewParentHandle( | |
| 106 | 106 | uint64_t thread_id, | |
| 107 | - const std::string& url, | ||
| 108 | - const std::string& name, | ||
| 107 | + std::string_view url, | ||
| 108 | + std::string_view name, | ||
| 109 | 109 | std::shared_ptr<NetworkResourceManager> network_resource_manager) { | |
| 110 | 110 | bool wait = !delegates_waiting_on_start_.empty(); | |
| 111 | 111 | return std::make_unique<ParentInspectorHandle>( | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -57,14 +57,14 @@ class ParentInspectorHandle { | |||
| 57 | 57 | public: | |
| 58 | 58 | ParentInspectorHandle( | |
| 59 | 59 | uint64_t id, | |
| 60 | - const std::string& url, | ||
| 60 | + std::string_view url, | ||
| 61 | 61 | std::shared_ptr<MainThreadHandle> parent_thread, | |
| 62 | 62 | bool wait_for_connect, | |
| 63 | - const std::string& name, | ||
| 63 | + std::string_view name, | ||
| 64 | 64 | std::shared_ptr<NetworkResourceManager> network_resource_manager); | |
| 65 | 65 | ~ParentInspectorHandle(); | |
| 66 | 66 | std::unique_ptr<ParentInspectorHandle> NewParentInspectorHandle( | |
| 67 | - uint64_t thread_id, const std::string& url, const std::string& name) { | ||
| 67 | + uint64_t thread_id, std::string_view url, std::string_view name) { | ||
| 68 | 68 | return std::make_unique<ParentInspectorHandle>( | |
| 69 | 69 | thread_id, url, parent_thread_, wait_, name, network_resource_manager_); | |
| 70 | 70 | } | |
@@ -97,8 +97,8 @@ class WorkerManager : public std::enable_shared_from_this<WorkerManager> { | |||
| 97 | 97 | ||
| 98 | 98 | std::unique_ptr<ParentInspectorHandle> NewParentHandle( | |
| 99 | 99 | uint64_t thread_id, | |
| 100 | - const std::string& url, | ||
| 101 | - const std::string& name, | ||
| 100 | + std::string_view url, | ||
| 101 | + std::string_view name, | ||
| 102 | 102 | std::shared_ptr<NetworkResourceManager> network_resource_manager); | |
| 103 | 103 | void WorkerStarted(uint64_t session_id, const WorkerInfo& info, bool waiting); | |
| 104 | 104 | void WorkerFinished(uint64_t session_id); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1154,7 +1154,7 @@ void Agent::SetParentHandle( | |||
| 1154 | 1154 | } | |
| 1155 | 1155 | ||
| 1156 | 1156 | std::unique_ptr<ParentInspectorHandle> Agent::GetParentHandle( | |
| 1157 | - uint64_t thread_id, const std::string& url, const std::string& name) { | ||
| 1157 | + uint64_t thread_id, std::string_view url, std::string_view name) { | ||
| 1158 | 1158 | THROW_IF_INSUFFICIENT_PERMISSIONS(parent_env_, | |
| 1159 | 1159 | permission::PermissionScope::kInspector, | |
| 1160 | 1160 | "GetParentHandle", | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -94,8 +94,9 @@ class Agent { | |||
| 94 | 94 | void DisableAsyncHook(); | |
| 95 | 95 | ||
| 96 | 96 | void SetParentHandle(std::unique_ptr<ParentInspectorHandle> parent_handle); | |
| 97 | - std::unique_ptr<ParentInspectorHandle> GetParentHandle( | ||
| 98 | - uint64_t thread_id, const std::string& url, const std::string& name); | ||
| 97 | + std::unique_ptr<ParentInspectorHandle> GetParentHandle(uint64_t thread_id, | ||
| 98 | + std::string_view url, | ||
| 99 | + std::string_view name); | ||
| 99 | 100 | ||
| 100 | 101 | // Called to create inspector sessions that can be used from the same thread. | |
| 101 | 102 | // The inspector responds by using the delegate to send messages back. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -744,6 +744,12 @@ NODE_EXTERN std::unique_ptr<InspectorParentHandle> GetInspectorParentHandle( | |||
| 744 | 744 | const char* child_url, | |
| 745 | 745 | const char* name); | |
| 746 | 746 | ||
| 747 | + NODE_EXTERN std::unique_ptr<InspectorParentHandle> GetInspectorParentHandle( | ||
| 748 | + Environment* parent_env, | ||
| 749 | + ThreadId child_thread_id, | ||
| 750 | + std::string_view child_url, | ||
| 751 | + std::string_view name); | ||
| 752 | + | ||
| 747 | 753 | struct StartExecutionCallbackInfo { | |
| 748 | 754 | v8::Local<v8::Object> process_object; | |
| 749 | 755 | v8::Local<v8::Function> native_require; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -104,7 +104,7 @@ Worker::Worker(Environment* env, | |||
| 104 | 104 | if (env->permission()->is_granted( | |
| 105 | 105 | env, node::permission::PermissionScope::kInspector)) { | |
| 106 | 106 | inspector_parent_handle_ = | |
| 107 | - GetInspectorParentHandle(env, thread_id_, url.c_str(), name.c_str()); | ||
| 107 | + GetInspectorParentHandle(env, thread_id_, url, name); | ||
| 108 | 108 | } | |
| 109 | 109 | ||
| 110 | 110 | argv_ = std::vector<std::string>{env->argv()[0]}; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -17,7 +17,7 @@ if (!isMainThread) { | |||
| 17 | 17 | const assert = require('assert'); | |
| 18 | 18 | ||
| 19 | 19 | if (isMainThread) { | |
| 20 | - const name = 'Hello Thread'; | ||
| 20 | + const name = 'Hello\0Thread'; | ||
| 21 | 21 | const expectedTitle = `[worker 1] ${name}`; | |
| 22 | 22 | const worker = new Worker(fixtures.path('worker-name.js'), { | |
| 23 | 23 | name, | |
| Back | FazBrowse Home | New Git URL |
0 commit comments