Remove obsolete global V8::has_been_fooed flags.

R=yangguo@chromium.org
BUG=v8:2744
TEST=cctest/test-api/InitializeAndDispose

Review URL: https://codereview.chromium.org/23453030

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@16563 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 9b1ab75c
...@@ -50,8 +50,6 @@ namespace internal { ...@@ -50,8 +50,6 @@ namespace internal {
V8_DECLARE_ONCE(init_once); V8_DECLARE_ONCE(init_once);
bool V8::has_been_set_up_ = false;
bool V8::has_been_disposed_ = false;
List<CallCompletedCallback>* V8::call_completed_callbacks_ = NULL; List<CallCompletedCallback>* V8::call_completed_callbacks_ = NULL;
v8::ArrayBuffer::Allocator* V8::array_buffer_allocator_ = NULL; v8::ArrayBuffer::Allocator* V8::array_buffer_allocator_ = NULL;
...@@ -81,9 +79,6 @@ bool V8::Initialize(Deserializer* des) { ...@@ -81,9 +79,6 @@ bool V8::Initialize(Deserializer* des) {
if (isolate->IsDead()) return false; if (isolate->IsDead()) return false;
if (isolate->IsInitialized()) return true; if (isolate->IsInitialized()) return true;
has_been_set_up_ = true;
has_been_disposed_ = false;
return isolate->Init(des); return isolate->Init(des);
} }
...@@ -91,8 +86,7 @@ bool V8::Initialize(Deserializer* des) { ...@@ -91,8 +86,7 @@ bool V8::Initialize(Deserializer* des) {
void V8::TearDown() { void V8::TearDown() {
Isolate* isolate = Isolate::Current(); Isolate* isolate = Isolate::Current();
ASSERT(isolate->IsDefaultIsolate()); ASSERT(isolate->IsDefaultIsolate());
if (!isolate->IsInitialized()) return;
if (!has_been_set_up_ || has_been_disposed_) return;
// The isolate has to be torn down before clearing the LOperand // The isolate has to be torn down before clearing the LOperand
// caches so that the optimizing compiler thread (if running) // caches so that the optimizing compiler thread (if running)
...@@ -106,8 +100,6 @@ void V8::TearDown() { ...@@ -106,8 +100,6 @@ void V8::TearDown() {
RegisteredExtension::UnregisterAll(); RegisteredExtension::UnregisterAll();
Isolate::GlobalTearDown(); Isolate::GlobalTearDown();
has_been_disposed_ = true;
delete call_completed_callbacks_; delete call_completed_callbacks_;
call_completed_callbacks_ = NULL; call_completed_callbacks_ = NULL;
......
...@@ -122,11 +122,6 @@ class V8 : public AllStatic { ...@@ -122,11 +122,6 @@ class V8 : public AllStatic {
static void InitializeOncePerProcessImpl(); static void InitializeOncePerProcessImpl();
static void InitializeOncePerProcess(); static void InitializeOncePerProcess();
// True if V8 has ever been run
static bool has_been_set_up_;
// True if engine has been shut down
// (reset if engine is restarted)
static bool has_been_disposed_;
// List of callbacks when a Call completes. // List of callbacks when a Call completes.
static List<CallCompletedCallback>* call_completed_callbacks_; static List<CallCompletedCallback>* call_completed_callbacks_;
// Allocator for external array buffers. // Allocator for external array buffers.
......
...@@ -166,6 +166,24 @@ static void SignatureCallback( ...@@ -166,6 +166,24 @@ static void SignatureCallback(
} }
// Tests that call v8::V8::Dispose() cannot be threaded.
TEST(InitializeAndDisposeOnce) {
CHECK(v8::V8::Initialize());
CHECK(v8::V8::Dispose());
}
// Tests that call v8::V8::Dispose() cannot be threaded.
TEST(InitializeAndDisposeMultiple) {
for (int i = 0; i < 3; ++i) CHECK(v8::V8::Dispose());
for (int i = 0; i < 3; ++i) CHECK(v8::V8::Initialize());
for (int i = 0; i < 3; ++i) CHECK(v8::V8::Dispose());
// TODO(mstarzinger): This should fail gracefully instead of asserting.
// for (int i = 0; i < 3; ++i) CHECK(v8::V8::Initialize());
for (int i = 0; i < 3; ++i) CHECK(v8::V8::Dispose());
}
THREADED_TEST(Handles) { THREADED_TEST(Handles) {
v8::HandleScope scope(v8::Isolate::GetCurrent()); v8::HandleScope scope(v8::Isolate::GetCurrent());
Local<Context> local_env; Local<Context> local_env;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment