Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

matdbg: refactor EDIT command #7255

Merged
merged 1 commit into from
Oct 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion libs/matdbg/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ set(PUBLIC_HDRS
)

set(SRCS
src/ApiHandler.cpp
src/ApiHandler.h
src/CommonWriter.h
src/CommonWriter.cpp
src/DebugServer.cpp
Expand Down Expand Up @@ -59,7 +61,6 @@ endif()
set(DUMMY_SRC "${RESOURCE_DIR}/dummy.c")
add_custom_command(OUTPUT ${DUMMY_SRC} COMMAND echo "//" > ${DUMMY_SRC})


add_library(matdbg_resources ${DUMMY_SRC} ${RESGEN_SOURCE})
set_target_properties(matdbg_resources PROPERTIES FOLDER Libs)

Expand Down
33 changes: 17 additions & 16 deletions libs/matdbg/include/matdbg/DebugServer.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,19 @@

class CivetServer;

namespace filament {
namespace matdbg {
namespace filament::matdbg {

using MaterialKey = uint32_t;

struct MaterialRecord {
void* userdata;
const uint8_t* package;
size_t packageSize;
utils::CString name;
MaterialKey key;
VariantList activeVariants;
};

/**
* Server-side material debugger.
*
Expand All @@ -41,6 +49,9 @@ using MaterialKey = uint32_t;
*/
class DebugServer {
public:
static std::string_view const kSuccessHeader;
static std::string_view const kErrorHeader;

DebugServer(backend::Backend backend, int port);
~DebugServer();

Expand Down Expand Up @@ -74,16 +85,7 @@ class DebugServer {
bool isReady() const { return mServer; }

private:
struct MaterialRecord {
void* userdata;
const uint8_t* package;
size_t packageSize;
utils::CString name;
MaterialKey key;
VariantList activeVariants;
};

const MaterialRecord* getRecord(const MaterialKey& key) const;
MaterialRecord const* getRecord(const MaterialKey& key) const;

void updateActiveVariants();

Expand All @@ -109,15 +111,14 @@ class DebugServer {
QueryCallback mQueryCallback = nullptr;

class FileRequestHandler* mFileHandler = nullptr;
class RestRequestHandler* mRestHandler = nullptr;
class ApiHandler* mApiHandler = nullptr;
class WebSocketHandler* mWebSocketHandler = nullptr;

friend class FileRequestHandler;
friend class RestRequestHandler;
friend class ApiHandler;
friend class WebSocketHandler;
};

} // namespace matdbg
} // namespace filament
} // namespace filament::matdbg

#endif // MATDBG_DEBUGSERVER_H
Loading
Loading