Debugger: Adjust initial configuration of VariablesView.

- VariablesView is now passed a ValueNodeManager to use at
  construction time, rather than creating one itself internally.
- Adjust TeamWindow accordingly.
This commit is contained in:
Rene Gollent 2015-11-10 09:11:02 -05:00
parent 90da71b645
commit be32382a6d
3 changed files with 18 additions and 16 deletions

View File

@ -57,6 +57,7 @@
#include "TypeComponentPath.h" #include "TypeComponentPath.h"
#include "UiUtils.h" #include "UiUtils.h"
#include "UserInterface.h" #include "UserInterface.h"
#include "ValueNodeManager.h"
#include "Value.h" #include "Value.h"
#include "Variable.h" #include "Variable.h"
#include "WatchPromptWindow.h" #include "WatchPromptWindow.h"
@ -1049,8 +1050,10 @@ TeamWindow::_Init()
// .SetInsets(0.0f) // .SetInsets(0.0f)
.Add(fBreakpointsView = BreakpointsView::Create(fTeam, this)); .Add(fBreakpointsView = BreakpointsView::Create(fTeam, this));
ValueNodeManager* manager = new ValueNodeManager;
// add local variables tab // add local variables tab
BView* tab = fVariablesView = VariablesView::Create(this); BView* tab = fVariablesView = VariablesView::Create(this, manager);
fLocalsTabView->AddTab(tab); fLocalsTabView->AddTab(tab);
// add registers tab // add registers tab

View File

@ -647,7 +647,7 @@ protected:
class VariablesView::VariableTableModel : public TreeTableModel, class VariablesView::VariableTableModel : public TreeTableModel,
public TreeTableToolTipProvider { public TreeTableToolTipProvider {
public: public:
VariableTableModel(); VariableTableModel(ValueNodeManager* manager);
~VariableTableModel(); ~VariableTableModel();
status_t Init(); status_t Init();
@ -1106,30 +1106,27 @@ VariablesView::ContainerListener::ModelNodeRestoreViewStateRequested(
// #pragma mark - VariableTableModel // #pragma mark - VariableTableModel
VariablesView::VariableTableModel::VariableTableModel() VariablesView::VariableTableModel::VariableTableModel(
ValueNodeManager* manager)
: :
fThread(NULL), fThread(NULL),
fNodeManager(NULL), fNodeManager(manager),
fContainerListener(NULL), fContainerListener(NULL),
fNodeTable() fNodeTable()
{ {
fNodeManager->AcquireReference();
} }
VariablesView::VariableTableModel::~VariableTableModel() VariablesView::VariableTableModel::~VariableTableModel()
{ {
if (fNodeManager != NULL) fNodeManager->ReleaseReference();
fNodeManager->ReleaseReference();
} }
status_t status_t
VariablesView::VariableTableModel::Init() VariablesView::VariableTableModel::Init()
{ {
fNodeManager = new(std::nothrow) ValueNodeManager();
if (fNodeManager == NULL)
return B_NO_MEMORY;
return fNodeTable.Init(); return fNodeTable.Init();
} }
@ -1809,12 +1806,12 @@ VariablesView::~VariablesView()
/*static*/ VariablesView* /*static*/ VariablesView*
VariablesView::Create(Listener* listener) VariablesView::Create(Listener* listener, ValueNodeManager* manager)
{ {
VariablesView* self = new VariablesView(listener); VariablesView* self = new VariablesView(listener);
try { try {
self->_Init(); self->_Init(manager);
} catch (...) { } catch (...) {
delete self; delete self;
throw; throw;
@ -2489,7 +2486,7 @@ VariablesView::ExpressionEvaluated(ExpressionInfo* info, status_t result,
void void
VariablesView::_Init() VariablesView::_Init(ValueNodeManager* manager)
{ {
fVariableTable = new TreeTable("variable list", 0, B_FANCY_BORDER); fVariableTable = new TreeTable("variable list", 0, B_FANCY_BORDER);
AddChild(fVariableTable->ToView()); AddChild(fVariableTable->ToView());
@ -2503,7 +2500,7 @@ VariablesView::_Init()
fVariableTable->AddColumn(new StringTableColumn(2, "Type", 80, 40, 1000, fVariableTable->AddColumn(new StringTableColumn(2, "Type", 80, 40, 1000,
B_TRUNCATE_END, B_ALIGN_LEFT)); B_TRUNCATE_END, B_ALIGN_LEFT));
fVariableTableModel = new VariableTableModel; fVariableTableModel = new VariableTableModel(manager);
if (fVariableTableModel->Init() != B_OK) if (fVariableTableModel->Init() != B_OK)
throw std::bad_alloc(); throw std::bad_alloc();
fVariableTable->SetTreeTableModel(fVariableTableModel); fVariableTable->SetTreeTableModel(fVariableTableModel);

View File

@ -26,6 +26,7 @@ class ValueLocation;
class ValueNode; class ValueNode;
class ValueNodeChild; class ValueNodeChild;
class ValueNodeContainer; class ValueNodeContainer;
class ValueNodeManager;
class Value; class Value;
class Variable; class Variable;
class VariableEditWindow; class VariableEditWindow;
@ -42,7 +43,8 @@ public:
VariablesView(Listener* listener); VariablesView(Listener* listener);
~VariablesView(); ~VariablesView();
static VariablesView* Create(Listener* listener); static VariablesView* Create(Listener* listener,
ValueNodeManager* manager);
// throws // throws
void SetStackFrame(Thread* thread, void SetStackFrame(Thread* thread,
@ -93,7 +95,7 @@ private:
ExpressionInfoTable; ExpressionInfoTable;
private: private:
void _Init(); void _Init(ValueNodeManager* manager);
void _RequestNodeValue(ModelNode* node); void _RequestNodeValue(ModelNode* node);
status_t _GetContextActionsForNode(ModelNode* node, status_t _GetContextActionsForNode(ModelNode* node,