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

Unified Diff: test/cctest/cctest.h

Issue 23519010: cleanup cctest generally and remove ctest::context (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: arm fix Created 7 years, 3 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 | « no previous file | test/cctest/cctest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/cctest.h
diff --git a/test/cctest/cctest.h b/test/cctest/cctest.h
index 26d99727948602fa028d23ae597776a583958f88..122d36d5b8383fb30abbcb4fbb359f22ebfc21fb 100644
--- a/test/cctest/cctest.h
+++ b/test/cctest/cctest.h
@@ -92,12 +92,9 @@ class CcTest {
const char* dependency() { return dependency_; }
bool enabled() { return enabled_; }
- static v8::Handle<v8::Context> env() {
- return v8::Local<v8::Context>::New(isolate(), context_);
- }
-
static v8::Isolate* isolate() {
- return default_isolate_;
+ isolate_used_ = true;
+ return isolate_;
}
static i::Isolate* i_isolate() {
@@ -108,8 +105,21 @@ class CcTest {
return i_isolate()->heap();
}
- // Helper function to initialize the VM.
- static void InitializeVM(CcTestExtensionFlags extensions = NO_EXTENSIONS);
+ // TODO(dcarney): Remove.
+ // This must be called first in a test.
+ static void InitializeVM() {
+ CHECK(!isolate_used_);
+ CHECK(!initialize_called_);
+ initialize_called_ = true;
+ v8::HandleScope handle_scope(CcTest::isolate());
+ v8::Context::New(CcTest::isolate())->Enter();
+ }
+
+ // Helper function to configure a context.
+ // Must be in a HandleScope.
+ static v8::Local<v8::Context> NewContext(
+ CcTestExtensionFlags extensions,
+ v8::Isolate* isolate = CcTest::isolate());
private:
friend int main(int argc, char** argv);
@@ -121,10 +131,9 @@ class CcTest {
bool initialize_;
CcTest* prev_;
static CcTest* last_;
- static v8::Isolate* default_isolate_;
- enum InitializationState {kUnset, kUnintialized, kInitialized};
- static InitializationState initialization_state_;
- static v8::Persistent<v8::Context> context_;
+ static v8::Isolate* isolate_;
+ static bool initialize_called_;
+ static bool isolate_used_;
};
// Switches between all the Api tests using the threading support.
« no previous file with comments | « no previous file | test/cctest/cctest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698