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

Unified Diff: src/d8.cc

Issue 7754007: Fix memory leak from d8 shell. (Closed) Base URL: git://github.com/v8/v8.git@trunk
Patch Set: fix thread_ as well Created 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/d8.h ('k') | src/smart-pointer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/d8.cc
diff --git a/src/d8.cc b/src/d8.cc
index 5c604368920a35c5aa81feb6818219b59c697a43..342f77ccc9b261a0b397674b9ff9fd31705e1511 100644
--- a/src/d8.cc
+++ b/src/d8.cc
@@ -1021,7 +1021,7 @@ i::Thread::Options SourceGroup::GetThreadOptions() {
void SourceGroup::ExecuteInThread() {
Isolate* isolate = Isolate::New();
do {
- if (next_semaphore_ != NULL) next_semaphore_->Wait();
+ if (!next_semaphore_.is_empty()) next_semaphore_->Wait();
{
Isolate::Scope iscope(isolate);
Locker lock(isolate);
@@ -1033,15 +1033,15 @@ void SourceGroup::ExecuteInThread() {
}
context.Dispose();
}
- if (done_semaphore_ != NULL) done_semaphore_->Signal();
+ if (!done_semaphore_.is_empty()) done_semaphore_->Signal();
} while (!Shell::options.last_run);
isolate->Dispose();
}
void SourceGroup::StartExecuteInThread() {
- if (thread_ == NULL) {
- thread_ = new IsolateThread(this);
+ if (thread_.is_empty()) {
+ thread_ = i::SmartPointer<i::Thread>(new IsolateThread(this));
thread_->Start();
}
next_semaphore_->Signal();
@@ -1049,10 +1049,9 @@ void SourceGroup::StartExecuteInThread() {
void SourceGroup::WaitForThread() {
- if (thread_ == NULL) return;
+ if (thread_.is_empty()) return;
if (Shell::options.last_run) {
thread_->Join();
- thread_ = NULL;
} else {
done_semaphore_->Wait();
}
« no previous file with comments | « src/d8.h ('k') | src/smart-pointer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698