Simplify ChildProcessLauncher
[chromium-blink-merge.git] / content / browser / renderer_host / begin_frame_observer_proxy.h
blobfd2aa6d7a06f9507033048bfc843906e60c3b719
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.
5 #ifndef CONTENT_BROWSER_RENDERER_HOST_BEGIN_FRAME_OBSERVER_PROXY_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_BEGIN_FRAME_OBSERVER_PROXY_H_
8 #include "content/common/content_export.h"
9 #include "ui/compositor/compositor.h"
10 #include "ui/compositor/compositor_observer.h"
12 namespace cc {
13 struct BeginFrameArgs;
16 namespace content {
18 // This is the interface from the BeginFrameObserverProxy which manages sending
19 // BeginFrame messages.
20 class BeginFrameObserverProxyClient {
21 public:
22 virtual void SendBeginFrame(const cc::BeginFrameArgs& args) = 0;
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 BeginFrameObserverProxy
28 : public ui::CompositorBeginFrameObserver {
29 public:
30 explicit BeginFrameObserverProxy(BeginFrameObserverProxyClient* client);
31 ~BeginFrameObserverProxy() override;
33 void SetNeedsBeginFrames(bool needs_begin_frames);
35 void SetCompositor(ui::Compositor* compositor);
36 void ResetCompositor();
38 // Overridden from ui::CompositorBeginFrameObserver:
39 void OnSendBeginFrame(const cc::BeginFrameArgs& args) override;
41 private:
42 void StartObservingBeginFrames();
43 void StopObservingBeginFrames();
45 // True when RenderWidget needs a BeginFrame message.
46 bool needs_begin_frames_;
48 // Used whether to send begin frame to client or not. When |args| from
49 // Compositor is different from this, send to client.
50 cc::BeginFrameArgs last_sent_begin_frame_args_;
52 BeginFrameObserverProxyClient* client_;
53 ui::Compositor* compositor_;
55 DISALLOW_COPY_AND_ASSIGN(BeginFrameObserverProxy);
58 } // namespace content
60 #endif // CONTENT_BROWSER_RENDERER_HOST_BEGIN_FRAME_OBSERVER_PROXY_H_