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

Side by Side Diff: test/cctest/test-lockers.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 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 Persistent<v8::Context> context; 625 Local<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(); 630 context = v8::Context::New(CcTest::default_isolate());
631 for (int i = 0; i < kNThreads; i++) { 631 for (int i = 0; i < kNThreads; i++) {
632 threads.Add(new LockUnlockLockDefaultIsolateThread( 632 threads.Add(new LockUnlockLockDefaultIsolateThread(context));
633 v8::Local<v8::Context>::New(CcTest::default_isolate(), context)));
634 } 633 }
635 } 634 }
636 StartJoinAndDeleteThreads(threads); 635 StartJoinAndDeleteThreads(threads);
637 } 636 }
638 637
639 638
640 TEST(Regress1433) { 639 TEST(Regress1433) {
641 for (int i = 0; i < 10; i++) { 640 for (int i = 0; i < 10; i++) {
642 v8::Isolate* isolate = v8::Isolate::New(); 641 v8::Isolate* isolate = v8::Isolate::New();
643 { 642 {
(...skipping 24 matching lines...) Expand all
668 count_(count), 667 count_(count),
669 extension_names_(extension_names) 668 extension_names_(extension_names)
670 {} 669 {}
671 670
672 virtual void Run() { 671 virtual void Run() {
673 v8::Isolate* isolate = v8::Isolate::New(); 672 v8::Isolate* isolate = v8::Isolate::New();
674 { 673 {
675 v8::Isolate::Scope isolate_scope(isolate); 674 v8::Isolate::Scope isolate_scope(isolate);
676 CHECK(!i::Isolate::Current()->has_installed_extensions()); 675 CHECK(!i::Isolate::Current()->has_installed_extensions());
677 v8::ExtensionConfiguration extensions(count_, extension_names_); 676 v8::ExtensionConfiguration extensions(count_, extension_names_);
678 v8::Persistent<v8::Context> context = v8::Context::New(&extensions); 677 v8::HandleScope handle_scope(isolate);
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);
681 } 680 }
682 isolate->Dispose(); 681 isolate->Dispose();
683 } 682 }
684 private: 683 private:
685 int count_; 684 int count_;
686 const char** extension_names_; 685 const char** extension_names_;
687 }; 686 };
688 687
689 // Test installing extensions in separate isolates concurrently. 688 // Test installing extensions in separate isolates concurrently.
690 // http://code.google.com/p/v8/issues/detail?id=1821 689 // http://code.google.com/p/v8/issues/detail?id=1821
(...skipping 21 matching lines...) Expand all
712 kSimpleExtensionSource)); 711 kSimpleExtensionSource));
713 const char* extension_names[] = { "test0", "test1", 712 const char* extension_names[] = { "test0", "test1",
714 "test2", "test3", "test4", 713 "test2", "test3", "test4",
715 "test5", "test6", "test7" }; 714 "test5", "test6", "test7" };
716 i::List<JoinableThread*> threads(kNThreads); 715 i::List<JoinableThread*> threads(kNThreads);
717 for (int i = 0; i < kNThreads; i++) { 716 for (int i = 0; i < kNThreads; i++) {
718 threads.Add(new IsolateGenesisThread(8, extension_names)); 717 threads.Add(new IsolateGenesisThread(8, extension_names));
719 } 718 }
720 StartJoinAndDeleteThreads(threads); 719 StartJoinAndDeleteThreads(threads);
721 } 720 }
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