blob: d4a0eded8e90ed0a3beae1f836b4ae6e74599e7a [file] [log] [blame]
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "cc/base/cc_export.h"
namespace base {
class SingleThreadTaskRunner;
} // namespace base
namespace cc {
class CompositorProtoState;
class RemoteCompositorBridgeClient;
// The RemoteCompositorBridge is the remote LTH's communication bridge to the
// compositor on the client that consumes the CompositorProtoState updates and
// performs the actual compositing work. It is responsible for scheduling
// when a state update should be sent to the client and providing back
// mutations made to the state on the client.
class CC_EXPORT RemoteCompositorBridge {
scoped_refptr<base::SingleThreadTaskRunner> compositor_main_task_runner);
virtual ~RemoteCompositorBridge();
// Must be called exactly once before the RemoteCompositorBridge can be
// used. Once bound, the client is expected to outlive this class.
virtual void BindToClient(RemoteCompositorBridgeClient* client) = 0;
// Notifies the bridge that a main frame update is required.
virtual void ScheduleMainFrame() = 0;
// If a main frame update results in any mutations to the compositor state,
// the serialized compositor state is provided to the
// RemoteCompositorBridge.
virtual void ProcessCompositorStateUpdate(
std::unique_ptr<CompositorProtoState> compositor_proto_state) = 0;
// The task runner for the compositor's main thread. The
// RemoteCompositorBridgeClient must be called on this task runner.
scoped_refptr<base::SingleThreadTaskRunner> compositor_main_task_runner_;
} // namespace cc