Bug 1891710: part 2) Enable <Element-outerHTML.html> WPT for Trusted Types. r=smaug
[gecko.git] / gfx / layers / composite / CompositableHost.cpp
bloba64f55d7162becff2d3b4d61b222cc26c76c526d
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #include "CompositableHost.h"
8 #include <map> // for _Rb_tree_iterator, map, etc
9 #include <utility> // for pair
10 #include "Effects.h" // for EffectMask, Effect, etc
11 #include "gfxUtils.h"
12 #include "mozilla/gfx/gfxVars.h"
13 #include "mozilla/layers/LayersSurfaces.h" // for SurfaceDescriptor
14 #include "mozilla/layers/TextureHost.h" // for TextureHost, etc
15 #include "mozilla/layers/WebRenderImageHost.h"
16 #include "mozilla/RefPtr.h" // for nsRefPtr
17 #include "nsDebug.h" // for NS_WARNING
18 #include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR, etc
19 #include "gfxPlatform.h" // for gfxPlatform
20 #include "IPDLActor.h"
22 namespace mozilla {
24 using namespace gfx;
26 namespace layers {
28 class Compositor;
30 CompositableHost::CompositableHost(const TextureInfo& aTextureInfo)
31 : mTextureInfo(aTextureInfo), mCompositorBridgeID(0) {
32 MOZ_COUNT_CTOR(CompositableHost);
35 CompositableHost::~CompositableHost() { MOZ_COUNT_DTOR(CompositableHost); }
37 void CompositableHost::UseTextureHost(const nsTArray<TimedTexture>& aTextures) {
40 void CompositableHost::RemoveTextureHost(TextureHost* aTexture) {}
42 /* static */
43 already_AddRefed<CompositableHost> CompositableHost::Create(
44 const TextureInfo& aTextureInfo) {
45 RefPtr<CompositableHost> result;
46 switch (aTextureInfo.mCompositableType) {
47 case CompositableType::IMAGE:
48 result = new WebRenderImageHost(aTextureInfo);
49 break;
50 default:
51 NS_ERROR("Unknown CompositableType");
53 return result.forget();
56 void CompositableHost::DumpTextureHost(std::stringstream& aStream,
57 TextureHost* aTexture) {
58 if (!aTexture) {
59 return;
61 RefPtr<gfx::DataSourceSurface> dSurf = aTexture->GetAsSurface();
62 if (!dSurf) {
63 return;
65 aStream << gfxUtils::GetAsDataURI(dSurf).get();
68 } // namespace layers
69 } // namespace mozilla