Commit 5d670fa4 authored by Andreas Haas's avatar Andreas Haas Committed by Commit Bot

[Cleanup] Make Cancelable independent of the isolate

This CL removes the isolate_ property from the Cancelable class. The
isolate is actually not used in the class itself, only in sub-classes
which can store the isolate themselves.

R=jochen@chromium.org, mlippautz@chromium.org

Change-Id: If102fdea41b81fb3cb25782728f7fcbce9642815
Reviewed-on: https://chromium-review.googlesource.com/516704Reviewed-by: 's avatarJochen Eisinger <jochen@chromium.org>
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#45535}
parent d81be3b4
......@@ -112,17 +112,16 @@ CancelableTaskManager::TryAbortResult CancelableTaskManager::TryAbortAll() {
}
CancelableTask::CancelableTask(Isolate* isolate)
: CancelableTask(isolate, isolate->cancelable_task_manager()) {}
: CancelableTask(isolate->cancelable_task_manager()) {}
CancelableTask::CancelableTask(Isolate* isolate, CancelableTaskManager* manager)
: Cancelable(manager), isolate_(isolate) {}
CancelableTask::CancelableTask(CancelableTaskManager* manager)
: Cancelable(manager) {}
CancelableIdleTask::CancelableIdleTask(Isolate* isolate)
: CancelableIdleTask(isolate, isolate->cancelable_task_manager()) {}
: CancelableIdleTask(isolate->cancelable_task_manager()) {}
CancelableIdleTask::CancelableIdleTask(Isolate* isolate,
CancelableTaskManager* manager)
: Cancelable(manager), isolate_(isolate) {}
CancelableIdleTask::CancelableIdleTask(CancelableTaskManager* manager)
: Cancelable(manager) {}
} // namespace internal
} // namespace v8
......@@ -138,7 +138,7 @@ class V8_EXPORT_PRIVATE CancelableTask : public Cancelable,
NON_EXPORTED_BASE(public Task) {
public:
explicit CancelableTask(Isolate* isolate);
CancelableTask(Isolate* isolate, CancelableTaskManager* manager);
explicit CancelableTask(CancelableTaskManager* manager);
// Task overrides.
void Run() final {
......@@ -149,10 +149,7 @@ class V8_EXPORT_PRIVATE CancelableTask : public Cancelable,
virtual void RunInternal() = 0;
Isolate* isolate() { return isolate_; }
private:
Isolate* isolate_;
DISALLOW_COPY_AND_ASSIGN(CancelableTask);
};
......@@ -161,7 +158,7 @@ class V8_EXPORT_PRIVATE CancelableTask : public Cancelable,
class CancelableIdleTask : public Cancelable, public IdleTask {
public:
explicit CancelableIdleTask(Isolate* isolate);
CancelableIdleTask(Isolate* isolate, CancelableTaskManager* manager);
explicit CancelableIdleTask(CancelableTaskManager* manager);
// IdleTask overrides.
void Run(double deadline_in_seconds) final {
......@@ -172,10 +169,7 @@ class CancelableIdleTask : public Cancelable, public IdleTask {
virtual void RunInternal(double deadline_in_seconds) = 0;
Isolate* isolate() { return isolate_; }
private:
Isolate* isolate_;
DISALLOW_COPY_AND_ASSIGN(CancelableIdleTask);
};
......
......@@ -129,7 +129,7 @@ class MemoryPressureTask : public CancelableTask {
MemoryPressureTask::MemoryPressureTask(Isolate* isolate,
CancelableTaskManager* task_manager,
CompilerDispatcher* dispatcher)
: CancelableTask(isolate, task_manager), dispatcher_(dispatcher) {}
: CancelableTask(task_manager), dispatcher_(dispatcher) {}
MemoryPressureTask::~MemoryPressureTask() {}
......@@ -157,7 +157,7 @@ class CompilerDispatcher::AbortTask : public CancelableTask {
CompilerDispatcher::AbortTask::AbortTask(Isolate* isolate,
CancelableTaskManager* task_manager,
CompilerDispatcher* dispatcher)
: CancelableTask(isolate, task_manager), dispatcher_(dispatcher) {}
: CancelableTask(task_manager), dispatcher_(dispatcher) {}
CompilerDispatcher::AbortTask::~AbortTask() {}
......@@ -183,7 +183,7 @@ class CompilerDispatcher::BackgroundTask : public CancelableTask {
CompilerDispatcher::BackgroundTask::BackgroundTask(
Isolate* isolate, CancelableTaskManager* task_manager,
CompilerDispatcher* dispatcher)
: CancelableTask(isolate, task_manager), dispatcher_(dispatcher) {}
: CancelableTask(task_manager), dispatcher_(dispatcher) {}
CompilerDispatcher::BackgroundTask::~BackgroundTask() {}
......@@ -209,7 +209,7 @@ class CompilerDispatcher::IdleTask : public CancelableIdleTask {
CompilerDispatcher::IdleTask::IdleTask(Isolate* isolate,
CancelableTaskManager* task_manager,
CompilerDispatcher* dispatcher)
: CancelableIdleTask(isolate, task_manager), dispatcher_(dispatcher) {}
: CancelableIdleTask(task_manager), dispatcher_(dispatcher) {}
CompilerDispatcher::IdleTask::~IdleTask() {}
......
......@@ -503,7 +503,7 @@ class GlobalHandles::PendingPhantomCallbacksSecondPassTask
// the same state it would be after a call to Clear().
PendingPhantomCallbacksSecondPassTask(
List<PendingPhantomCallback>* pending_phantom_callbacks, Isolate* isolate)
: CancelableTask(isolate) {
: CancelableTask(isolate), isolate_(isolate) {
pending_phantom_callbacks_.Swap(pending_phantom_callbacks);
}
......@@ -516,7 +516,10 @@ class GlobalHandles::PendingPhantomCallbacksSecondPassTask
GCType::kGCTypeProcessWeakCallbacks, kNoGCCallbackFlags);
}
Isolate* isolate() { return isolate_; }
private:
Isolate* isolate_;
List<PendingPhantomCallback> pending_phantom_callbacks_;
DISALLOW_COPY_AND_ASSIGN(PendingPhantomCallbacksSecondPassTask);
......
......@@ -21,12 +21,15 @@ class IncrementalMarkingJob {
class Task : public CancelableTask {
public:
explicit Task(Isolate* isolate, IncrementalMarkingJob* job)
: CancelableTask(isolate), job_(job) {}
: CancelableTask(isolate), isolate_(isolate), job_(job) {}
static void Step(Heap* heap);
// CancelableTask overrides.
void RunInternal() override;
Isolate* isolate() { return isolate_; }
private:
Isolate* isolate_;
IncrementalMarkingJob* job_;
};
......
......@@ -22,11 +22,14 @@ class V8_EXPORT_PRIVATE ScavengeJob {
class IdleTask : public CancelableIdleTask {
public:
explicit IdleTask(Isolate* isolate, ScavengeJob* job)
: CancelableIdleTask(isolate), job_(job) {}
: CancelableIdleTask(isolate), isolate_(isolate), job_(job) {}
// CancelableIdleTask overrides.
void RunInternal(double deadline_in_seconds) override;
Isolate* isolate() { return isolate_; }
private:
Isolate* isolate_;
ScavengeJob* job_;
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment