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

Unified Diff: test/cctest/test-serialize.cc

Issue 14793004: deprecate Context::New which returns Persistent (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: use Reset instead of operator= Created 7 years, 7 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-regexp.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-serialize.cc
diff --git a/test/cctest/test-serialize.cc b/test/cctest/test-serialize.cc
index d236cf1fa8a8f927d833ab90107ed49b7a031cc8..0cf80440f6dafe823dcbbfcb4bf2dadacb1c39a9 100644
--- a/test/cctest/test-serialize.cc
+++ b/test/cctest/test-serialize.cc
@@ -251,8 +251,11 @@ static void Serialize() {
// can be loaded from v8natives.js and their addresses can be processed. This
// will clear the pending fixups array, which would otherwise contain GC roots
// that would confuse the serialization/deserialization process.
- v8::Persistent<v8::Context> env = v8::Context::New();
- env.Dispose(env->GetIsolate());
+ {
+ v8::Isolate* isolate = v8::Isolate::GetCurrent();
+ v8::HandleScope scope(isolate);
+ v8::Context::New(isolate);
+ }
WriteToFile(FLAG_testing_serialization_file);
}
@@ -304,10 +307,11 @@ DEPENDENT_TEST(Deserialize, Serialize) {
// serialization. That doesn't matter. We don't need to be able to
// serialize a snapshot in a VM that is booted from a snapshot.
if (!Snapshot::HaveASnapshotToStartFrom()) {
- v8::HandleScope scope(v8::Isolate::GetCurrent());
+ v8::Isolate* isolate = v8::Isolate::GetCurrent();
+ v8::HandleScope scope(isolate);
Deserialize();
- v8::Persistent<v8::Context> env = v8::Context::New();
+ v8::Local<v8::Context> env = v8::Context::New(isolate);
env->Enter();
SanityCheck();
@@ -317,10 +321,11 @@ DEPENDENT_TEST(Deserialize, Serialize) {
DEPENDENT_TEST(DeserializeFromSecondSerialization, SerializeTwice) {
if (!Snapshot::HaveASnapshotToStartFrom()) {
- v8::HandleScope scope(v8::Isolate::GetCurrent());
+ v8::Isolate* isolate = v8::Isolate::GetCurrent();
+ v8::HandleScope scope(isolate);
Deserialize();
- v8::Persistent<v8::Context> env = v8::Context::New();
+ v8::Local<v8::Context> env = v8::Context::New(isolate);
env->Enter();
SanityCheck();
@@ -330,10 +335,11 @@ DEPENDENT_TEST(DeserializeFromSecondSerialization, SerializeTwice) {
DEPENDENT_TEST(DeserializeAndRunScript2, Serialize) {
if (!Snapshot::HaveASnapshotToStartFrom()) {
- v8::HandleScope scope(v8::Isolate::GetCurrent());
+ v8::Isolate* isolate = v8::Isolate::GetCurrent();
+ v8::HandleScope scope(isolate);
Deserialize();
- v8::Persistent<v8::Context> env = v8::Context::New();
+ v8::Local<v8::Context> env = v8::Context::New(isolate);
env->Enter();
const char* c_source = "\"1234\".length";
@@ -347,10 +353,11 @@ DEPENDENT_TEST(DeserializeAndRunScript2, Serialize) {
DEPENDENT_TEST(DeserializeFromSecondSerializationAndRunScript2,
SerializeTwice) {
if (!Snapshot::HaveASnapshotToStartFrom()) {
- v8::HandleScope scope(v8::Isolate::GetCurrent());
+ v8::Isolate* isolate = v8::Isolate::GetCurrent();
+ v8::HandleScope scope(isolate);
Deserialize();
- v8::Persistent<v8::Context> env = v8::Context::New();
+ v8::Local<v8::Context> env = v8::Context::New(isolate);
env->Enter();
const char* c_source = "\"1234\".length";
@@ -368,7 +375,12 @@ TEST(PartialSerialization) {
Isolate* isolate = Isolate::Current();
Heap* heap = isolate->heap();
- v8::Persistent<v8::Context> env = v8::Context::New();
+ v8::Persistent<v8::Context> env;
+ {
+ HandleScope scope(isolate);
+ env.Reset(v8::Isolate::GetCurrent(),
+ v8::Context::New(v8::Isolate::GetCurrent()));
+ }
ASSERT(!env.IsEmpty());
env->Enter();
// Make sure all builtin scripts are cached.
@@ -502,7 +514,12 @@ TEST(ContextSerialization) {
Isolate* isolate = Isolate::Current();
Heap* heap = isolate->heap();
- v8::Persistent<v8::Context> env = v8::Context::New();
+ v8::Persistent<v8::Context> env;
+ {
+ HandleScope scope(isolate);
+ env.Reset(v8::Isolate::GetCurrent(),
+ v8::Context::New(v8::Isolate::GetCurrent()));
+ }
ASSERT(!env.IsEmpty());
env->Enter();
// Make sure all builtin scripts are cached.
« no previous file with comments | « test/cctest/test-regexp.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698