Chromium Code Reviews| Index: content/browser/renderer_host/compositor_begin_frame_observer_impl.h |
| diff --git a/content/browser/renderer_host/compositor_begin_frame_observer_impl.h b/content/browser/renderer_host/compositor_begin_frame_observer_impl.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..0a1d46afb8e75499f6d05372772a7bf6c82cfb75 |
| --- /dev/null |
| +++ b/content/browser/renderer_host/compositor_begin_frame_observer_impl.h |
| @@ -0,0 +1,62 @@ |
| +// Copyright 2015 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 CONTENT_BROWSER_RENDERER_HOST_COMPOSITOR_BEGIN_FRAME_OBSERVER_IMPL_H_ |
| +#define CONTENT_BROWSER_RENDERER_HOST_COMPOSITOR_BEGIN_FRAME_OBSERVER_IMPL_H_ |
| + |
| +#include "content/common/content_export.h" |
| +#include "ui/compositor/compositor.h" |
| +#include "ui/compositor/compositor_observer.h" |
| + |
| +namespace cc { |
| +struct BeginFrameArgs; |
| +} |
| + |
| +namespace content { |
| + |
| +// This is the interface from the CompositorBeginFrameObserverImpl which manages |
| +// sending BeginFrame messages. |
| +class CompositorBeginFrameObserverImplClient { |
|
danakj
2015/03/19 22:36:40
I think it's a layering weird thing to put a Compo
|
| + public: |
| + virtual void SendBeginFrame(const cc::BeginFrameArgs& args) = 0; |
| +}; |
| + |
| +// This class is used to manage all of the RenderWidgetHostView state and |
| +// functionality that is associated with BeginFrame message handling. |
| +class CONTENT_EXPORT CompositorBeginFrameObserverImpl |
| + : public ui::CompositorBeginFrameObserver { |
| + public: |
| + explicit CompositorBeginFrameObserverImpl( |
| + CompositorBeginFrameObserverImplClient* client); |
| + virtual ~CompositorBeginFrameObserverImpl(); |
| + |
| + void SetNeedsBeginFrames(bool needs_begin_frames); |
| + |
| + void SetCompositor(ui::Compositor* compositor); |
| + void ResetCompositor(); |
| + |
| + // Overridden from ui::CompositorBeginFrameObserver: |
| + void OnSendBeginFrame(const cc::BeginFrameArgs& args) override; |
| + |
| + private: |
| + void StartObservingBeginFrames(); |
| + void StopObservingBeginFrames(); |
| + |
| + // True when RenderWidget needs a BeginFrame message. |
| + bool needs_begin_frames_; |
| + |
| + // Pass |last_sent_begin_frame_args_| to compositor when |this| is added as a |
| + // CompositorBeginFrameObserver. With this, Compositor can determine whether |
| + // latest BeginFrameArgs it has sent can be used immediately or not. |
| + cc::BeginFrameArgs last_sent_begin_frame_args_; |
| + |
| + CompositorBeginFrameObserverImplClient* client_; |
| + ui::Compositor* compositor_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(CompositorBeginFrameObserverImpl); |
| +}; |
| + |
| +} // namespace content |
| + |
| +#endif // CONTENT_BROWSER_RENDERER_HOST_COMPOSITOR_BEGIN_FRAME_OBSERVER_IMPL_H_ |