blob: 5b02964e89f019c9f45798e7297c8b6380171dcf [file] [log] [blame]
// Copyright 2012 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/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "base/time/time.h"
namespace gfx {
class Vector2d;
namespace cc {
class ContextProvider;
class InputHandlerClient;
class OutputSurface;
struct BeginFrameArgs;
class LayerTreeHostClient {
virtual void WillBeginMainFrame(int frame_id) = 0;
// Marks finishing compositing-related tasks on the main thread. In threaded
// mode, this corresponds to DidCommit().
virtual void BeginMainFrame(const BeginFrameArgs& args) = 0;
virtual void DidBeginMainFrame() = 0;
virtual void Layout() = 0;
virtual void ApplyViewportDeltas(const gfx::Vector2d& inner_delta,
const gfx::Vector2d& outer_delta,
float page_scale,
float top_controls_delta) = 0;
virtual void ApplyViewportDeltas(const gfx::Vector2d& scroll_delta,
float page_scale,
float top_controls_delta) = 0;
// Request an OutputSurface from the client. When the client has one it should
// call LayerTreeHost::SetOutputSurface. If fallback is true, it should
// attempt to create an OutputSurface that is guaranteed to initialize
// correctly.
virtual void RequestNewOutputSurface(bool fallback) = 0;
virtual void DidInitializeOutputSurface() = 0;
virtual void WillCommit() = 0;
virtual void DidCommit() = 0;
virtual void DidCommitAndDrawFrame() = 0;
virtual void DidCompleteSwapBuffers() = 0;
// TODO(simonhong): Makes this to pure virtual function when client
// implementation is ready.
virtual void SendBeginFramesToChildren(const BeginFrameArgs& args) {}
// Requests that the client insert a rate limiting token in the shared main
// thread context's command stream that will block if the context gets too far
// ahead of the compositor's command stream. Only needed if the tree contains
// a TextureLayer that calls SetRateLimitContext(true).
virtual void RateLimitSharedMainThreadContext() {}
// This hook is for testing.
virtual void DidFailToInitializeOutputSurface() {}
virtual ~LayerTreeHostClient() {}
} // namespace cc