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

Unified Diff: src/debug.h

Issue 292713002: Revert "Simplify debugger state." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 7 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
« no previous file with comments | « src/d8.cc ('k') | src/debug.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/debug.h
diff --git a/src/debug.h b/src/debug.h
index 80e6970e34caccbceb0d0f499443b9b6f7bd1dc2..35b29c0d22c6d1d0f84af9724bc7c28086b16f33 100644
--- a/src/debug.h
+++ b/src/debug.h
@@ -490,6 +490,7 @@ class Debug {
private:
explicit Debug(Isolate* isolate);
+ ~Debug();
static bool CompileDebuggerScript(Isolate* isolate, int index);
void ClearOneShot();
@@ -742,6 +743,25 @@ class LockingCommandMessageQueue BASE_EMBEDDED {
class Debugger {
public:
+ ~Debugger();
+
+ void DebugRequest(const uint16_t* json_request, int length);
+
+ MUST_USE_RESULT MaybeHandle<Object> MakeJSObject(
+ Vector<const char> constructor_name,
+ int argc,
+ Handle<Object> argv[]);
+ MUST_USE_RESULT MaybeHandle<Object> MakeExecutionState();
+ MUST_USE_RESULT MaybeHandle<Object> MakeBreakEvent(
+ Handle<Object> break_points_hit);
+ MUST_USE_RESULT MaybeHandle<Object> MakeExceptionEvent(
+ Handle<Object> exception,
+ bool uncaught,
+ Handle<Object> promise);
+ MUST_USE_RESULT MaybeHandle<Object> MakeCompileEvent(
+ Handle<Script> script, bool before);
+ MUST_USE_RESULT MaybeHandle<Object> MakeScriptCollectedEvent(int id);
+
void OnDebugBreak(Handle<Object> break_points_hit, bool auto_continue);
void OnException(Handle<Object> exception, bool uncaught);
void OnBeforeCompile(Handle<Script> script);
@@ -753,7 +773,13 @@ class Debugger {
void OnAfterCompile(Handle<Script> script,
AfterCompileFlags after_compile_flags);
void OnScriptCollected(int id);
-
+ void ProcessDebugEvent(v8::DebugEvent event,
+ Handle<JSObject> event_data,
+ bool auto_continue);
+ void NotifyMessageHandler(v8::DebugEvent event,
+ Handle<JSObject> exec_state,
+ Handle<JSObject> event_data,
+ bool auto_continue);
void SetEventListener(Handle<Object> callback, Handle<Object> data);
void SetMessageHandler(v8::Debug::MessageHandler handler);
@@ -772,13 +798,36 @@ class Debugger {
Handle<Context> GetDebugContext();
+ // Unload the debugger if possible. Only called when no debugger is currently
+ // active.
+ void UnloadDebugger();
+ friend void ForceUnloadDebugger(); // In test-debug.cc
+
+ inline bool EventActive() {
+ LockGuard<RecursiveMutex> lock_guard(&debugger_access_);
+
+ // Check whether the message handler was been cleared.
+ // TODO(yangguo): handle loading and unloading of the debugger differently.
+ if (debugger_unload_pending_) {
+ if (isolate_->debug()->debugger_entry() == NULL) {
+ UnloadDebugger();
+ }
+ }
+
+ // Currently argument event is not used.
+ return !ignore_debugger_ && is_active_;
+ }
+
bool ignore_debugger() const { return ignore_debugger_; }
void set_live_edit_enabled(bool v) { live_edit_enabled_ = v; }
bool live_edit_enabled() const {
return FLAG_enable_liveedit && live_edit_enabled_ ;
}
- bool is_active() { return is_active_; }
+ bool is_active() {
+ LockGuard<RecursiveMutex> lock_guard(&debugger_access_);
+ return is_active_;
+ }
class IgnoreScope {
public:
@@ -800,22 +849,6 @@ class Debugger {
private:
explicit Debugger(Isolate* isolate);
- ~Debugger();
-
- MUST_USE_RESULT MaybeHandle<Object> MakeJSObject(
- Vector<const char> constructor_name,
- int argc,
- Handle<Object> argv[]);
- MUST_USE_RESULT MaybeHandle<Object> MakeExecutionState();
- MUST_USE_RESULT MaybeHandle<Object> MakeBreakEvent(
- Handle<Object> break_points_hit);
- MUST_USE_RESULT MaybeHandle<Object> MakeExceptionEvent(
- Handle<Object> exception,
- bool uncaught,
- Handle<Object> promise);
- MUST_USE_RESULT MaybeHandle<Object> MakeCompileEvent(
- Handle<Script> script, bool before);
- MUST_USE_RESULT MaybeHandle<Object> MakeScriptCollectedEvent(int id);
void CallEventCallback(v8::DebugEvent event,
Handle<Object> exec_state,
@@ -828,31 +861,18 @@ class Debugger {
void CallJSEventCallback(v8::DebugEvent event,
Handle<Object> exec_state,
Handle<Object> event_data);
- void UpdateState();
-
- void ProcessDebugEvent(v8::DebugEvent event,
- Handle<JSObject> event_data,
- bool auto_continue);
- void NotifyMessageHandler(v8::DebugEvent event,
- Handle<JSObject> exec_state,
- Handle<JSObject> event_data,
- bool auto_continue);
+ void ListenersChanged();
// Invoke the message handler function.
void InvokeMessageHandler(MessageImpl message);
- inline bool EventActive() {
- // Check whether the message handler was been cleared.
- // TODO(yangguo): handle loading and unloading of the debugger differently.
- // Currently argument event is not used.
- return !ignore_debugger_ && is_active_;
- }
-
+ RecursiveMutex debugger_access_; // Mutex guarding debugger variables.
Handle<Object> event_listener_; // Global handle to listener.
Handle<Object> event_listener_data_;
bool is_active_;
bool ignore_debugger_; // Are we temporarily ignoring the debugger?
bool live_edit_enabled_; // Enable LiveEdit.
+ bool never_unload_debugger_; // Can we unload the debugger?
v8::Debug::MessageHandler message_handler_;
bool debugger_unload_pending_; // Was message handler cleared?
@@ -891,7 +911,8 @@ class EnterDebugger BASE_EMBEDDED {
private:
Isolate* isolate_;
EnterDebugger* prev_; // Previous debugger entry if entered recursively.
- bool has_js_frames_; // Were there any JavaScript frames?
+ JavaScriptFrameIterator it_;
+ const bool has_js_frames_; // Were there any JavaScript frames?
StackFrame::Id break_frame_id_; // Previous break frame id.
int break_id_; // Previous break id.
bool load_failed_; // Did the debugger fail to load?
« no previous file with comments | « src/d8.cc ('k') | src/debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698