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

Side by Side Diff: test/cctest/test-api.cc

Issue 3121009: [Isolates] Fix Linux build in Isolates branch. (Closed)
Patch Set: Fixed the crash due to incorrect usage of API in test. Created 10 years, 4 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 unified diff | Download patch
« no previous file with comments | « src/v8threads.cc ('k') | test/cctest/test-log.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2007-2009 the V8 project authors. All rights reserved. 1 // Copyright 2007-2009 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 11238 matching lines...) Expand 10 before | Expand all | Expand 10 after
11249 } 11249 }
11250 11250
11251 TEST(RunDefaultAndAnotherIsolate) { 11251 TEST(RunDefaultAndAnotherIsolate) {
11252 v8::HandleScope scope; 11252 v8::HandleScope scope;
11253 LocalContext context; 11253 LocalContext context;
11254 11254
11255 // Enter new isolate. 11255 // Enter new isolate.
11256 v8::Isolate* isolate = v8::Isolate::New(); 11256 v8::Isolate* isolate = v8::Isolate::New();
11257 CHECK(isolate); 11257 CHECK(isolate);
11258 isolate->Enter(); 11258 isolate->Enter();
11259 v8::HandleScope scope_new; 11259 { // Need this block because subsequent Exit() will deallocate Heap,
11260 LocalContext context_new; 11260 // so we need all scope objects to be deconstructed when it happens.
11261 11261 v8::HandleScope scope_new;
11262 // Run something in new isolate. 11262 LocalContext context_new;
11263 CompileRun("var foo = 153;"); 11263
11264 ExpectTrue("function f() { return foo == 153; }; f()"); 11264 // Run something in new isolate.
11265 CompileRun("var foo = 153;");
11266 ExpectTrue("function f() { return foo == 153; }; f()");
11267 }
11265 isolate->Exit(); 11268 isolate->Exit();
11266 11269
11267 // This runs automatically in default isolate. 11270 // This runs automatically in default isolate.
11268 // Variables in another isolate should be not available. 11271 // Variables in another isolate should be not available.
11269 ExpectTrue("function f() {" 11272 ExpectTrue("function f() {"
11270 " try {" 11273 " try {"
11271 " foo;" 11274 " foo;"
11272 " return false;" 11275 " return false;"
11273 " } catch(e) {" 11276 " } catch(e) {"
11274 " return true;" 11277 " return true;"
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
11431 CHECK(result1 == 10946); 11434 CHECK(result1 == 10946);
11432 CHECK(result2 == 144); 11435 CHECK(result2 == 144);
11433 CHECK(result1 == thread1.result()); 11436 CHECK(result1 == thread1.result());
11434 CHECK(result2 == thread2.result()); 11437 CHECK(result2 == thread2.result());
11435 11438
11436 isolate1->Dispose(); 11439 isolate1->Dispose();
11437 isolate2->Dispose(); 11440 isolate2->Dispose();
11438 } 11441 }
11439 11442
11440 11443
OLDNEW
« no previous file with comments | « src/v8threads.cc ('k') | test/cctest/test-log.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698