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

Unified Diff: test/cctest/test-thread-termination.cc

Issue 12729023: first step to remove unsafe handles (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: issue with debug build Created 7 years, 8 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/cctest/test-symbols.cc ('k') | test/cctest/test-threads.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-thread-termination.cc
diff --git a/test/cctest/test-thread-termination.cc b/test/cctest/test-thread-termination.cc
index b22c1505f522e6d094bed5769e5b70af1189cd7f..4008663c3e0c095d824461518bf05f29e24a6522 100644
--- a/test/cctest/test-thread-termination.cc
+++ b/test/cctest/test-thread-termination.cc
@@ -25,6 +25,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+// TODO(dcarney): remove
+#define V8_ALLOW_ACCESS_TO_PERSISTENT_IMPLICIT
+#define V8_ALLOW_ACCESS_TO_PERSISTENT_ARROW
+
#include "v8.h"
#include "platform.h"
#include "cctest.h"
@@ -124,7 +128,8 @@ TEST(TerminateOnlyV8ThreadFromThreadItself) {
v8::HandleScope scope(v8::Isolate::GetCurrent());
v8::Handle<v8::ObjectTemplate> global =
CreateGlobalTemplate(TerminateCurrentThread, DoLoop);
- v8::Persistent<v8::Context> context = v8::Context::New(NULL, global);
+ v8::Handle<v8::Context> context =
+ v8::Context::New(v8::Isolate::GetCurrent(), NULL, global);
v8::Context::Scope context_scope(context);
CHECK(!v8::V8::IsExecutionTerminating());
// Run a loop that will be infinite if thread termination does not work.
@@ -134,7 +139,6 @@ TEST(TerminateOnlyV8ThreadFromThreadItself) {
// Test that we can run the code again after thread termination.
CHECK(!v8::V8::IsExecutionTerminating());
v8::Script::Compile(source)->Run();
- context.Dispose(context->GetIsolate());
}
@@ -144,7 +148,8 @@ TEST(TerminateOnlyV8ThreadFromThreadItselfNoLoop) {
v8::HandleScope scope(v8::Isolate::GetCurrent());
v8::Handle<v8::ObjectTemplate> global =
CreateGlobalTemplate(TerminateCurrentThread, DoLoopNoCall);
- v8::Persistent<v8::Context> context = v8::Context::New(NULL, global);
+ v8::Handle<v8::Context> context =
+ v8::Context::New(v8::Isolate::GetCurrent(), NULL, global);
v8::Context::Scope context_scope(context);
CHECK(!v8::V8::IsExecutionTerminating());
// Run a loop that will be infinite if thread termination does not work.
@@ -154,7 +159,6 @@ TEST(TerminateOnlyV8ThreadFromThreadItselfNoLoop) {
CHECK(!v8::V8::IsExecutionTerminating());
// Test that we can run the code again after thread termination.
v8::Script::Compile(source)->Run();
- context.Dispose(context->GetIsolate());
}
@@ -183,7 +187,8 @@ TEST(TerminateOnlyV8ThreadFromOtherThread) {
v8::HandleScope scope(v8::Isolate::GetCurrent());
v8::Handle<v8::ObjectTemplate> global = CreateGlobalTemplate(Signal, DoLoop);
- v8::Persistent<v8::Context> context = v8::Context::New(NULL, global);
+ v8::Handle<v8::Context> context =
+ v8::Context::New(v8::Isolate::GetCurrent(), NULL, global);
v8::Context::Scope context_scope(context);
CHECK(!v8::V8::IsExecutionTerminating());
// Run a loop that will be infinite if thread termination does not work.
@@ -194,7 +199,6 @@ TEST(TerminateOnlyV8ThreadFromOtherThread) {
thread.Join();
delete semaphore;
semaphore = NULL;
- context.Dispose(context->GetIsolate());
}
@@ -207,14 +211,14 @@ class LoopingThread : public v8::internal::Thread {
v8_thread_id_ = v8::V8::GetCurrentThreadId();
v8::Handle<v8::ObjectTemplate> global =
CreateGlobalTemplate(Signal, DoLoop);
- v8::Persistent<v8::Context> context = v8::Context::New(NULL, global);
+ v8::Handle<v8::Context> context =
+ v8::Context::New(v8::Isolate::GetCurrent(), NULL, global);
v8::Context::Scope context_scope(context);
CHECK(!v8::V8::IsExecutionTerminating());
// Run a loop that will be infinite if thread termination does not work.
v8::Handle<v8::String> source =
v8::String::New("try { loop(); fail(); } catch(e) { fail(); }");
v8::Script::Compile(source)->Run();
- context.Dispose(context->GetIsolate());
}
int GetV8ThreadId() { return v8_thread_id_; }
@@ -314,7 +318,8 @@ TEST(TerminateLoadICException) {
global->Set(v8::String::New("loop"),
v8::FunctionTemplate::New(LoopGetProperty));
- v8::Persistent<v8::Context> context = v8::Context::New(NULL, global);
+ v8::Handle<v8::Context> context =
+ v8::Context::New(v8::Isolate::GetCurrent(), NULL, global);
v8::Context::Scope context_scope(context);
CHECK(!v8::V8::IsExecutionTerminating());
// Run a loop that will be infinite if thread termination does not work.
@@ -326,7 +331,6 @@ TEST(TerminateLoadICException) {
CHECK(!v8::V8::IsExecutionTerminating());
call_count = 0;
v8::Script::Compile(source)->Run();
- context.Dispose(context->GetIsolate());
}
v8::Handle<v8::Value> ReenterAfterTermination(const v8::Arguments& args) {
@@ -360,7 +364,8 @@ TEST(TerminateAndReenterFromThreadItself) {
v8::HandleScope scope(v8::Isolate::GetCurrent());
v8::Handle<v8::ObjectTemplate> global =
CreateGlobalTemplate(TerminateCurrentThread, ReenterAfterTermination);
- v8::Persistent<v8::Context> context = v8::Context::New(NULL, global);
+ v8::Handle<v8::Context> context =
+ v8::Context::New(v8::Isolate::GetCurrent(), NULL, global);
v8::Context::Scope context_scope(context);
CHECK(!v8::V8::IsExecutionTerminating());
v8::Handle<v8::String> source =
@@ -370,7 +375,6 @@ TEST(TerminateAndReenterFromThreadItself) {
// Check we can run JS again after termination.
CHECK(v8::Script::Compile(v8::String::New("function f() { return true; }"
"f()"))->Run()->IsTrue());
- context.Dispose(context->GetIsolate());
}
v8::Handle<v8::Value> DoLoopCancelTerminate(const v8::Arguments& args) {
@@ -399,13 +403,13 @@ TEST(TerminateCancelTerminateFromThreadItself) {
v8::HandleScope scope;
v8::Handle<v8::ObjectTemplate> global =
CreateGlobalTemplate(TerminateCurrentThread, DoLoopCancelTerminate);
- v8::Persistent<v8::Context> context = v8::Context::New(NULL, global);
+ v8::Handle<v8::Context> context =
+ v8::Context::New(v8::Isolate::GetCurrent(), NULL, global);
v8::Context::Scope context_scope(context);
CHECK(!v8::V8::IsExecutionTerminating());
v8::Handle<v8::String> source =
v8::String::New("try { doloop(); } catch(e) { fail(); } 'completed';");
// Check that execution completed with correct return value.
CHECK(v8::Script::Compile(source)->Run()->Equals(v8_str("completed")));
- context.Dispose(context->GetIsolate());
}
« no previous file with comments | « test/cctest/test-symbols.cc ('k') | test/cctest/test-threads.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698