OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_COMPOSITOR_BEGIN_FRAME_OBSERVER_IMPL_H_ |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_COMPOSITOR_BEGIN_FRAME_OBSERVER_IMPL_H_ |
| 7 |
| 8 #include "content/common/content_export.h" |
| 9 #include "ui/compositor/compositor.h" |
| 10 #include "ui/compositor/compositor_observer.h" |
| 11 |
| 12 namespace cc { |
| 13 struct BeginFrameArgs; |
| 14 } |
| 15 |
| 16 namespace content { |
| 17 |
| 18 // This is the interface from the CompositorBeginFrameObserverImpl which manages |
| 19 // sending BeginFrame messages. |
| 20 class CompositorBeginFrameObserverImplClient { |
| 21 public: |
| 22 virtual void SendBeginFrame(const cc::BeginFrameArgs& args) = 0; |
| 23 }; |
| 24 |
| 25 // This class is used to manage all of the RenderWidgetHostView state and |
| 26 // functionality that is associated with BeginFrame message handling. |
| 27 class CONTENT_EXPORT CompositorBeginFrameObserverImpl |
| 28 : public ui::CompositorBeginFrameObserver { |
| 29 public: |
| 30 explicit CompositorBeginFrameObserverImpl( |
| 31 CompositorBeginFrameObserverImplClient* client); |
| 32 virtual ~CompositorBeginFrameObserverImpl(); |
| 33 |
| 34 void SetNeedsBeginFrames(bool needs_begin_frames); |
| 35 |
| 36 void SetCompositor(ui::Compositor* compositor); |
| 37 void ResetCompositor(); |
| 38 |
| 39 // Overridden from ui::CompositorBeginFrameObserver: |
| 40 void OnSendBeginFrame(const cc::BeginFrameArgs& args) override; |
| 41 |
| 42 private: |
| 43 void StartObservingBeginFrames(); |
| 44 void StopObservingBeginFrames(); |
| 45 |
| 46 // True when RenderWidget needs a BeginFrame message. |
| 47 bool needs_begin_frames_; |
| 48 |
| 49 // Used whether to send begin frame to client or not. When |args| from |
| 50 // Compositor is different from this, send to client. |
| 51 cc::BeginFrameArgs last_sent_begin_frame_args_; |
| 52 |
| 53 CompositorBeginFrameObserverImplClient* client_; |
| 54 ui::Compositor* compositor_; |
| 55 |
| 56 DISALLOW_COPY_AND_ASSIGN(CompositorBeginFrameObserverImpl); |
| 57 }; |
| 58 |
| 59 } // namespace content |
| 60 |
| 61 #endif // CONTENT_BROWSER_RENDERER_HOST_COMPOSITOR_BEGIN_FRAME_OBSERVER_IMPL_H_ |
OLD | NEW |