Revision f230a1cf deps/v8/src/v8threads.cc
deps/v8/src/v8threads.cc | ||
---|---|---|
42 | 42 |
bool Locker::active_ = false; |
43 | 43 |
|
44 | 44 |
|
45 |
Locker::Locker() { |
|
46 |
Initialize(i::Isolate::GetDefaultIsolateForLocking()); |
|
47 |
} |
|
48 |
|
|
49 |
|
|
50 | 45 |
// Once the Locker is initialized, the current thread will be guaranteed to have |
51 | 46 |
// the lock for a given isolate. |
52 | 47 |
void Locker::Initialize(v8::Isolate* isolate) { |
... | ... | |
116 | 111 |
} |
117 | 112 |
|
118 | 113 |
|
119 |
Unlocker::Unlocker() { |
|
120 |
Initialize(i::Isolate::GetDefaultIsolateForLocking()); |
|
121 |
} |
|
122 |
|
|
123 |
|
|
124 | 114 |
void Unlocker::Initialize(v8::Isolate* isolate) { |
125 | 115 |
ASSERT(isolate != NULL); |
126 | 116 |
isolate_ = reinterpret_cast<i::Isolate*>(isolate); |
... | ... | |
143 | 133 |
} |
144 | 134 |
|
145 | 135 |
|
146 |
void Locker::StartPreemption(int every_n_ms) { |
|
136 |
void Locker::StartPreemption(v8::Isolate* isolate, int every_n_ms) {
|
|
147 | 137 |
v8::internal::ContextSwitcher::StartPreemption( |
148 |
i::Isolate::Current(), every_n_ms);
|
|
138 |
reinterpret_cast<i::Isolate*>(isolate), every_n_ms);
|
|
149 | 139 |
} |
150 | 140 |
|
151 | 141 |
|
152 |
void Locker::StopPreemption() { |
|
153 |
v8::internal::ContextSwitcher::StopPreemption(i::Isolate::Current()); |
|
142 |
void Locker::StopPreemption(v8::Isolate* isolate) { |
|
143 |
v8::internal::ContextSwitcher::StopPreemption( |
|
144 |
reinterpret_cast<i::Isolate*>(isolate)); |
|
154 | 145 |
} |
155 | 146 |
|
156 | 147 |
|
... | ... | |
481 | 472 |
|
482 | 473 |
// Acknowledge the preemption by the receiving thread. |
483 | 474 |
void ContextSwitcher::PreemptionReceived() { |
484 |
ASSERT(Locker::IsLocked(i::Isolate::GetDefaultIsolateForLocking())); |
|
485 | 475 |
// There is currently no accounting being done for this. But could be in the |
486 | 476 |
// future, which is why we leave this in. |
487 | 477 |
} |
Also available in: Unified diff