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

Side by Side Diff: src/v8threads.cc

Issue 18707: Split handle scopes into an internal version and a version accessible... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 11 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
OLDNEW
1 // Copyright 2008 the V8 project authors. All rights reserved. 1 // Copyright 2008 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 20 matching lines...) Expand all
31 #include "debug.h" 31 #include "debug.h"
32 #include "execution.h" 32 #include "execution.h"
33 #include "v8threads.h" 33 #include "v8threads.h"
34 #include "regexp-stack.h" 34 #include "regexp-stack.h"
35 35
36 namespace v8 { 36 namespace v8 {
37 37
38 static internal::Thread::LocalStorageKey thread_state_key = 38 static internal::Thread::LocalStorageKey thread_state_key =
39 internal::Thread::CreateThreadLocalKey(); 39 internal::Thread::CreateThreadLocalKey();
40 40
41
42 // Track whether this V8 instance has ever called v8::Locker. This allows the
43 // API code to verify that the lock is always held when V8 is being entered.
44 bool Locker::active_ = false;
45
46
41 // Constructor for the Locker object. Once the Locker is constructed the 47 // Constructor for the Locker object. Once the Locker is constructed the
42 // current thread will be guaranteed to have the big V8 lock. 48 // current thread will be guaranteed to have the big V8 lock.
43 Locker::Locker() : has_lock_(false), top_level_(true) { 49 Locker::Locker() : has_lock_(false), top_level_(true) {
50 // Record that the Locker has been used at least once.
51 active_ = true;
44 // Get the big lock if necessary. 52 // Get the big lock if necessary.
45 if (!internal::ThreadManager::IsLockedByCurrentThread()) { 53 if (!internal::ThreadManager::IsLockedByCurrentThread()) {
46 internal::ThreadManager::Lock(); 54 internal::ThreadManager::Lock();
47 has_lock_ = true; 55 has_lock_ = true;
48 // This may be a locker within an unlocker in which case we have to 56 // This may be a locker within an unlocker in which case we have to
49 // get the saved state for this thread and restore it. 57 // get the saved state for this thread and restore it.
50 if (internal::ThreadManager::RestoreThread()) { 58 if (internal::ThreadManager::RestoreThread()) {
51 top_level_ = false; 59 top_level_ = false;
52 } 60 }
53 } 61 }
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 // Acknowledge the preemption by the receiving thread. 337 // Acknowledge the preemption by the receiving thread.
330 void ContextSwitcher::PreemptionReceived() { 338 void ContextSwitcher::PreemptionReceived() {
331 ASSERT(Locker::IsLocked()); 339 ASSERT(Locker::IsLocked());
332 // There is currently no accounting being done for this. But could be in the 340 // There is currently no accounting being done for this. But could be in the
333 // future, which is why we leave this in. 341 // future, which is why we leave this in.
334 } 342 }
335 343
336 344
337 } // namespace internal 345 } // namespace internal
338 } // namespace v8 346 } // namespace v8
OLDNEW
« src/apiutils.h ('K') | « src/messages.cc ('k') | tools/v8.xcodeproj/project.pbxproj » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698