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

Unified Diff: test/inspector/task-runner.h

Issue 2886903003: [inspector] Pass TaskRunner instead of Context to all tasks (Closed)
Patch Set: methods visibility Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/inspector/inspector-test.cc ('k') | test/inspector/task-runner.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/inspector/task-runner.h
diff --git a/test/inspector/task-runner.h b/test/inspector/task-runner.h
index c4adf7e4f159e5dd13700a00459bfe77bf525bae..88320cd622131fcfd787564b8b5022d3f76c8cc9 100644
--- a/test/inspector/task-runner.h
+++ b/test/inspector/task-runner.h
@@ -32,8 +32,21 @@ class TaskRunner : public v8::base::Thread {
public:
virtual ~Task() {}
virtual bool is_inspector_task() = 0;
- virtual void Run(v8::Isolate* isolate,
- const v8::Global<v8::Context>& context) = 0;
+ void RunOnTaskRunner(TaskRunner* task_runner) {
+ task_runner_ = task_runner;
+ Run();
+ task_runner_ = nullptr;
+ }
+
+ protected:
+ virtual void Run() = 0;
+ v8::Isolate* isolate() const { return task_runner_->isolate_; }
+ v8::Local<v8::Context> default_context() const {
+ return task_runner_->contexts_.begin()->second.Get(isolate());
+ }
+
+ private:
+ TaskRunner* task_runner_ = nullptr;
};
class SetupGlobalTask {
@@ -110,12 +123,10 @@ class AsyncTask : public TaskRunner::Task {
AsyncTask(const char* task_name, v8_inspector::V8Inspector* inspector);
virtual ~AsyncTask() = default;
- void Run(v8::Isolate* isolate,
- const v8::Global<v8::Context>& context) override;
- virtual void AsyncRun(v8::Isolate* isolate,
- const v8::Global<v8::Context>& context) = 0;
-
protected:
+ virtual void AsyncRun() = 0;
+ void Run() override;
+
v8_inspector::V8Inspector* inspector_;
};
@@ -131,10 +142,9 @@ class ExecuteStringTask : public AsyncTask {
const v8::internal::Vector<const char>& expression);
bool is_inspector_task() override { return false; }
- void AsyncRun(v8::Isolate* isolate,
- const v8::Global<v8::Context>& context) override;
-
private:
+ void AsyncRun() override;
+
v8::internal::Vector<uint16_t> expression_;
v8::internal::Vector<const char> expression_utf8_;
v8::internal::Vector<uint16_t> name_;
« no previous file with comments | « test/inspector/inspector-test.cc ('k') | test/inspector/task-runner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698