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

Unified Diff: cc/output/output_surface.h

Issue 15836005: cc: Emulate BeginFrame in OutputSurfaces that don't support it natively (Closed) Base URL: http://git.chromium.org/chromium/src.git@nofrc
Patch Set: Created 7 years, 7 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: cc/output/output_surface.h
diff --git a/cc/output/output_surface.h b/cc/output/output_surface.h
index d6f4b82ed8b64d9a9d81a87d52a5b0552746c852..221b6339f2d0520292a51f60b00505ed7810fa10 100644
--- a/cc/output/output_surface.h
+++ b/cc/output/output_surface.h
@@ -9,6 +9,7 @@
#include "base/memory/scoped_ptr.h"
#include "cc/base/cc_export.h"
#include "cc/output/software_output_device.h"
+#include "cc/scheduler/frame_rate_controller.h"
#include "third_party/WebKit/public/platform/WebGraphicsContext3D.h"
namespace ui { struct LatencyInfo; }
@@ -21,8 +22,10 @@ class Size;
namespace cc {
class CompositorFrame;
+class CompositorFrameAck;
class OutputSurfaceClient;
class OutputSurfaceCallbacks;
+class Thread;
// Represents the output surface for a compositor. The compositor owns
// and manages its destruction. Its lifetime is:
@@ -31,7 +34,7 @@ class OutputSurfaceCallbacks;
// From here on, it will only be used on the compositor thread.
// 3. If the 3D context is lost, then the compositor will delete the output
// surface (on the compositor thread) and go back to step 1.
-class CC_EXPORT OutputSurface {
+class CC_EXPORT OutputSurface : public FrameRateControllerClient {
public:
explicit OutputSurface(scoped_ptr<WebKit::WebGraphicsContext3D> context3d);
@@ -79,6 +82,12 @@ class CC_EXPORT OutputSurface {
// this point on the output surface will only be used on the compositor
// thread.
virtual bool BindToClient(OutputSurfaceClient* client);
+ void InitializeBeginFrameEmulation(
+ Thread* thread,
+ bool throttle_frame_production,
+ base::TimeDelta interval,
+ int max_frames_pending,
+ bool swap_buffers_complete_supported);
// Sends frame data to the parent compositor. This should only be called when
// capabilities().has_parent_compositor. The implementation may destroy or
@@ -102,10 +111,13 @@ class CC_EXPORT OutputSurface {
// Requests a BeginFrame notification from the output surface. The
// notification will be delivered by calling
// OutputSurfaceClient::BeginFrame until the callback is disabled.
- virtual void SetNeedsBeginFrame(bool enable) {}
+ virtual void SetNeedsBeginFrame(bool enable);
- protected:
+ private:
OutputSurfaceClient* client_;
+ friend class OutputSurfaceCallbacks;
+
+ protected:
struct cc::OutputSurface::Capabilities capabilities_;
scoped_ptr<WebKit::WebGraphicsContext3D> context3d_;
scoped_ptr<cc::SoftwareOutputDevice> software_device_;
@@ -113,7 +125,23 @@ class CC_EXPORT OutputSurface {
scoped_ptr<OutputSurfaceCallbacks> callbacks_;
- private:
+ // The FrameRateController is depricated.
Sami 2013/06/03 17:30:33 Typo: deprecated.
brianderson 2013/06/03 18:51:40 Done.
+ // Platforms should move to native BeginFrames instead.
+ void OnVSyncParametersChanged(base::TimeTicks timebase,
+ base::TimeDelta interval);
+ virtual void FrameRateControllerTick(bool throttled) OVERRIDE;
+ scoped_ptr<FrameRateController> frame_rate_controller_;
+ int pending_begin_frames_;
+
+ // Forwarded to OutputSurfaceClient but threaded through OutputSurface
+ // first so OutputSurface has a chance to update the FrameRateController
+ bool hasClient() { return !!client_; }
+ void SetNeedsRedrawRect(gfx::Rect damage_rect);
+ void BeginFrame(base::TimeTicks frame_time);
+ void OnSendFrameToParentCompositorAck(const CompositorFrameAck&);
+ void OnSwapBuffersComplete();
+ void DidLoseOutputSurface();
+
DISALLOW_COPY_AND_ASSIGN(OutputSurface);
};
« no previous file with comments | « cc/cc_tests.gyp ('k') | cc/output/output_surface.cc » ('j') | cc/output/output_surface.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698