2014-12-07 19:09:38 -05:00
|
|
|
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
|
2014-03-14 14:13:41 -04:00
|
|
|
|
|
|
|
|
/*=============================================================================
|
|
|
|
|
ProfilerModule.cpp: Implements the FProfilerModule class.
|
|
|
|
|
=============================================================================*/
|
|
|
|
|
|
|
|
|
|
#include "ProfilerPrivatePCH.h"
|
2014-10-14 22:50:06 -04:00
|
|
|
#include "SDockTab.h"
|
2014-03-14 14:13:41 -04:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Implements the FProfilerModule module.
|
|
|
|
|
*/
|
|
|
|
|
class FProfilerModule
|
|
|
|
|
: public IProfilerModule
|
|
|
|
|
{
|
|
|
|
|
public:
|
2014-06-13 06:14:46 -04:00
|
|
|
virtual TSharedRef<SWidget> CreateProfilerWindow( const ISessionManagerRef& InSessionManager, const TSharedRef<SDockTab>& ConstructUnderMajorTab ) override
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
|
|
|
|
ProfilerManager = FProfilerManager::Initialize( InSessionManager );
|
2014-04-23 20:14:38 -04:00
|
|
|
TSharedRef<SProfilerWindow> ProfilerWindow = SNew(SProfilerWindow);
|
2014-03-14 14:13:41 -04:00
|
|
|
FProfilerManager::Get()->AssignProfilerWindow( ProfilerWindow );
|
|
|
|
|
// Register OnTabClosed to handle profiler manager shutdown.
|
|
|
|
|
ConstructUnderMajorTab->SetOnTabClosed( SDockTab::FOnTabClosedCallback::CreateRaw(this, &FProfilerModule::Shutdown) );
|
|
|
|
|
|
|
|
|
|
return ProfilerWindow;
|
|
|
|
|
}
|
|
|
|
|
|
2014-06-13 06:14:46 -04:00
|
|
|
virtual void StartupModule() override
|
2014-03-14 14:13:41 -04:00
|
|
|
{}
|
|
|
|
|
|
2014-06-13 06:14:46 -04:00
|
|
|
virtual void ShutdownModule() override
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
|
|
|
|
if( FProfilerManager::Get().IsValid() )
|
|
|
|
|
{
|
|
|
|
|
FProfilerManager::Get()->Shutdown();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-06-13 06:14:46 -04:00
|
|
|
virtual bool SupportsDynamicReloading() override
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2014-06-13 06:14:46 -04:00
|
|
|
virtual TWeakPtr<class IProfilerManager> GetProfilerManager() override
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
|
|
|
|
return ProfilerManager;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
/** Shutdowns the profiler manager. */
|
|
|
|
|
void Shutdown( TSharedRef<SDockTab> TabBeingClosed )
|
|
|
|
|
{
|
|
|
|
|
FProfilerManager::Get()->Shutdown();
|
|
|
|
|
TabBeingClosed->SetOnTabClosed( SDockTab::FOnTabClosedCallback() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** A weak pointer to the global instance of the profiler manager. Will last as long as profiler window is visible. */
|
|
|
|
|
TWeakPtr<class IProfilerManager> ProfilerManager;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
IMPLEMENT_MODULE(FProfilerModule, Profiler);
|