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

Unified Diff: content/browser/compositor/delegated_frame_host.h

Issue 775143003: cc: Implement unified BeginFrame on aura (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add unittest 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/compositor/delegated_frame_host.h
diff --git a/content/browser/compositor/delegated_frame_host.h b/content/browser/compositor/delegated_frame_host.h
index 42ad05d6524ebcf8e9d1105324d593bc0d341c2d..fdfadee6cc270188526e5e625eebac9bd50f883a 100644
--- a/content/browser/compositor/delegated_frame_host.h
+++ b/content/browser/compositor/delegated_frame_host.h
@@ -18,7 +18,6 @@
#include "content/public/browser/render_process_host.h"
#include "ui/compositor/compositor.h"
#include "ui/compositor/compositor_observer.h"
-#include "ui/compositor/compositor_vsync_manager.h"
#include "ui/compositor/layer.h"
#include "ui/compositor/layer_owner_delegate.h"
#include "ui/gfx/geometry/rect_conversions.h"
@@ -26,6 +25,7 @@
namespace cc {
class SurfaceFactory;
enum class SurfaceDrawStatus;
+struct BeginFrameArgs;
}
namespace media {
@@ -62,9 +62,8 @@ class CONTENT_EXPORT DelegatedFrameHostClient {
const cc::CompositorFrameAck& ack) = 0;
virtual void DelegatedFrameHostOnLostCompositorResources() = 0;
- virtual void DelegatedFrameHostUpdateVSyncParameters(
- const base::TimeTicks& timebase,
- const base::TimeDelta& interval) = 0;
+ virtual void DelegatedFrameHostSendBeginFrame(
+ const cc::BeginFrameArgs& args) = 0;
};
// The DelegatedFrameHost is used to host all of the RenderWidgetHostView state
@@ -73,7 +72,7 @@ class CONTENT_EXPORT DelegatedFrameHostClient {
// the ui::Compositor associated with its DelegatedFrameHostClient.
class CONTENT_EXPORT DelegatedFrameHost
: public ui::CompositorObserver,
- public ui::CompositorVSyncManager::Observer,
+ public ui::CompositorBeginFrameObserver,
public ui::LayerOwnerDelegate,
public ImageTransportFactoryObserver,
public DelegatedFrameEvictorClient,
@@ -81,7 +80,8 @@ class CONTENT_EXPORT DelegatedFrameHost
public cc::SurfaceFactoryClient,
public base::SupportsWeakPtr<DelegatedFrameHost> {
public:
- DelegatedFrameHost(DelegatedFrameHostClient* client);
+ DelegatedFrameHost(DelegatedFrameHostClient* client,
+ bool begin_frame_scheduling_enabled);
~DelegatedFrameHost() override;
bool CanCopyToBitmap() const;
@@ -113,6 +113,7 @@ class CONTENT_EXPORT DelegatedFrameHost
scoped_ptr<RenderWidgetHostViewFrameSubscriber> subscriber);
void EndFrameSubscription();
bool HasFrameSubscriber() const { return frame_subscriber_; }
+ void OnSetNeedsBeginFrames(bool needs_begin_frames);
// Exposed for tests.
cc::DelegatedFrameProvider* FrameProviderForTesting() const {
@@ -147,6 +148,9 @@ class CONTENT_EXPORT DelegatedFrameHost
void UnlockResources();
void RequestCopyOfOutput(scoped_ptr<cc::CopyOutputRequest> request);
+ void StartObservingBeginFrames();
+ void StopObservingBeginFrames();
+
// Overridden from ui::CompositorObserver:
void OnCompositingDidCommit(ui::Compositor* compositor) override;
void OnCompositingStarted(ui::Compositor* compositor,
@@ -156,9 +160,8 @@ class CONTENT_EXPORT DelegatedFrameHost
void OnCompositingLockStateChanged(ui::Compositor* compositor) override;
void OnCompositingShuttingDown(ui::Compositor* compositor) override;
- // Overridden from ui::CompositorVSyncManager::Observer:
- void OnUpdateVSyncParameters(base::TimeTicks timebase,
- base::TimeDelta interval) override;
+ // Overridden from ui::CompositorBeginFrameObserver:
+ void OnSendBeginFrame(const cc::BeginFrameArgs& args) override;
// Overridden from ui::LayerOwnerObserver:
void OnLayerRecreated(ui::Layer* old_layer, ui::Layer* new_layer) override;
@@ -239,9 +242,6 @@ class CONTENT_EXPORT DelegatedFrameHost
std::vector<base::Closure> on_compositing_did_commit_callbacks_;
- // The vsync manager we are observing for changes, if any.
- scoped_refptr<ui::CompositorVSyncManager> vsync_manager_;
-
// The current VSync timebase and interval. These are zero until the first
// call to OnUpdateVSyncParameters().
base::TimeTicks vsync_timebase_;
@@ -318,6 +318,17 @@ class CONTENT_EXPORT DelegatedFrameHost
yuv_readback_pipeline_;
scoped_ptr<DelegatedFrameEvictor> delegated_frame_evictor_;
+
+ // True when unified BeginFrame scheduing is used.
+ bool begin_frame_scheduling_enabled_;
+
+ // True when RenderWidget needs a BeginFrame.
+ 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_;
};
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698