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

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

Issue 15038002: Revert "deprecate Context::New which returns Persistent" (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « test/cctest/test-heap.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-2011 the V8 project authors. All rights reserved. 1 // Copyright 2007-2011 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 604 matching lines...) Expand 10 before | Expand all | Expand 10 after
615 v8::Persistent<v8::Context> context_; 615 v8::Persistent<v8::Context> context_;
616 }; 616 };
617 617
618 // Locker inside an Unlocker inside a Locker for default isolate. 618 // Locker inside an Unlocker inside a Locker for default isolate.
619 TEST(LockUnlockLockDefaultIsolateMultithreaded) { 619 TEST(LockUnlockLockDefaultIsolateMultithreaded) {
620 #ifdef V8_TARGET_ARCH_MIPS 620 #ifdef V8_TARGET_ARCH_MIPS
621 const int kNThreads = 50; 621 const int kNThreads = 50;
622 #else 622 #else
623 const int kNThreads = 100; 623 const int kNThreads = 100;
624 #endif 624 #endif
625 Local<v8::Context> context; 625 Persistent<v8::Context> context;
626 i::List<JoinableThread*> threads(kNThreads); 626 i::List<JoinableThread*> threads(kNThreads);
627 { 627 {
628 v8::Locker locker_(CcTest::default_isolate()); 628 v8::Locker locker_(CcTest::default_isolate());
629 v8::HandleScope handle_scope(CcTest::default_isolate()); 629 v8::HandleScope handle_scope(CcTest::default_isolate());
630 context = v8::Context::New(CcTest::default_isolate()); 630 context = v8::Context::New();
631 for (int i = 0; i < kNThreads; i++) { 631 for (int i = 0; i < kNThreads; i++) {
632 threads.Add(new LockUnlockLockDefaultIsolateThread(context)); 632 threads.Add(new LockUnlockLockDefaultIsolateThread(
633 v8::Local<v8::Context>::New(CcTest::default_isolate(), context)));
633 } 634 }
634 } 635 }
635 StartJoinAndDeleteThreads(threads); 636 StartJoinAndDeleteThreads(threads);
636 } 637 }
637 638
638 639
639 TEST(Regress1433) { 640 TEST(Regress1433) {
640 for (int i = 0; i < 10; i++) { 641 for (int i = 0; i < 10; i++) {
641 v8::Isolate* isolate = v8::Isolate::New(); 642 v8::Isolate* isolate = v8::Isolate::New();
642 { 643 {
(...skipping 24 matching lines...) Expand all
667 count_(count), 668 count_(count),
668 extension_names_(extension_names) 669 extension_names_(extension_names)
669 {} 670 {}
670 671
671 virtual void Run() { 672 virtual void Run() {
672 v8::Isolate* isolate = v8::Isolate::New(); 673 v8::Isolate* isolate = v8::Isolate::New();
673 { 674 {
674 v8::Isolate::Scope isolate_scope(isolate); 675 v8::Isolate::Scope isolate_scope(isolate);
675 CHECK(!i::Isolate::Current()->has_installed_extensions()); 676 CHECK(!i::Isolate::Current()->has_installed_extensions());
676 v8::ExtensionConfiguration extensions(count_, extension_names_); 677 v8::ExtensionConfiguration extensions(count_, extension_names_);
677 v8::HandleScope handle_scope(isolate); 678 v8::Persistent<v8::Context> context = v8::Context::New(&extensions);
678 v8::Context::New(isolate, &extensions);
679 CHECK(i::Isolate::Current()->has_installed_extensions()); 679 CHECK(i::Isolate::Current()->has_installed_extensions());
680 context.Dispose(isolate);
680 } 681 }
681 isolate->Dispose(); 682 isolate->Dispose();
682 } 683 }
683 private: 684 private:
684 int count_; 685 int count_;
685 const char** extension_names_; 686 const char** extension_names_;
686 }; 687 };
687 688
688 // Test installing extensions in separate isolates concurrently. 689 // Test installing extensions in separate isolates concurrently.
689 // http://code.google.com/p/v8/issues/detail?id=1821 690 // http://code.google.com/p/v8/issues/detail?id=1821
(...skipping 21 matching lines...) Expand all
711 kSimpleExtensionSource)); 712 kSimpleExtensionSource));
712 const char* extension_names[] = { "test0", "test1", 713 const char* extension_names[] = { "test0", "test1",
713 "test2", "test3", "test4", 714 "test2", "test3", "test4",
714 "test5", "test6", "test7" }; 715 "test5", "test6", "test7" };
715 i::List<JoinableThread*> threads(kNThreads); 716 i::List<JoinableThread*> threads(kNThreads);
716 for (int i = 0; i < kNThreads; i++) { 717 for (int i = 0; i < kNThreads; i++) {
717 threads.Add(new IsolateGenesisThread(8, extension_names)); 718 threads.Add(new IsolateGenesisThread(8, extension_names));
718 } 719 }
719 StartJoinAndDeleteThreads(threads); 720 StartJoinAndDeleteThreads(threads);
720 } 721 }
OLDNEW
« no previous file with comments | « test/cctest/test-heap.cc ('k') | test/cctest/test-log.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698