Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(996)

Unified Diff: content/browser/renderer_host/begin_frame_manager.h

Issue 1000503002: Add BeginFrameObserverProxy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add BeginFrameManager Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/begin_frame_manager.h
diff --git a/content/browser/renderer_host/begin_frame_manager.h b/content/browser/renderer_host/begin_frame_manager.h
new file mode 100644
index 0000000000000000000000000000000000000000..593b42caa575a250e38fd17d7eb4fbc9de3995f1
--- /dev/null
+++ b/content/browser/renderer_host/begin_frame_manager.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_BEGIN_FRAME_MANAGER_H_
+#define CONTENT_BROWSER_RENDERER_HOST_BEGIN_FRAME_MANAGER_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 BeginFrameManager which manages sending
+// BeginFrame messages.
+class BeginFrameManagerClient {
+ public:
+ virtual void SendBeginFrame(const cc::BeginFrameArgs& args) = 0;
+};
+
+// This class is used to manage all of the RWHV state and functionality that is
danakj 2015/03/17 18:56:45 can you spell out RenderWidgetHostView here?
simonhong 2015/03/19 15:48:46 Done.
+// associated with BeginFrame message handling.
+class CONTENT_EXPORT BeginFrameManager
brianderson 2015/03/17 22:29:32 BeginFrameManager is a somewhat ambiguous name. Wh
simonhong 2015/03/19 15:48:46 Done.
+ : public ui::CompositorBeginFrameObserver {
+ public:
+ explicit BeginFrameManager(BeginFrameManagerClient* client);
+ virtual ~BeginFrameManager();
+
+ void OnSetNeedsBeginFrames(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 can be used immediately or not.
+ cc::BeginFrameArgs last_sent_begin_frame_args_;
+
+ // Not owned.
danakj 2015/03/17 18:56:45 I think the ownership is implied by the raw pointe
simonhong 2015/03/19 15:48:46 Removed.
+ BeginFrameManagerClient* client_;
+ ui::Compositor* compositor_;
+
+ DISALLOW_COPY_AND_ASSIGN(BeginFrameManager);
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_RENDERER_HOST_BEGIN_FRAME_MANAGER_H_

Powered by Google App Engine
This is Rietveld 408576698