Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(200)

Side by Side Diff: test/inspector/inspector-test.cc

Issue 2428213002: [inspector] finish test runner gracefully.. (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #if !defined(_WIN32) && !defined(_WIN64) 5 #if !defined(_WIN32) && !defined(_WIN64)
6 #include <unistd.h> // NOLINT 6 #include <unistd.h> // NOLINT
7 #endif // !defined(_WIN32) && !defined(_WIN64) 7 #endif // !defined(_WIN32) && !defined(_WIN64)
8 8
9 #include <locale.h> 9 #include <locale.h>
10 10
11 #include "include/libplatform/libplatform.h" 11 #include "include/libplatform/libplatform.h"
12 #include "include/v8.h" 12 #include "include/v8.h"
13 13
14 #include "src/base/platform/platform.h" 14 #include "src/base/platform/platform.h"
15 #include "src/flags.h" 15 #include "src/flags.h"
16 #include "src/utils.h" 16 #include "src/utils.h"
17 #include "src/vector.h" 17 #include "src/vector.h"
18 18
19 #include "test/inspector/inspector-impl.h" 19 #include "test/inspector/inspector-impl.h"
20 #include "test/inspector/task-runner.h" 20 #include "test/inspector/task-runner.h"
21 21
22 namespace { 22 namespace {
23 23
24 std::vector<TaskRunner*> task_runners;
25
26 void Terminate() {
27 for (size_t i = 0; i < task_runners.size(); ++i) {
28 task_runners[i]->Terminate();
29 task_runners[i]->Join();
30 }
31 std::vector<TaskRunner*> empty;
32 task_runners.swap(empty);
33 }
34
24 void Exit() { 35 void Exit() {
25 fflush(stdout); 36 fflush(stdout);
26 fflush(stderr); 37 fflush(stderr);
27 _exit(0); 38 Terminate();
28 } 39 }
29 40
30 class UtilsExtension : public v8::Extension { 41 class UtilsExtension : public v8::Extension {
31 public: 42 public:
32 UtilsExtension() 43 UtilsExtension()
33 : v8::Extension("v8_inspector/utils", 44 : v8::Extension("v8_inspector/utils",
34 "native function print();" 45 "native function print();"
35 "native function quit();" 46 "native function quit();"
36 "native function setlocale();" 47 "native function setlocale();"
37 "native function load();") {} 48 "native function load();") {}
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 v8::ExtensionConfiguration frontend_configuration( 286 v8::ExtensionConfiguration frontend_configuration(
276 arraysize(frontend_extensions), frontend_extensions); 287 arraysize(frontend_extensions), frontend_extensions);
277 TaskRunner frontend_runner(&frontend_configuration, true, &ready_semaphore); 288 TaskRunner frontend_runner(&frontend_configuration, true, &ready_semaphore);
278 ready_semaphore.Wait(); 289 ready_semaphore.Wait();
279 290
280 FrontendChannelImpl frontend_channel(&frontend_runner); 291 FrontendChannelImpl frontend_channel(&frontend_runner);
281 InspectorClientImpl inspector_client(&backend_runner, &frontend_channel, 292 InspectorClientImpl inspector_client(&backend_runner, &frontend_channel,
282 &ready_semaphore); 293 &ready_semaphore);
283 ready_semaphore.Wait(); 294 ready_semaphore.Wait();
284 295
296 task_runners.push_back(&frontend_runner);
297 task_runners.push_back(&backend_runner);
298
285 for (int i = 1; i < argc; ++i) { 299 for (int i = 1; i < argc; ++i) {
286 if (argv[i][0] == '-') break; 300 if (argv[i][0] == '-') break;
287 301
288 bool exists = false; 302 bool exists = false;
289 v8::internal::Vector<const char> chars = 303 v8::internal::Vector<const char> chars =
290 v8::internal::ReadFile(argv[i], &exists, true); 304 v8::internal::ReadFile(argv[i], &exists, true);
291 if (!exists) { 305 if (!exists) {
292 fprintf(stderr, "Internal error: script file doesn't exists: %s\n", 306 fprintf(stderr, "Internal error: script file doesn't exists: %s\n",
293 argv[i]); 307 argv[i]);
294 Exit(); 308 Exit();
295 } 309 }
296 frontend_runner.Append(new ExecuteStringTask(chars)); 310 frontend_runner.Append(new ExecuteStringTask(chars));
297 } 311 }
298 312
299 frontend_runner.Join(); 313 frontend_runner.Join();
314 backend_runner.Join();
300 return 0; 315 return 0;
301 } 316 }
OLDNEW
« no previous file with comments | « test/inspector/debugger/stepping-with-blackboxed-ranges.js ('k') | test/inspector/task-runner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698