1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39

content / renderer / media / win / overlay_state_service_provider.cc [blame]

// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "content/renderer/media/win/overlay_state_service_provider.h"

#include "gpu/ipc/client/gpu_channel_host.h"
#include "media/base/win/mf_helpers.h"

namespace content {

OverlayStateServiceProviderImpl::OverlayStateServiceProviderImpl(
    scoped_refptr<gpu::GpuChannelHost> channel)
    : channel_(std::move(channel)) {
  DVLOG_FUNC(1);
  DCHECK(channel_);
}

OverlayStateServiceProviderImpl::~OverlayStateServiceProviderImpl() {}

bool OverlayStateServiceProviderImpl::RegisterObserver(
    mojo::PendingRemote<gpu::mojom::OverlayStateObserver> pending_remote,
    const gpu::Mailbox& mailbox) {
  DVLOG_FUNC(1);
  bool succeeded = false;

  channel_->GetGpuChannel().RegisterOverlayStateObserver(
      std::move(pending_remote), std::move(mailbox), &succeeded);
  if (!succeeded)
    DLOG(ERROR) << "RegisterOverlayStateObserver failed";

  return succeeded;
}

bool OverlayStateServiceProviderImpl::IsLost() const {
  return channel_->IsLost();
}

}  // namespace content