OLD | NEW |
(Empty) | |
| 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. |
| 4 |
| 5 #ifndef CONTENT_RENDERER_GPU_RENDER_WIDGET_COMPOSITOR_DELEGATE_H_ |
| 6 #define CONTENT_RENDERER_GPU_RENDER_WIDGET_COMPOSITOR_DELEGATE_H_ |
| 7 |
| 8 #include "cc/debug/frame_timing_tracker.h" |
| 9 |
| 10 namespace blink { |
| 11 class WebWidget; |
| 12 struct WebScreenInfo; |
| 13 } |
| 14 |
| 15 namespace cc { |
| 16 class BeginFrameSource; |
| 17 class OutputSurface; |
| 18 } |
| 19 |
| 20 namespace content { |
| 21 |
| 22 // Consumers of RenderWidgetCompositor implement this delegate in order to |
| 23 // transport compositing information across processes. |
| 24 class CONTENT_EXPORT RenderWidgetCompositorDelegate { |
| 25 public: |
| 26 // Report viewport related properties during a commit from the compositor |
| 27 // thread. |
| 28 virtual void ApplyViewportDeltas( |
| 29 const gfx::Vector2dF& inner_delta, |
| 30 const gfx::Vector2dF& outer_delta, |
| 31 const gfx::Vector2dF& elastic_overscroll_delta, |
| 32 float page_scale, |
| 33 float top_controls_delta) = 0; |
| 34 |
| 35 // Notifies that the compositor has issed a BeginMainFrame. |
| 36 virtual void BeginMainFrame(double frame_time_sec) = 0; |
| 37 |
| 38 // Requests an OutputSurface to render into. |
| 39 virtual scoped_ptr<cc::OutputSurface> CreateOutputSurface(bool fallback) = 0; |
| 40 |
| 41 // Requests an external BeginFrameSource from the delegate. |
| 42 virtual scoped_ptr<cc::BeginFrameSource> CreateExternalBeginFrameSource() = 0; |
| 43 |
| 44 // Notifies that the draw commands for a committed frame have been issued. |
| 45 virtual void DidCommitAndDrawCompositorFrame() = 0; |
| 46 |
| 47 // Notifies about a compositor frame commit operation having finished. |
| 48 virtual void DidCommitCompositorFrame() = 0; |
| 49 |
| 50 // Called by the compositor when page scale animation completed. |
| 51 virtual void DidCompletePageScaleAnimation() = 0; |
| 52 |
| 53 // Notifies that the compositor has posted a swapbuffers operation to the GPU |
| 54 // process. |
| 55 virtual void DidCompleteSwapBuffers() = 0; |
| 56 |
| 57 // TODO(simonhong, fsamuel): Remove this once crbug.com/471411 is resolved. |
| 58 // Indicates whether this RenderWidgetCompositor is for an out-of-process |
| 59 // iframe or not. |
| 60 virtual bool ForOOPIF() const = 0; |
| 61 |
| 62 // Called by the compositor to forward a proto that represents serialized |
| 63 // compositor state. |
| 64 virtual void ForwardCompositorProto(const std::vector<uint8_t>& proto) = 0; |
| 65 |
| 66 // Indicates whether the RenderWidgetCompositor is about to close. |
| 67 virtual bool IsClosing() const = 0; |
| 68 |
| 69 // Called by the compositor in single-threaded mode when a swap is aborted. |
| 70 virtual void OnSwapBuffersAborted() = 0; |
| 71 |
| 72 // Called by the compositor in single-threaded mode when a swap completes. |
| 73 virtual void OnSwapBuffersComplete() = 0; |
| 74 |
| 75 // Called by the compositor in single-threaded mode when a swap is posted. |
| 76 virtual void OnSwapBuffersPosted() = 0; |
| 77 |
| 78 // Called by the compositor to request the delegate to record frame timing. |
| 79 virtual void RecordFrameTimingEvents( |
| 80 scoped_ptr<cc::FrameTimingTracker::CompositeTimingSet> composite_events, |
| 81 scoped_ptr<cc::FrameTimingTracker::MainFrameTimingSet> |
| 82 main_frame_events) = 0; |
| 83 |
| 84 // Requests that the client schedule a composite now, and calculate |
| 85 // appropriate delay for potential future frame. |
| 86 virtual void ScheduleAnimation() = 0; |
| 87 |
| 88 // Requests a visual frame-based update to the state of the delegate if there |
| 89 // an update available. |
| 90 virtual void UpdateVisualState() = 0; |
| 91 |
| 92 // Indicates that the compositor is about to begin a frame. This is primarily |
| 93 // to signal to flow control mechanisms that a frame is beginning, not to |
| 94 // perform actual painting work. |
| 95 virtual void WillBeginCompositorFrame() = 0; |
| 96 |
| 97 protected: |
| 98 virtual ~RenderWidgetCompositorDelegate() {} |
| 99 }; |
| 100 |
| 101 } // namespace content |
| 102 |
| 103 #endif // CONTENT_RENDERER_GPU_RENDER_WIDGET_COMPOSITOR_DELEGATE_H_ |
OLD | NEW |