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() { ...@@ -112,17 +112,16 @@ CancelableTaskManager::TryAbortResult CancelableTaskManager::TryAbortAll() {
} }
CancelableTask::CancelableTask(Isolate* isolate) CancelableTask::CancelableTask(Isolate* isolate)
: CancelableTask(isolate, isolate->cancelable_task_manager()) {} : CancelableTask(isolate->cancelable_task_manager()) {}
CancelableTask::CancelableTask(Isolate* isolate, CancelableTaskManager* manager) CancelableTask::CancelableTask(CancelableTaskManager* manager)
: Cancelable(manager), isolate_(isolate) {} : Cancelable(manager) {}
CancelableIdleTask::CancelableIdleTask(Isolate* isolate) CancelableIdleTask::CancelableIdleTask(Isolate* isolate)
: CancelableIdleTask(isolate, isolate->cancelable_task_manager()) {} : CancelableIdleTask(isolate->cancelable_task_manager()) {}
CancelableIdleTask::CancelableIdleTask(Isolate* isolate, CancelableIdleTask::CancelableIdleTask(CancelableTaskManager* manager)
CancelableTaskManager* manager) : Cancelable(manager) {}
: Cancelable(manager), isolate_(isolate) {}
} // namespace internal } // namespace internal
} // namespace v8 } // namespace v8
...@@ -138,7 +138,7 @@ class V8_EXPORT_PRIVATE CancelableTask : public Cancelable, ...@@ -138,7 +138,7 @@ class V8_EXPORT_PRIVATE CancelableTask : public Cancelable,
NON_EXPORTED_BASE(public Task) { NON_EXPORTED_BASE(public Task) {
public: public:
explicit CancelableTask(Isolate* isolate); explicit CancelableTask(Isolate* isolate);
CancelableTask(Isolate* isolate, CancelableTaskManager* manager); explicit CancelableTask(CancelableTaskManager* manager);
// Task overrides. // Task overrides.
void Run() final { void Run() final {
...@@ -149,10 +149,7 @@ class V8_EXPORT_PRIVATE CancelableTask : public Cancelable, ...@@ -149,10 +149,7 @@ class V8_EXPORT_PRIVATE CancelableTask : public Cancelable,
virtual void RunInternal() = 0; virtual void RunInternal() = 0;
Isolate* isolate() { return isolate_; }
private: private:
Isolate* isolate_;
DISALLOW_COPY_AND_ASSIGN(CancelableTask); DISALLOW_COPY_AND_ASSIGN(CancelableTask);
}; };
...@@ -161,7 +158,7 @@ class V8_EXPORT_PRIVATE CancelableTask : public Cancelable, ...@@ -161,7 +158,7 @@ class V8_EXPORT_PRIVATE CancelableTask : public Cancelable,
class CancelableIdleTask : public Cancelable, public IdleTask { class CancelableIdleTask : public Cancelable, public IdleTask {
public: public:
explicit CancelableIdleTask(Isolate* isolate); explicit CancelableIdleTask(Isolate* isolate);
CancelableIdleTask(Isolate* isolate, CancelableTaskManager* manager); explicit CancelableIdleTask(CancelableTaskManager* manager);
// IdleTask overrides. // IdleTask overrides.
void Run(double deadline_in_seconds) final { void Run(double deadline_in_seconds) final {
...@@ -172,10 +169,7 @@ class CancelableIdleTask : public Cancelable, public IdleTask { ...@@ -172,10 +169,7 @@ class CancelableIdleTask : public Cancelable, public IdleTask {
virtual void RunInternal(double deadline_in_seconds) = 0; virtual void RunInternal(double deadline_in_seconds) = 0;
Isolate* isolate() { return isolate_; }
private: private:
Isolate* isolate_;
DISALLOW_COPY_AND_ASSIGN(CancelableIdleTask); DISALLOW_COPY_AND_ASSIGN(CancelableIdleTask);
}; };
......
...@@ -129,7 +129,7 @@ class MemoryPressureTask : public CancelableTask { ...@@ -129,7 +129,7 @@ class MemoryPressureTask : public CancelableTask {
MemoryPressureTask::MemoryPressureTask(Isolate* isolate, MemoryPressureTask::MemoryPressureTask(Isolate* isolate,
CancelableTaskManager* task_manager, CancelableTaskManager* task_manager,
CompilerDispatcher* dispatcher) CompilerDispatcher* dispatcher)
: CancelableTask(isolate, task_manager), dispatcher_(dispatcher) {} : CancelableTask(task_manager), dispatcher_(dispatcher) {}
MemoryPressureTask::~MemoryPressureTask() {} MemoryPressureTask::~MemoryPressureTask() {}
...@@ -157,7 +157,7 @@ class CompilerDispatcher::AbortTask : public CancelableTask { ...@@ -157,7 +157,7 @@ class CompilerDispatcher::AbortTask : public CancelableTask {
CompilerDispatcher::AbortTask::AbortTask(Isolate* isolate, CompilerDispatcher::AbortTask::AbortTask(Isolate* isolate,
CancelableTaskManager* task_manager, CancelableTaskManager* task_manager,
CompilerDispatcher* dispatcher) CompilerDispatcher* dispatcher)
: CancelableTask(isolate, task_manager), dispatcher_(dispatcher) {} : CancelableTask(task_manager), dispatcher_(dispatcher) {}
CompilerDispatcher::AbortTask::~AbortTask() {} CompilerDispatcher::AbortTask::~AbortTask() {}
...@@ -183,7 +183,7 @@ class CompilerDispatcher::BackgroundTask : public CancelableTask { ...@@ -183,7 +183,7 @@ class CompilerDispatcher::BackgroundTask : public CancelableTask {
CompilerDispatcher::BackgroundTask::BackgroundTask( CompilerDispatcher::BackgroundTask::BackgroundTask(
Isolate* isolate, CancelableTaskManager* task_manager, Isolate* isolate, CancelableTaskManager* task_manager,
CompilerDispatcher* dispatcher) CompilerDispatcher* dispatcher)
: CancelableTask(isolate, task_manager), dispatcher_(dispatcher) {} : CancelableTask(task_manager), dispatcher_(dispatcher) {}
CompilerDispatcher::BackgroundTask::~BackgroundTask() {} CompilerDispatcher::BackgroundTask::~BackgroundTask() {}
...@@ -209,7 +209,7 @@ class CompilerDispatcher::IdleTask : public CancelableIdleTask { ...@@ -209,7 +209,7 @@ class CompilerDispatcher::IdleTask : public CancelableIdleTask {
CompilerDispatcher::IdleTask::IdleTask(Isolate* isolate, CompilerDispatcher::IdleTask::IdleTask(Isolate* isolate,
CancelableTaskManager* task_manager, CancelableTaskManager* task_manager,
CompilerDispatcher* dispatcher) CompilerDispatcher* dispatcher)
: CancelableIdleTask(isolate, task_manager), dispatcher_(dispatcher) {} : CancelableIdleTask(task_manager), dispatcher_(dispatcher) {}
CompilerDispatcher::IdleTask::~IdleTask() {} CompilerDispatcher::IdleTask::~IdleTask() {}
......
...@@ -503,7 +503,7 @@ class GlobalHandles::PendingPhantomCallbacksSecondPassTask ...@@ -503,7 +503,7 @@ class GlobalHandles::PendingPhantomCallbacksSecondPassTask
// the same state it would be after a call to Clear(). // the same state it would be after a call to Clear().
PendingPhantomCallbacksSecondPassTask( PendingPhantomCallbacksSecondPassTask(
List<PendingPhantomCallback>* pending_phantom_callbacks, Isolate* isolate) List<PendingPhantomCallback>* pending_phantom_callbacks, Isolate* isolate)
: CancelableTask(isolate) { : CancelableTask(isolate), isolate_(isolate) {
pending_phantom_callbacks_.Swap(pending_phantom_callbacks); pending_phantom_callbacks_.Swap(pending_phantom_callbacks);
} }
...@@ -516,7 +516,10 @@ class GlobalHandles::PendingPhantomCallbacksSecondPassTask ...@@ -516,7 +516,10 @@ class GlobalHandles::PendingPhantomCallbacksSecondPassTask
GCType::kGCTypeProcessWeakCallbacks, kNoGCCallbackFlags); GCType::kGCTypeProcessWeakCallbacks, kNoGCCallbackFlags);
} }
Isolate* isolate() { return isolate_; }
private: private:
Isolate* isolate_;
List<PendingPhantomCallback> pending_phantom_callbacks_; List<PendingPhantomCallback> pending_phantom_callbacks_;
DISALLOW_COPY_AND_ASSIGN(PendingPhantomCallbacksSecondPassTask); DISALLOW_COPY_AND_ASSIGN(PendingPhantomCallbacksSecondPassTask);
......
...@@ -21,12 +21,15 @@ class IncrementalMarkingJob { ...@@ -21,12 +21,15 @@ class IncrementalMarkingJob {
class Task : public CancelableTask { class Task : public CancelableTask {
public: public:
explicit Task(Isolate* isolate, IncrementalMarkingJob* job) explicit Task(Isolate* isolate, IncrementalMarkingJob* job)
: CancelableTask(isolate), job_(job) {} : CancelableTask(isolate), isolate_(isolate), job_(job) {}
static void Step(Heap* heap); static void Step(Heap* heap);
// CancelableTask overrides. // CancelableTask overrides.
void RunInternal() override; void RunInternal() override;
Isolate* isolate() { return isolate_; }
private: private:
Isolate* isolate_;
IncrementalMarkingJob* job_; IncrementalMarkingJob* job_;
}; };
......
...@@ -22,11 +22,14 @@ class V8_EXPORT_PRIVATE ScavengeJob { ...@@ -22,11 +22,14 @@ class V8_EXPORT_PRIVATE ScavengeJob {
class IdleTask : public CancelableIdleTask { class IdleTask : public CancelableIdleTask {
public: public:
explicit IdleTask(Isolate* isolate, ScavengeJob* job) explicit IdleTask(Isolate* isolate, ScavengeJob* job)
: CancelableIdleTask(isolate), job_(job) {} : CancelableIdleTask(isolate), isolate_(isolate), job_(job) {}
// CancelableIdleTask overrides. // CancelableIdleTask overrides.
void RunInternal(double deadline_in_seconds) override; void RunInternal(double deadline_in_seconds) override;
Isolate* isolate() { return isolate_; }
private: private:
Isolate* isolate_;
ScavengeJob* job_; 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