Revision: 18978
Author:   [email protected]
Date:     Fri Jan 31 09:59:50 2014 UTC
Log:      Once again: Fixed some lifetime/ownership issues in cctest

* Fixed lifetime issue in cctest/test-heap-profiler/HeapSnapshotJSONSerialization.

   * Fixed ownership issue in cctest/test-api/ContainsOnlyOneByte.

[email protected]

Review URL: https://codereview.chromium.org/142553005
http://code.google.com/p/v8/source/detail?r=18978

Modified:
 /branches/bleeding_edge/test/cctest/test-api.cc
 /branches/bleeding_edge/test/cctest/test-heap-profiler.cc

=======================================
--- /branches/bleeding_edge/test/cctest/test-api.cc Fri Jan 31 07:29:25 2014 UTC +++ /branches/bleeding_edge/test/cctest/test-api.cc Fri Jan 31 09:59:50 2014 UTC
@@ -18951,8 +18951,9 @@
   }
   string_contents[length-1] = 0;
   // Simple case.
-  Handle<String> string;
-  string = String::NewExternal(isolate, new TestResource(string_contents));
+  Handle<String> string =
+      String::NewExternal(isolate,
+                          new TestResource(string_contents, NULL, false));
   CHECK(!string->IsOneByte() && string->ContainsOnlyOneByte());
   // Counter example.
   string = String::NewFromTwoByte(isolate, string_contents);
@@ -18969,7 +18970,9 @@
   balanced = String::Concat(balanced, right);
   Handle<String> cons_strings[] = {left, balanced, right};
   Handle<String> two_byte =
-      String::NewExternal(isolate, new TestResource(string_contents));
+      String::NewExternal(isolate,
+                          new TestResource(string_contents, NULL, false));
+  USE(two_byte); USE(cons_strings);
   for (size_t i = 0; i < ARRAY_SIZE(cons_strings); i++) {
     // Base assumptions.
     string = cons_strings[i];
@@ -18990,7 +18993,8 @@
         int shift = 8 + (i % 7);
         string_contents[alignment + i] = 1 << shift;
         string = String::NewExternal(
-            isolate, new TestResource(string_contents + alignment));
+            isolate,
+            new TestResource(string_contents + alignment, NULL, false));
         CHECK_EQ(size, string->Length());
         CHECK(!string->ContainsOnlyOneByte());
         string_contents[alignment + i] = 0x41;
=======================================
--- /branches/bleeding_edge/test/cctest/test-heap-profiler.cc Thu Jan 30 12:17:21 2014 UTC +++ /branches/bleeding_edge/test/cctest/test-heap-profiler.cc Fri Jan 31 09:59:50 2014 UTC
@@ -746,9 +746,9 @@
   stream.WriteTo(json);

   // Verify that snapshot string is valid JSON.
-  AsciiResource json_res(json);
+  AsciiResource* json_res = new AsciiResource(json);
   v8::Local<v8::String> json_string =
-      v8::String::NewExternal(env->GetIsolate(), &json_res);
+      v8::String::NewExternal(env->GetIsolate(), json_res);
   env->Global()->Set(v8_str("json_snapshot"), json_string);
   v8::Local<v8::Value> snapshot_parse_result = CompileRun(
       "var parsed = JSON.parse(json_snapshot); true;");

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to