| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_BEGIN_FRAME_OBSERVER_PROXY_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_BEGIN_FRAME_OBSERVER_PROXY_H_ |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_BEGIN_FRAME_OBSERVER_PROXY_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_BEGIN_FRAME_OBSERVER_PROXY_H_ |
| 7 | 7 |
| 8 #include "content/common/content_export.h" | 8 #include "content/common/content_export.h" |
| 9 #include "ui/compositor/compositor.h" | 9 #include "ui/compositor/compositor.h" |
| 10 #include "ui/compositor/compositor_observer.h" | 10 #include "ui/compositor/compositor_observer.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 // This class is used to manage all of the RenderWidgetHostView state and | 25 // This class is used to manage all of the RenderWidgetHostView state and |
| 26 // functionality that is associated with BeginFrame message handling. | 26 // functionality that is associated with BeginFrame message handling. |
| 27 class CONTENT_EXPORT BeginFrameObserverProxy | 27 class CONTENT_EXPORT BeginFrameObserverProxy |
| 28 : public ui::CompositorBeginFrameObserver, | 28 : public ui::CompositorBeginFrameObserver, |
| 29 public ui::CompositorObserver { | 29 public ui::CompositorObserver { |
| 30 public: | 30 public: |
| 31 explicit BeginFrameObserverProxy(BeginFrameObserverProxyClient* client); | 31 explicit BeginFrameObserverProxy(BeginFrameObserverProxyClient* client); |
| 32 ~BeginFrameObserverProxy() override; | 32 ~BeginFrameObserverProxy() override; |
| 33 | 33 |
| 34 void SetNeedsBeginFrames(bool needs_begin_frames); | 34 void SetNeedsBeginFrames(bool needs_begin_frames); |
| 35 void SetNeedsOneBeginFrame(); |
| 35 | 36 |
| 36 void SetCompositor(ui::Compositor* compositor); | 37 void SetCompositor(ui::Compositor* compositor); |
| 37 void ResetCompositor(); | 38 void ResetCompositor(); |
| 38 | 39 |
| 39 // Overridden from ui::CompositorBeginFrameObserver: | 40 // Overridden from ui::CompositorBeginFrameObserver: |
| 40 void OnSendBeginFrame(const cc::BeginFrameArgs& args) override; | 41 void OnSendBeginFrame(const cc::BeginFrameArgs& args) override; |
| 41 | 42 |
| 42 // Overridden from ui::CompositorObserver: | 43 // Overridden from ui::CompositorObserver: |
| 43 // TODO(simonhong): Stop overriding ui::CompositorObserver. We need to make | 44 // TODO(simonhong): Stop overriding ui::CompositorObserver. We need to make |
| 44 // sure that this class should be destroyed before ui::Compositor. | 45 // sure that this class should be destroyed before ui::Compositor. |
| 45 void OnCompositingDidCommit(ui::Compositor* compositor) override {} | 46 void OnCompositingDidCommit(ui::Compositor* compositor) override {} |
| 46 void OnCompositingStarted(ui::Compositor* compositor, | 47 void OnCompositingStarted(ui::Compositor* compositor, |
| 47 base::TimeTicks start_time) override {} | 48 base::TimeTicks start_time) override {} |
| 48 void OnCompositingEnded(ui::Compositor* compositor) override {} | 49 void OnCompositingEnded(ui::Compositor* compositor) override {} |
| 49 void OnCompositingAborted(ui::Compositor* compositor) override {} | 50 void OnCompositingAborted(ui::Compositor* compositor) override {} |
| 50 void OnCompositingLockStateChanged(ui::Compositor* compositor) override {} | 51 void OnCompositingLockStateChanged(ui::Compositor* compositor) override {} |
| 51 void OnCompositingShuttingDown(ui::Compositor* compositor) override; | 52 void OnCompositingShuttingDown(ui::Compositor* compositor) override; |
| 52 | 53 |
| 53 private: | 54 private: |
| 55 void UpdateBeginFrameObservation(); |
| 54 void StartObservingBeginFrames(); | 56 void StartObservingBeginFrames(); |
| 55 void StopObservingBeginFrames(); | 57 void StopObservingBeginFrames(); |
| 56 | 58 |
| 57 // True when RenderWidget needs a BeginFrame message. | 59 // True when RenderWidget needs a BeginFrame message. |
| 58 bool needs_begin_frames_; | 60 bool needs_begin_frames_; |
| 59 | 61 |
| 62 // True when the RenderWidget needs just one BeginFrame message. |
| 63 bool needs_one_begin_frame_; |
| 64 |
| 65 // Whether we're subscribed as a BeginFrame observer. |
| 66 bool observing_begin_frames_; |
| 67 |
| 60 // Used whether to send begin frame to client or not. When |args| from | 68 // Used whether to send begin frame to client or not. When |args| from |
| 61 // Compositor is different from this, send to client. | 69 // Compositor is different from this, send to client. |
| 62 cc::BeginFrameArgs last_sent_begin_frame_args_; | 70 cc::BeginFrameArgs last_sent_begin_frame_args_; |
| 63 | 71 |
| 64 BeginFrameObserverProxyClient* client_; | 72 BeginFrameObserverProxyClient* client_; |
| 65 ui::Compositor* compositor_; | 73 ui::Compositor* compositor_; |
| 66 | 74 |
| 67 DISALLOW_COPY_AND_ASSIGN(BeginFrameObserverProxy); | 75 DISALLOW_COPY_AND_ASSIGN(BeginFrameObserverProxy); |
| 68 }; | 76 }; |
| 69 | 77 |
| 70 } // namespace content | 78 } // namespace content |
| 71 | 79 |
| 72 #endif // CONTENT_BROWSER_RENDERER_HOST_BEGIN_FRAME_OBSERVER_PROXY_H_ | 80 #endif // CONTENT_BROWSER_RENDERER_HOST_BEGIN_FRAME_OBSERVER_PROXY_H_ |
| OLD | NEW |