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

Unified Diff: runtime/vm/thread_interrupter.h

Issue 128653004: Use list of isolates in profiler (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 10 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
Index: runtime/vm/thread_interrupter.h
diff --git a/runtime/vm/thread_interrupter.h b/runtime/vm/thread_interrupter.h
index 3a3168399578523ae07f947c8b28aa2cfee8e35b..4b2ed3dec80ea512bd94d5482e58dea00dd0b29a 100644
--- a/runtime/vm/thread_interrupter.h
+++ b/runtime/vm/thread_interrupter.h
@@ -30,9 +30,18 @@ struct InterruptedThreadState {
typedef void (*ThreadInterruptCallback)(const InterruptedThreadState& state,
void* data);
+// State stored per registered thread.
+struct InterruptableThreadState {
+ ThreadId id;
+ ThreadInterruptCallback callback;
+ void* data;
+};
+
class ThreadInterrupter : public AllStatic {
public:
static void InitOnce();
+
+ static void Startup();
static void Shutdown();
// Delay between interrupts.
@@ -40,14 +49,12 @@ class ThreadInterrupter : public AllStatic {
// Register the currently running thread for interrupts. If the current thread
// is already registered, callback and data will be updated.
- static void Register(ThreadInterruptCallback callback, void* data);
+ static InterruptableThreadState* Register(ThreadInterruptCallback callback,
+ void* data);
// Unregister the currently running thread for interrupts.
static void Unregister();
- // Enable interrupts for this thread. Does not alter callback.
- static void Enable();
- // Disable interrupts for this thread. Does not alter callback.
- static void Disable();
+ static InterruptableThreadState* GetCurrentThreadState();
private:
static const intptr_t kMaxThreads = 4096;
@@ -58,37 +65,21 @@ class ThreadInterrupter : public AllStatic {
static Monitor* monitor_;
static intptr_t interrupt_period_;
static ThreadLocalKey thread_state_key_;
- // State stored per registered thread.
- struct ThreadState {
- ThreadId id;
- ThreadInterruptCallback callback;
- void* data;
- };
+ static InterruptableThreadState* _EnsureThreadStateCreated();
static void UpdateStateObject(ThreadInterruptCallback callback, void* data);
- static ThreadState* CurrentThreadState();
- static void SetCurrentThreadState(ThreadState* state);
-
- // Registered thread table.
- static ThreadState** threads_;
- static intptr_t threads_capacity_;
- static intptr_t threads_size_;
- static void _EnsureThreadStateCreated();
- static void _Enable();
- static void _Disable();
- static void ResizeThreads(intptr_t new_capacity);
- static void AddThread(ThreadId id);
- static intptr_t FindThreadIndex(ThreadId id);
- static ThreadState* RemoveThread(intptr_t i);
+ static InterruptableThreadState* CurrentThreadState();
+ static void SetCurrentThreadState(InterruptableThreadState* state);
+
+ static void InterruptThread(InterruptableThreadState* thread_state);
+ static void ThreadMain(uword parameters);
+ friend class ThreadInterrupterVisitIsolates;
friend class ThreadInterrupterAndroid;
- friend class ThreadInterrupterMacOS;
friend class ThreadInterrupterLinux;
+ friend class ThreadInterrupterMacOS;
friend class ThreadInterrupterWin;
siva 2014/02/06 00:37:24 Do these OS specific classes need to be friends he
Cutch 2014/02/06 17:51:51 Done.
- static void InterruptThreads(int64_t current_time);
- static void ThreadMain(uword parameters);
-
static void InstallSignalHandler();
};

Powered by Google App Engine
This is Rietveld 408576698