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

View File

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

View File

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