| Index: ui/base/compositor/begin_frame_manager.h
|
| diff --git a/ui/base/compositor/begin_frame_manager.h b/ui/base/compositor/begin_frame_manager.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..d30c24e36e702cc2a2b6b11b80b085650cdcd6b9
|
| --- /dev/null
|
| +++ b/ui/base/compositor/begin_frame_manager.h
|
| @@ -0,0 +1,57 @@
|
| +// Copyright 2014 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.
|
| +
|
| +#ifndef UI_BASE_COMPOSITOR_BEGIN_FRAME_MANAGER_H_
|
| +#define UI_BASE_COMPOSITOR_BEGIN_FRAME_MANAGER_H_
|
| +
|
| +#include "base/basictypes.h"
|
| +#include "base/observer_list.h"
|
| +#include "base/threading/non_thread_safe.h"
|
| +#include "base/time/time.h"
|
| +#include "ui/base/ui_base_export.h"
|
| +
|
| +namespace cc {
|
| +struct BeginFrameArgs;
|
| +}
|
| +
|
| +namespace ui {
|
| +
|
| +// This class delivers a BeginFrame request from the Compositor to its
|
| +// observers. It also handles next BeginFrame scheduling via its delegate.
|
| +// Browser compositor will own this.
|
| +// This class will be run only on main thread.
|
| +class UI_BASE_EXPORT BeginFrameManager : public base::NonThreadSafe {
|
| + public:
|
| + // Subclass should deliver BeginFrame to its client.
|
| + class Observer {
|
| + public:
|
| + virtual void OnSendBeginFrame(const cc::BeginFrameArgs& args) = 0;
|
| + };
|
| +
|
| + // Subclass should implement howto schedule next BeginFrame.
|
| + class Delegate {
|
| + public:
|
| + virtual void RequestBeginFrame() = 0;
|
| + };
|
| +
|
| + BeginFrameManager(Delegate* delegate);
|
| + ~BeginFrameManager();
|
| +
|
| + void SendBeginFrame(const cc::BeginFrameArgs& args);
|
| + void RequestBeginFrame() const;
|
| +
|
| + void AddObserver(Observer* observer);
|
| + void RemoveObserver(Observer* observer);
|
| +
|
| + private:
|
| + // Not owned by this class.
|
| + Delegate* delegate_;
|
| + ObserverList<BeginFrameManager::Observer> observer_list_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(BeginFrameManager);
|
| +};
|
| +
|
| +} // namespace ui
|
| +
|
| +#endif // UI_BASE_COMPOSITOR_BEGIN_FRAME_MANAGER_H_
|
|
|