diff --git a/src/apps/debuganalyzer/Jamfile b/src/apps/debuganalyzer/Jamfile index dc264926fa..97ce2ba4ae 100644 --- a/src/apps/debuganalyzer/Jamfile +++ b/src/apps/debuganalyzer/Jamfile @@ -7,9 +7,9 @@ Application DebugAnalyzer : DataSource.cpp DebugAnalyzer.cpp - MainModel.cpp - MainModelLoader.cpp MainWindow.cpp + Model.cpp + ModelLoader.cpp ThreadsPage.cpp : libcolumnlistview.a libdebug.so be diff --git a/src/apps/debuganalyzer/MainWindow.cpp b/src/apps/debuganalyzer/MainWindow.cpp index 6e9321c1fc..4bcbed1f97 100644 --- a/src/apps/debuganalyzer/MainWindow.cpp +++ b/src/apps/debuganalyzer/MainWindow.cpp @@ -14,9 +14,9 @@ #include #include "DataSource.h" -#include "MainModel.h" -#include "MainModelLoader.h" #include "MessageCodes.h" +#include "Model.h" +#include "ModelLoader.h" #include "ThreadsPage.h" @@ -41,7 +41,7 @@ MainWindow::MainWindow(DataSource* dataSource) // create a model loader, if we have a data source if (dataSource != NULL) - fModelLoader = new MainModelLoader(dataSource, BMessenger(this), NULL); + fModelLoader = new ModelLoader(dataSource, BMessenger(this), NULL); } @@ -59,7 +59,7 @@ MainWindow::MessageReceived(BMessage* message) case MSG_MODEL_LOADED_SUCCESSFULLY: { printf("MSG_MODEL_LOADED_SUCCESSFULLY\n"); - MainModel* model = fModelLoader->DetachModel(); + Model* model = fModelLoader->DetachModel(); delete fModelLoader; fModelLoader = NULL; @@ -113,7 +113,7 @@ MainWindow::Show() void -MainWindow::_SetModel(MainModel* model) +MainWindow::_SetModel(Model* model) { delete fModel; fModel = model; diff --git a/src/apps/debuganalyzer/MainWindow.h b/src/apps/debuganalyzer/MainWindow.h index e0b95207bd..fc9ec8b645 100644 --- a/src/apps/debuganalyzer/MainWindow.h +++ b/src/apps/debuganalyzer/MainWindow.h @@ -10,8 +10,8 @@ class BTabView; class DataSource; -class MainModel; -class MainModelLoader; +class ModelLoader; +class Model; class MainWindow : public BWindow { @@ -26,12 +26,12 @@ public: virtual void Show(); private: - void _SetModel(MainModel* model); + void _SetModel(Model* model); private: BTabView* fMainTabView; - MainModel* fModel; - MainModelLoader* fModelLoader; + Model* fModel; + ModelLoader* fModelLoader; }; diff --git a/src/apps/debuganalyzer/MainModel.cpp b/src/apps/debuganalyzer/Model.cpp similarity index 64% rename from src/apps/debuganalyzer/MainModel.cpp rename to src/apps/debuganalyzer/Model.cpp index db80c91837..6e3d3251b0 100644 --- a/src/apps/debuganalyzer/MainModel.cpp +++ b/src/apps/debuganalyzer/Model.cpp @@ -3,14 +3,14 @@ * Distributed under the terms of the MIT License. */ -#include "MainModel.h" +#include "Model.h" -MainModel::MainModel() +Model::Model() { } -MainModel::~MainModel() +Model::~Model() { } diff --git a/src/apps/debuganalyzer/MainModel.h b/src/apps/debuganalyzer/Model.h similarity index 52% rename from src/apps/debuganalyzer/MainModel.h rename to src/apps/debuganalyzer/Model.h index deee05292a..f23cdb6078 100644 --- a/src/apps/debuganalyzer/MainModel.h +++ b/src/apps/debuganalyzer/Model.h @@ -2,18 +2,18 @@ * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. * Distributed under the terms of the MIT License. */ -#ifndef MAIN_MODEL_H -#define MAIN_MODEL_H +#ifndef MODEL_H +#define MODEL_H -class MainModel { +class Model { public: - MainModel(); - ~MainModel(); + Model(); + ~Model(); private: }; -#endif // MAIN_MODEL_H +#endif // MODEL_H diff --git a/src/apps/debuganalyzer/MainModelLoader.cpp b/src/apps/debuganalyzer/ModelLoader.cpp similarity index 81% rename from src/apps/debuganalyzer/MainModelLoader.cpp rename to src/apps/debuganalyzer/ModelLoader.cpp index 4360f780a0..6690385dc8 100644 --- a/src/apps/debuganalyzer/MainModelLoader.cpp +++ b/src/apps/debuganalyzer/ModelLoader.cpp @@ -3,7 +3,7 @@ * Distributed under the terms of the MIT License. */ -#include "MainModelLoader.h" +#include "ModelLoader.h" #include #include @@ -17,11 +17,11 @@ #include #include "DataSource.h" -#include "MainModel.h" #include "MessageCodes.h" +#include "Model.h" -MainModelLoader::MainModelLoader(DataSource* dataSource, +ModelLoader::ModelLoader(DataSource* dataSource, const BMessenger& target, void* targetCookie) : fLock("main model loader"), @@ -36,7 +36,7 @@ MainModelLoader::MainModelLoader(DataSource* dataSource, } -MainModelLoader::~MainModelLoader() +ModelLoader::~ModelLoader() { if (fLoaderThread >= 0) { Abort(); @@ -49,7 +49,7 @@ MainModelLoader::~MainModelLoader() status_t -MainModelLoader::StartLoading() +ModelLoader::StartLoading() { // check initialization status_t error = fLock.InitCheck(); @@ -62,10 +62,10 @@ MainModelLoader::StartLoading() return B_BAD_VALUE; // create a model - MainModel* model = new(std::nothrow) MainModel; + Model* model = new(std::nothrow) Model; if (model == NULL) return B_NO_MEMORY; - ObjectDeleter modelDeleter(model); + ObjectDeleter modelDeleter(model); // spawn the loader thread fLoaderThread = spawn_thread(&_LoaderEntry, "main model loader", @@ -86,7 +86,7 @@ MainModelLoader::StartLoading() void -MainModelLoader::Abort() +ModelLoader::Abort() { AutoLocker locker(fLock); @@ -97,15 +97,15 @@ MainModelLoader::Abort() } -MainModel* -MainModelLoader::DetachModel() +Model* +ModelLoader::DetachModel() { AutoLocker locker(fLock); if (fModel == NULL || fLoading) return NULL; - MainModel* model = fModel; + Model* model = fModel; fModel = NULL; return model; @@ -113,24 +113,21 @@ MainModelLoader::DetachModel() /*static*/ status_t -MainModelLoader::_LoaderEntry(void* data) +ModelLoader::_LoaderEntry(void* data) { - return ((MainModelLoader*)data)->_Loader(); + return ((ModelLoader*)data)->_Loader(); } status_t -MainModelLoader::_Loader() +ModelLoader::_Loader() { -printf("MainModelLoader::_Loader()\n"); status_t error; try { error = _Load(); } catch(...) { -printf("MainModelLoader::_Loader(): caught exception\n"); error = B_ERROR; } -printf("MainModelLoader::_Loader(): _Load() done: %s\n", strerror(error)); // clean up and notify the target AutoLocker locker(fLock); @@ -157,7 +154,7 @@ printf("MainModelLoader::_Loader(): _Load() done: %s\n", strerror(error)); status_t -MainModelLoader::_Load() +ModelLoader::_Load() { // get a BDataIO from the data source BDataIO* io; @@ -174,10 +171,7 @@ MainModelLoader::_Load() error = input->SetTo(io); if (error != B_OK) -{ -printf("MainModelLoader::_Load(): initializing the debug input stream failed: %s\n", strerror(error)); return error; -} // process the events uint32 count = 0; @@ -189,10 +183,7 @@ printf("MainModelLoader::_Load(): initializing the debug input stream failed: %s const void* buffer; ssize_t bufferSize = input->ReadNextEvent(&event, &cpu, &buffer); if (bufferSize < 0) -{ -printf("MainModelLoader::_Load(): reading event failed: %s\n", strerror(bufferSize)); return bufferSize; -} if (buffer == NULL) return B_OK; @@ -212,7 +203,7 @@ printf("MainModelLoader::_Load(): reading event failed: %s\n", strerror(bufferSi status_t -MainModelLoader::_ProcessEvent(uint32 event, uint32 cpu, const void* buffer, +ModelLoader::_ProcessEvent(uint32 event, uint32 cpu, const void* buffer, size_t size) { switch (event) { diff --git a/src/apps/debuganalyzer/MainModelLoader.h b/src/apps/debuganalyzer/ModelLoader.h similarity index 83% rename from src/apps/debuganalyzer/MainModelLoader.h rename to src/apps/debuganalyzer/ModelLoader.h index 57e280da6f..2f56a8a9a0 100644 --- a/src/apps/debuganalyzer/MainModelLoader.h +++ b/src/apps/debuganalyzer/ModelLoader.h @@ -12,21 +12,21 @@ class BDataIO; class BDebugEventInputStream; class DataSource; -class MainModel; +class Model; struct system_profiler_event_header; -class MainModelLoader { +class ModelLoader { public: - MainModelLoader(DataSource* dataSource, + ModelLoader(DataSource* dataSource, const BMessenger& target, void* targetCookie); - ~MainModelLoader(); + ~ModelLoader(); status_t StartLoading(); void Abort(); - MainModel* DetachModel(); + Model* DetachModel(); private: static status_t _LoaderEntry(void* data); @@ -37,7 +37,7 @@ private: private: BLocker fLock; - MainModel* fModel; + Model* fModel; DataSource* fDataSource; BMessenger fTarget; void* fTargetCookie;