OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "test/inspector/task-runner.h" | 5 #include "test/inspector/task-runner.h" |
6 | 6 |
7 #include "test/inspector/inspector-impl.h" | 7 #include "test/inspector/inspector-impl.h" |
8 | 8 |
9 #if !defined(_WIN32) && !defined(_WIN64) | 9 #if !defined(_WIN32) && !defined(_WIN64) |
10 #include <unistd.h> // NOLINT | 10 #include <unistd.h> // NOLINT |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 kContextGroupIdIndex, reinterpret_cast<void*>(context_group_id * 2)); | 71 kContextGroupIdIndex, reinterpret_cast<void*>(context_group_id * 2)); |
72 contexts_[context_group_id].Reset(isolate_, context); | 72 contexts_[context_group_id].Reset(isolate_, context); |
73 return context; | 73 return context; |
74 } | 74 } |
75 | 75 |
76 v8::Local<v8::Context> TaskRunner::GetContext(int context_group_id) { | 76 v8::Local<v8::Context> TaskRunner::GetContext(int context_group_id) { |
77 return contexts_[context_group_id].Get(isolate_); | 77 return contexts_[context_group_id].Get(isolate_); |
78 } | 78 } |
79 | 79 |
80 int TaskRunner::GetContextGroupId(v8::Local<v8::Context> context) { | 80 int TaskRunner::GetContextGroupId(v8::Local<v8::Context> context) { |
81 return reinterpret_cast<intptr_t>( | 81 return static_cast<int>( |
82 context->GetAlignedPointerFromEmbedderData(kContextGroupIdIndex)) / | 82 reinterpret_cast<intptr_t>( |
83 2; | 83 context->GetAlignedPointerFromEmbedderData(kContextGroupIdIndex)) / |
| 84 2); |
84 } | 85 } |
85 | 86 |
86 void TaskRunner::Run() { | 87 void TaskRunner::Run() { |
87 InitializeIsolate(); | 88 InitializeIsolate(); |
88 RunMessageLoop(false); | 89 RunMessageLoop(false); |
89 } | 90 } |
90 | 91 |
91 void TaskRunner::RunMessageLoop(bool only_protocol) { | 92 void TaskRunner::RunMessageLoop(bool only_protocol) { |
92 int loop_number = ++nested_loop_count_; | 93 int loop_number = ++nested_loop_count_; |
93 while (nested_loop_count_ == loop_number && !is_terminated_.Value()) { | 94 while (nested_loop_count_ == loop_number && !is_terminated_.Value()) { |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 return; | 250 return; |
250 } | 251 } |
251 if (!module->Instantiate(local_context, &TaskRunner::ModuleResolveCallback)) | 252 if (!module->Instantiate(local_context, &TaskRunner::ModuleResolveCallback)) |
252 return; | 253 return; |
253 v8::Local<v8::Value> result; | 254 v8::Local<v8::Value> result; |
254 if (!module->Evaluate(local_context).ToLocal(&result)) return; | 255 if (!module->Evaluate(local_context).ToLocal(&result)) return; |
255 TaskRunner* runner = TaskRunner::FromContext(local_context); | 256 TaskRunner* runner = TaskRunner::FromContext(local_context); |
256 runner->RegisterModule(name_, module); | 257 runner->RegisterModule(name_, module); |
257 } | 258 } |
258 } | 259 } |
OLD | NEW |