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

Unified Diff: test/cctest/test-debug.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-cpu-profiler.cc ('k') | test/cctest/test-declarative-accessors.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-debug.cc
diff --git a/test/cctest/test-debug.cc b/test/cctest/test-debug.cc
index 3cc35e75f0f91f887ecdfe11d495f01159ad76a6..080d42efd123684cdbdb294c7b6b2473abb181e5 100644
--- a/test/cctest/test-debug.cc
+++ b/test/cctest/test-debug.cc
@@ -29,6 +29,10 @@
#include <stdlib.h>
+// TODO(dcarney): remove
+#define V8_ALLOW_ACCESS_TO_PERSISTENT_ARROW
+#define V8_ALLOW_ACCESS_TO_PERSISTENT_IMPLICIT
+
#include "v8.h"
#include "api.h"
@@ -5153,7 +5157,9 @@ void V8Thread::Run() {
v8::Handle<v8::ObjectTemplate> global_template = v8::ObjectTemplate::New();
global_template->Set(v8::String::New("ThreadedAtBarrier1"),
v8::FunctionTemplate::New(ThreadedAtBarrier1));
- v8::Handle<v8::Context> context = v8::Context::New(NULL, global_template);
+ v8::Handle<v8::Context> context = v8::Context::New(v8::Isolate::GetCurrent(),
+ NULL,
+ global_template);
v8::Context::Scope context_scope(context);
CompileRun(source);
@@ -5529,7 +5535,9 @@ TEST(CallFunctionInDebugger) {
v8::FunctionTemplate::New(CheckDataParameter));
global_template->Set(v8::String::New("CheckClosure"),
v8::FunctionTemplate::New(CheckClosure));
- v8::Handle<v8::Context> context = v8::Context::New(NULL, global_template);
+ v8::Handle<v8::Context> context = v8::Context::New(v8::Isolate::GetCurrent(),
+ NULL,
+ global_template);
v8::Context::Scope context_scope(context);
// Compile a function for checking the number of JavaScript frames.
@@ -6253,18 +6261,19 @@ static void ContextCheckMessageHandler(const v8::Debug::Message& message) {
// Checks that this data is set correctly and that when the debug message
// handler is called the expected context is the one active.
TEST(ContextData) {
- v8::HandleScope scope(v8::Isolate::GetCurrent());
+ v8::Isolate* isolate = v8::Isolate::GetCurrent();
+ v8::HandleScope scope(isolate);
v8::Debug::SetMessageHandler2(ContextCheckMessageHandler);
// Create two contexts.
- v8::Persistent<v8::Context> context_1;
- v8::Persistent<v8::Context> context_2;
+ v8::Handle<v8::Context> context_1;
+ v8::Handle<v8::Context> context_2;
v8::Handle<v8::ObjectTemplate> global_template =
v8::Handle<v8::ObjectTemplate>();
v8::Handle<v8::Value> global_object = v8::Handle<v8::Value>();
- context_1 = v8::Context::New(NULL, global_template, global_object);
- context_2 = v8::Context::New(NULL, global_template, global_object);
+ context_1 = v8::Context::New(isolate, NULL, global_template, global_object);
+ context_2 = v8::Context::New(isolate, NULL, global_template, global_object);
// Default data value is undefined.
CHECK(context_1->GetEmbedderData(0)->IsUndefined());
@@ -6284,7 +6293,7 @@ TEST(ContextData) {
// Enter and run function in the first context.
{
v8::Context::Scope context_scope(context_1);
- expected_context = context_1;
+ expected_context = v8::Persistent<v8::Context>(*context_1);
expected_context_data = data_1;
v8::Local<v8::Function> f = CompileFunction(source, "f");
f->Call(context_1->Global(), 0, NULL);
@@ -6294,7 +6303,7 @@ TEST(ContextData) {
// Enter and run function in the second context.
{
v8::Context::Scope context_scope(context_2);
- expected_context = context_2;
+ expected_context = v8::Persistent<v8::Context>(*context_2);
expected_context_data = data_2;
v8::Local<v8::Function> f = CompileFunction(source, "f");
f->Call(context_2->Global(), 0, NULL);
@@ -6425,10 +6434,11 @@ TEST(RegExpDebugBreak) {
// Common part of EvalContextData and NestedBreakEventContextData tests.
static void ExecuteScriptForContextCheck() {
// Create a context.
- v8::Persistent<v8::Context> context_1;
+ v8::Handle<v8::Context> context_1;
v8::Handle<v8::ObjectTemplate> global_template =
v8::Handle<v8::ObjectTemplate>();
- context_1 = v8::Context::New(NULL, global_template);
+ context_1 =
+ v8::Context::New(v8::Isolate::GetCurrent(), NULL, global_template);
// Default data value is undefined.
CHECK(context_1->GetEmbedderData(0)->IsUndefined());
@@ -6444,7 +6454,7 @@ static void ExecuteScriptForContextCheck() {
// Enter and run function in the context.
{
v8::Context::Scope context_scope(context_1);
- expected_context = context_1;
+ expected_context = v8::Persistent<v8::Context>(*context_1);
expected_context_data = data_1;
v8::Local<v8::Function> f = CompileFunction(source, "f");
f->Call(context_1->Global(), 0, NULL);
@@ -7084,7 +7094,8 @@ TEST(DebugEventContext) {
v8::Debug::SetDebugEventListener2(DebugEventContextChecker,
expected_callback_data);
expected_context = v8::Context::New();
- v8::Context::Scope context_scope(expected_context);
+ v8::Context::Scope context_scope(
+ v8::Isolate::GetCurrent(), expected_context);
v8::Script::Compile(v8::String::New("(function(){debugger;})();"))->Run();
expected_context.Dispose(expected_context->GetIsolate());
expected_context.Clear();
« no previous file with comments | « test/cctest/test-cpu-profiler.cc ('k') | test/cctest/test-declarative-accessors.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698