summaryrefslogtreecommitdiff
path: root/avmedia
diff options
context:
space:
mode:
authorArnaud Versini <arnaud.versini@gmail.com>2017-06-04 21:30:37 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-06-05 09:11:41 +0200
commit8fa4b0429b514c0d696ebfc2e47418292d7ec367 (patch)
treec3ecacbad389c3497c2112b635d66e7fb3bf1da1 /avmedia
parent3580f5a856514a8e2521f5ccf1e797bb25a19a90 (diff)
avmedia : Simplify Window::Window
Change-Id: Idf5dc2814d2c4eb8e3a20a0e32e08839d2e6c5f7 Reviewed-on: https://gerrit.libreoffice.org/38392 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'avmedia')
-rw-r--r--avmedia/source/win/window.cxx46
1 files changed, 11 insertions, 35 deletions
diff --git a/avmedia/source/win/window.cxx b/avmedia/source/win/window.cxx
index 9886ada2b5a1..8b31cbb2fa61 100644
--- a/avmedia/source/win/window.cxx
+++ b/avmedia/source/win/window.cxx
@@ -41,24 +41,6 @@ using namespace ::com::sun::star;
namespace avmedia { namespace win {
-static ::osl::Mutex& ImplGetOwnStaticMutex()
-{
- static ::osl::Mutex* pMutex = nullptr;
-
- if( pMutex == nullptr )
- {
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
-
- if( pMutex == nullptr )
- {
- static ::osl::Mutex aMutex;
- pMutex = &aMutex;
- }
- }
-
- return *pMutex;
-}
-
LRESULT CALLBACK MediaPlayerWndProc( HWND hWnd,UINT nMsg, WPARAM nPar1, LPARAM nPar2 )
{
Window* pWindow = reinterpret_cast<Window*>(::GetWindowLongPtr( hWnd, 0 ));
@@ -159,21 +141,18 @@ LRESULT CALLBACK MediaPlayerWndProc( HWND hWnd,UINT nMsg, WPARAM nPar1, LPARAM n
WNDCLASS* lcl_getWndClass()
{
- static WNDCLASS* s_pWndClass = nullptr;
- if ( !s_pWndClass )
- {
- s_pWndClass = new WNDCLASS;
+ WNDCLASS* s_pWndClass = new WNDCLASS;
- memset( s_pWndClass, 0, sizeof( *s_pWndClass ) );
- s_pWndClass->hInstance = GetModuleHandle( nullptr );
- s_pWndClass->cbWndExtra = sizeof( DWORD );
- s_pWndClass->lpfnWndProc = MediaPlayerWndProc;
- s_pWndClass->lpszClassName = "com_sun_star_media_PlayerWnd";
- s_pWndClass->hbrBackground = static_cast<HBRUSH>(::GetStockObject( BLACK_BRUSH ));
- s_pWndClass->hCursor = ::LoadCursor( nullptr, IDC_ARROW );
+ memset( s_pWndClass, 0, sizeof( *s_pWndClass ) );
+ s_pWndClass->hInstance = GetModuleHandle( nullptr );
+ s_pWndClass->cbWndExtra = sizeof( DWORD );
+ s_pWndClass->lpfnWndProc = MediaPlayerWndProc;
+ s_pWndClass->lpszClassName = "com_sun_star_media_PlayerWnd";
+ s_pWndClass->hbrBackground = static_cast<HBRUSH>(::GetStockObject( BLACK_BRUSH ));
+ s_pWndClass->hCursor = ::LoadCursor( nullptr, IDC_ARROW );
+
+ ::RegisterClass( s_pWndClass );
- ::RegisterClass( s_pWndClass );
- }
return s_pWndClass;
}
@@ -186,9 +165,6 @@ Window::Window( const uno::Reference< lang::XMultiServiceFactory >& rxMgr, Playe
mnParentWnd( nullptr ),
mnPointerType( awt::SystemPointer::ARROW )
{
- ::osl::MutexGuard aGuard( ImplGetOwnStaticMutex() );
-
- lcl_getWndClass();
}
Window::~Window()
@@ -285,7 +261,7 @@ void Window::ImplLayoutVideoWindow()
bool Window::create( const uno::Sequence< uno::Any >& rArguments )
{
IVideoWindow* pVideoWindow = const_cast< IVideoWindow* >( mrPlayer.getVideoWindow() );
- WNDCLASS* mpWndClass = lcl_getWndClass();
+ static WNDCLASS* mpWndClass = lcl_getWndClass();
if( !mnFrameWnd && pVideoWindow && mpWndClass )
{