gecko-dev/gfx/layers/SyncObject.cpp
JerryShih 50bd333891 Bug 1357299 - P9: Do the refactoring for SyncObject. v2. r=mattwoodrow,dvander
The MLGDeviceD3D11, CompositorD3D11 and TextureClient use the same synchronization mechanism.
Create the new SyncObjectClient/Host types for reusing code.

Add SyncObject.cpp/h and create two new data types: SyncObjectClient and SyncObjectHost.
The SyncObjectClient is used for the TextureClient synchronization at client side.
The SyncObjectHost is used for the TextureHost synchronization in renderers such
as MLGDeviceD3D11 and CompositorD3D11.

MozReview-Commit-ID: 3l56WK1aZ15
2017-08-07 18:15:23 +08:00

50 lines
1.1 KiB
C++

/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "SyncObject.h"
#ifdef XP_WIN
#include "mozilla/layers/TextureD3D11.h"
#endif
namespace mozilla {
namespace layers {
already_AddRefed<SyncObjectHost>
SyncObjectHost::CreateSyncObjectHost(
#ifdef XP_WIN
ID3D11Device* aDevice
#endif
)
{
#ifdef XP_WIN
return MakeAndAddRef<SyncObjectD3D11Host>(aDevice);
#else
return nullptr;
#endif
}
already_AddRefed<SyncObjectClient>
SyncObjectClient::CreateSyncObjectClient(SyncHandle aHandle
#ifdef XP_WIN
, ID3D11Device* aDevice
#endif
)
{
if (!aHandle) {
return nullptr;
}
#ifdef XP_WIN
return MakeAndAddRef<SyncObjectD3D11Client>(aHandle, aDevice);
#else
MOZ_ASSERT_UNREACHABLE();
return nullptr;
#endif
}
} // namespace layers
} // namespace mozilla