X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fv8%2Fsrc%2Fv8threads.cc;h=b799126563fd9c0eb88d9b1787b2dcf4e16d6d6d;hb=1afa4dd80ef85af7c90efaea6959db1d92330844;hp=a46b289ba1374b9e17dc3e18e823c86214784159;hpb=90762837333c13ccf56f2ad88e4481fc71e8d281;p=platform%2Fframework%2Fweb%2Fcrosswalk.git diff --git a/src/v8/src/v8threads.cc b/src/v8/src/v8threads.cc index a46b289b..b799126 100644 --- a/src/v8/src/v8threads.cc +++ b/src/v8/src/v8threads.cc @@ -14,9 +14,13 @@ namespace v8 { +namespace { + // Track whether this V8 instance has ever called v8::Locker. This allows the // API code to verify that the lock is always held when V8 is being entered. -bool Locker::active_ = false; +base::Atomic32 g_locker_was_ever_used_ = 0; + +} // namespace // Once the Locker is initialized, the current thread will be guaranteed to have @@ -27,21 +31,12 @@ void Locker::Initialize(v8::Isolate* isolate) { top_level_ = true; isolate_ = reinterpret_cast(isolate); // Record that the Locker has been used at least once. - active_ = true; + base::NoBarrier_Store(&g_locker_was_ever_used_, 1); // Get the big lock if necessary. if (!isolate_->thread_manager()->IsLockedByCurrentThread()) { isolate_->thread_manager()->Lock(); has_lock_ = true; - // Make sure that V8 is initialized. Archiving of threads interferes - // with deserialization by adding additional root pointers, so we must - // initialize here, before anyone can call ~Locker() or Unlocker(). - if (!isolate_->IsInitialized()) { - isolate_->Enter(); - V8::Initialize(); - isolate_->Exit(); - } - // This may be a locker within an unlocker in which case we have to // get the saved state for this thread and restore it. if (isolate_->thread_manager()->RestoreThread()) { @@ -64,7 +59,7 @@ bool Locker::IsLocked(v8::Isolate* isolate) { bool Locker::IsActive() { - return active_; + return !!base::NoBarrier_Load(&g_locker_was_ever_used_); }