Viewer App Cleanup
From Second Life Wiki
Contents |
Objectives
- Improve the stability and maintainability of the Second Life Viewer code by cleaning up the initialization and main loop code
- Move the main loop to a separate thread so that infinite loops can be detected and debugged
See Also
Tasks
Phase 1
- Create a LLAppViewer class based on LLApp
- Move class initialization and parameter parsing to LLAppViewer
- Move all error handling to LLAppViewer (errors set a flag and sleep, LLAppViewer generates the exception)
- Move all debug/info/warning/error text printing to LLAppViewer
- Print text to a buffer instead of stdio
- Send the buffer to stdio in LLAppViewer loop
- Use a proper window for viewing console text in the Viewer
- Move unheeded warnings to debugs
- Clean up info messages
- Create a LLViewerThread class based on LLThread
- Move the main loop into LLViewerThread
- Eliminate viewer.cpp
- Create proper C++ abstractions for any remaining code in viewer.cpp
- Add a 'watchdog' to LLAppViewer to detect infinite loops and trigger a crash
- Each thread needs its own watchdog
- Some thread, e.g. decode thread may be able to be safely restarted on OSX if they crash
- Ensure that the crash handler generates proper stack information for LLViewerThread
- Add a 'Debug > Test > Force Crash', 'Force Infinite Loop', and 'Force Deadlock' debug options
- Each thread needs its own watchdog
Test Plan
- Run Second Life on all platforms. Include all available hardware configurations (Intel, AMD, PPC, single processor, dual core, dual processor)
- Run frame rate tests and ensure that frame rate is at least 95% of current client's frame rate
- Ensure that the Crash reporter still works
- Test various crash scenarios:
- Force a crash using the debug option.
- Force an infinite loop using the debug option.
- Force a deadlock using the debug option.
- Ensure each crash triggers a report
- Send the report numbers to Dev so they can ensure that the crashes have the correct call stack info
- Test crashes on Windows, Mac, and Linux
- Test various crash scenarios:
- Use Client > Console > Debug Console to view debug messages while running
- Ensure that they get displayed in order
- Scan the log file after a session and look for any warnings.
- Report any warnings that show up.
- Check for any unhelpful info messages
Phase 2
- Convert to LLSD the user settings in gSavedSettings stored in settings.xml
- LLControlDef.cpp manually sets a number of gSavedSettings - these should be read in, no longer compiled into the binary
- Support multiple directories for user settings (Enable multiple users/alt accounts to have different settings, even though they share the same computer.)
- Support multiple color settings -- i.e. per user
Also:
- Examine the global variables and find those which can be turned into system settings
- Examine command line parsing strategy and change if warranted
- Identify all non-command-parsing functionality that should be removed from viewer parse_args function
Phase 3
LLViewerLogin
- Abstract the login sequence into a class
Eliminate startup.cpp
- Create proper C++ abstractions for startup using LLViewerLogin
Lightweight Client
- Create a client that logs in to Second Life without running the 3D render pipeline

