Debugger: Cleanups and improvements for status notification.

Worker/Job:
- Add job listener hooks for when work actually begins for a job,
  and when a job is suspended to wait for user input.
- Add hook for setting a job description string, and implement in several
  subclasses.

LoadImageDebugInfoJob:
- Get rid of ImageDebugInfoJobListener since its functionality can be
  handled via the more general job wait for user input hook. Refactor
  accordingly.

TeamDebugger:
- Adjust to use new job hooks. When a worker job is initiated, we now
  check if the job has a description, and if so pass it on to the UI
  to display a notification.

DwarfLoadingStateHandler:
- Notify the UI when a package download is in progress.

With these changes, the status bar now notifies the user if any of the
following actions are in flight:

1) Loading/parsing debug information
2) Stack trace retrieval
3) Source code retrieval
4) Downloading a debug info package
This commit is contained in:
Rene Gollent
2015-08-15 16:47:26 -04:00
parent 4c7fff8044
commit 9d9c74ecdb
11 changed files with 110 additions and 106 deletions
+27 -24
View File
@@ -13,6 +13,7 @@
#include <new>
#include <Entry.h>
#include <InterfaceDefs.h>
#include <Message.h>
#include <StringList.h>
@@ -1369,6 +1370,17 @@ TeamDebugger::UserInterfaceQuitRequested(QuitOption quitOption)
}
void
TeamDebugger::JobStarted(Job* job)
{
BString description(job->GetDescription());
if (!description.IsEmpty()) {
description.Append(B_UTF8_ELLIPSIS);
fUserInterface->NotifyBackgroundWorkStatus(description.String());
}
}
void
TeamDebugger::JobDone(Job* job)
{
@@ -1377,6 +1389,21 @@ TeamDebugger::JobDone(Job* job)
}
void
TeamDebugger::JobWaitingForInput(Job* job)
{
LoadImageDebugInfoJob* infoJob = dynamic_cast<LoadImageDebugInfoJob*>(job);
if (infoJob == NULL)
return;
BMessage message(MSG_DEBUG_INFO_NEEDS_USER_INPUT);
message.AddPointer("job", infoJob);
message.AddPointer("state", infoJob->GetLoadingState());
PostMessage(&message);
}
void
TeamDebugger::JobFailed(Job* job)
{
@@ -1396,30 +1423,6 @@ TeamDebugger::JobAborted(Job* job)
}
void
TeamDebugger::ImageDebugInfoJobNeedsUserInput(Job* job,
ImageDebugInfoLoadingState* state)
{
TRACE_JOBS("TeamDebugger::DebugInfoJobNeedsUserInput(%p, %p)\n",
job, state);
BMessage message(MSG_DEBUG_INFO_NEEDS_USER_INPUT);
message.AddPointer("job", job);
message.AddPointer("state", state);
PostMessage(&message);
}
void
TeamDebugger::ImageDebugInfoJobInProgress(Image* image)
{
BString message;
message.SetToFormat("Loading debug information for %s...",
image->Name().String());
fUserInterface->NotifyBackgroundWorkStatus(message.String());
}
void
TeamDebugger::ThreadStateChanged(const ::Team::ThreadEvent& event)
{