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
This commit is contained in:
parent
9b1ab75c51
commit
d1cfe6c8dd
10
src/v8.cc
10
src/v8.cc
@ -50,8 +50,6 @@ namespace internal {
|
||||
|
||||
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;
|
||||
v8::ArrayBuffer::Allocator* V8::array_buffer_allocator_ = NULL;
|
||||
|
||||
@ -81,9 +79,6 @@ bool V8::Initialize(Deserializer* des) {
|
||||
if (isolate->IsDead()) return false;
|
||||
if (isolate->IsInitialized()) return true;
|
||||
|
||||
has_been_set_up_ = true;
|
||||
has_been_disposed_ = false;
|
||||
|
||||
return isolate->Init(des);
|
||||
}
|
||||
|
||||
@ -91,8 +86,7 @@ bool V8::Initialize(Deserializer* des) {
|
||||
void V8::TearDown() {
|
||||
Isolate* isolate = Isolate::Current();
|
||||
ASSERT(isolate->IsDefaultIsolate());
|
||||
|
||||
if (!has_been_set_up_ || has_been_disposed_) return;
|
||||
if (!isolate->IsInitialized()) return;
|
||||
|
||||
// The isolate has to be torn down before clearing the LOperand
|
||||
// caches so that the optimizing compiler thread (if running)
|
||||
@ -106,8 +100,6 @@ void V8::TearDown() {
|
||||
RegisteredExtension::UnregisterAll();
|
||||
Isolate::GlobalTearDown();
|
||||
|
||||
has_been_disposed_ = true;
|
||||
|
||||
delete call_completed_callbacks_;
|
||||
call_completed_callbacks_ = NULL;
|
||||
|
||||
|
5
src/v8.h
5
src/v8.h
@ -122,11 +122,6 @@ class V8 : public AllStatic {
|
||||
static void InitializeOncePerProcessImpl();
|
||||
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.
|
||||
static List<CallCompletedCallback>* call_completed_callbacks_;
|
||||
// Allocator for external array buffers.
|
||||
|
@ -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) {
|
||||
v8::HandleScope scope(v8::Isolate::GetCurrent());
|
||||
Local<Context> local_env;
|
||||
|
Loading…
Reference in New Issue
Block a user