blob: 3b87163dba17b8a1fad59d48107a08ef78a86376 [file] [log] [blame]
Avi Drissman4e1b7bc32022-09-15 14:03:501// Copyright 2015 The Chromium Authors
jbaumandfb4996a2015-06-03 23:38:592// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "content/browser/compositor/surface_utils.h"
6
avib7348942015-12-25 20:57:107#include "build/build_config.h"
danakj4def4a242017-06-24 01:18:378#include "components/viz/host/host_frame_sink_manager.h"
jbaumandfb4996a2015-06-03 23:38:599
Xiaohan Wang1ecfd002022-01-19 22:33:1010#if BUILDFLAG(IS_ANDROID)
Bo Liu49f304e2019-06-11 15:59:5411#include "content/browser/renderer_host/compositor_dependencies_android.h"
jbaumandfb4996a2015-06-03 23:38:5912#else
13#include "content/browser/compositor/image_transport_factory.h"
jbroman84ba6842016-04-28 00:34:5014#include "ui/compositor/compositor.h" // nogncheck
jbaumandfb4996a2015-06-03 23:38:5915#endif
16
jbaumandfb4996a2015-06-03 23:38:5917namespace content {
18
Fady Samueld5c26182017-07-12 02:43:3319viz::FrameSinkId AllocateFrameSinkId() {
Xiaohan Wang1ecfd002022-01-19 22:33:1020#if BUILDFLAG(IS_ANDROID)
Bo Liu49f304e2019-06-11 15:59:5421 return CompositorDependenciesAndroid::Get().AllocateFrameSinkId();
jbaumandfb4996a2015-06-03 23:38:5922#else
23 ImageTransportFactory* factory = ImageTransportFactory::GetInstance();
Sean Gilhulydc0b9fd2020-02-25 23:47:1424 return factory->GetContextFactory()->AllocateFrameSinkId();
jbaumandfb4996a2015-06-03 23:38:5925#endif
26}
27
danakj4def4a242017-06-24 01:18:3728viz::HostFrameSinkManager* GetHostFrameSinkManager() {
Xiaohan Wang1ecfd002022-01-19 22:33:1029#if BUILDFLAG(IS_ANDROID)
Bo Liu49f304e2019-06-11 15:59:5430 return CompositorDependenciesAndroid::Get().host_frame_sink_manager();
kylechar69bd9162017-04-10 23:45:4831#else
kylechara0900162017-07-14 17:35:2532 ImageTransportFactory* factory = ImageTransportFactory::GetInstance();
33 if (!factory)
34 return nullptr;
Sean Gilhulydc0b9fd2020-02-25 23:47:1435 return factory->GetContextFactory()->GetHostFrameSinkManager();
kylechar69bd9162017-04-10 23:45:4836#endif
37}
38
jbaumandfb4996a2015-06-03 23:38:5939} // namespace content