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

Side by Side Diff: test/inspector-protocol/task-runner.cc

Issue 2358943002: [inspector] added inspector protocol test runner (Closed)
Patch Set: a Created 4 years, 3 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "test/inspector-protocol/task-runner.h"
6
7 #include "test/inspector-protocol/task-queue.h"
8 #include "test/inspector-protocol/task.h"
9
10 namespace v8_inspector {
11
12 TaskRunner::TaskRunner(TaskQueue* queue)
13 : Thread(Options("Task Runner")),
14 queue_(queue),
15 state_(TaskRunner::kRunning),
16 isolate_(NULL) {
17 Start();
18 }
19
20 TaskRunner::~TaskRunner() { Join(); }
21
22 void TaskRunner::SetContext(v8::Local<v8::Context> context) {
23 isolate_ = context->GetIsolate();
24 context_.Reset(isolate_, context);
25 }
26
27 void TaskRunner::Run() {
28 while (true) {
29 Task* task = queue_->GetNext(false);
30 if (!task) return;
31 if (isolate_)
32 task->Run(isolate_, context_);
33 else
34 task->Run();
35 delete task;
36 if (state_.Value() == kStopRequested) return;
37 }
38 }
39
40 void TaskRunner::Stop() { state_.SetValue(kStopRequested); }
41
42 } // v8_inspector
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698