| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CC_OUTPUT_OUTPUT_SURFACE_H_ | 5 #ifndef CC_OUTPUT_OUTPUT_SURFACE_H_ |
| 6 #define CC_OUTPUT_OUTPUT_SURFACE_H_ | 6 #define CC_OUTPUT_OUTPUT_SURFACE_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 // (namely Android WebView), this is called to determine whether the software | 98 // (namely Android WebView), this is called to determine whether the software |
| 99 // device should be used on the current frame. | 99 // device should be used on the current frame. |
| 100 virtual bool ForcedDrawToSoftwareDevice() const; | 100 virtual bool ForcedDrawToSoftwareDevice() const; |
| 101 | 101 |
| 102 // Called by the compositor on the compositor thread. This is a place where | 102 // Called by the compositor on the compositor thread. This is a place where |
| 103 // thread-specific data for the output surface can be initialized, since from | 103 // thread-specific data for the output surface can be initialized, since from |
| 104 // this point on the output surface will only be used on the compositor | 104 // this point on the output surface will only be used on the compositor |
| 105 // thread. | 105 // thread. |
| 106 virtual bool BindToClient(OutputSurfaceClient* client); | 106 virtual bool BindToClient(OutputSurfaceClient* client); |
| 107 | 107 |
| 108 // Enable or disable vsync. |
| 109 void SetThrottleFrameProduction(bool enable); |
| 110 |
| 108 void InitializeBeginFrameEmulation(base::SingleThreadTaskRunner* task_runner, | 111 void InitializeBeginFrameEmulation(base::SingleThreadTaskRunner* task_runner, |
| 109 bool throttle_frame_production, | |
| 110 base::TimeDelta interval); | 112 base::TimeDelta interval); |
| 111 | 113 |
| 112 void SetMaxFramesPending(int max_frames_pending); | |
| 113 | |
| 114 virtual void EnsureBackbuffer(); | 114 virtual void EnsureBackbuffer(); |
| 115 virtual void DiscardBackbuffer(); | 115 virtual void DiscardBackbuffer(); |
| 116 | 116 |
| 117 virtual void Reshape(const gfx::Size& size, float scale_factor); | 117 virtual void Reshape(const gfx::Size& size, float scale_factor); |
| 118 virtual gfx::Size SurfaceSize() const; | 118 virtual gfx::Size SurfaceSize() const; |
| 119 | 119 |
| 120 virtual void BindFramebuffer(); | 120 virtual void BindFramebuffer(); |
| 121 | 121 |
| 122 // The implementation may destroy or steal the contents of the CompositorFrame | 122 // The implementation may destroy or steal the contents of the CompositorFrame |
| 123 // passed in (though it will not take ownership of the CompositorFrame | 123 // passed in (though it will not take ownership of the CompositorFrame |
| (...skipping 14 matching lines...) Expand all Loading... |
| 138 // Returns an estimate of the current GPU latency. When only a software | 138 // Returns an estimate of the current GPU latency. When only a software |
| 139 // device is present, returns 0. | 139 // device is present, returns 0. |
| 140 base::TimeDelta GpuLatencyEstimate(); | 140 base::TimeDelta GpuLatencyEstimate(); |
| 141 | 141 |
| 142 // Get the class capable of informing cc of hardware overlay capability. | 142 // Get the class capable of informing cc of hardware overlay capability. |
| 143 OverlayCandidateValidator* overlay_candidate_validator() const { | 143 OverlayCandidateValidator* overlay_candidate_validator() const { |
| 144 return overlay_candidate_validator_.get(); | 144 return overlay_candidate_validator_.get(); |
| 145 } | 145 } |
| 146 | 146 |
| 147 protected: | 147 protected: |
| 148 bool is_lost_; |
| 149 |
| 148 // Synchronously initialize context3d and enter hardware mode. | 150 // Synchronously initialize context3d and enter hardware mode. |
| 149 // This can only supported in threaded compositing mode. | 151 // This can only supported in threaded compositing mode. |
| 150 // |offscreen_context_provider| should match what is returned by | 152 // |offscreen_context_provider| should match what is returned by |
| 151 // LayerTreeClient::OffscreenContextProvider(). | 153 // LayerTreeClient::OffscreenContextProvider(). |
| 152 bool InitializeAndSetContext3d( | 154 bool InitializeAndSetContext3d( |
| 153 scoped_refptr<ContextProvider> context_provider, | 155 scoped_refptr<ContextProvider> context_provider, |
| 154 scoped_refptr<ContextProvider> offscreen_context_provider); | 156 scoped_refptr<ContextProvider> offscreen_context_provider); |
| 155 void ReleaseGL(); | 157 void ReleaseGL(); |
| 156 | 158 |
| 157 void PostSwapBuffersComplete(); | 159 void PostSwapBuffersComplete(); |
| 158 | 160 |
| 159 struct OutputSurface::Capabilities capabilities_; | 161 struct OutputSurface::Capabilities capabilities_; |
| 160 scoped_refptr<ContextProvider> context_provider_; | 162 scoped_refptr<ContextProvider> context_provider_; |
| 161 scoped_ptr<SoftwareOutputDevice> software_device_; | 163 scoped_ptr<SoftwareOutputDevice> software_device_; |
| 162 scoped_ptr<OverlayCandidateValidator> overlay_candidate_validator_; | 164 scoped_ptr<OverlayCandidateValidator> overlay_candidate_validator_; |
| 163 gfx::Size surface_size_; | 165 gfx::Size surface_size_; |
| 164 float device_scale_factor_; | 166 float device_scale_factor_; |
| 167 base::TimeDelta begin_frame_interval_; |
| 165 | 168 |
| 166 // The FrameRateController is deprecated. | 169 // The FrameRateController is deprecated. |
| 167 // Platforms should move to native BeginFrames instead. | 170 // Platforms should move to native BeginFrames instead. |
| 168 void CommitVSyncParameters(base::TimeTicks timebase, | 171 void CommitVSyncParameters(base::TimeTicks timebase, |
| 169 base::TimeDelta interval); | 172 base::TimeDelta interval); |
| 170 virtual void FrameRateControllerTick(bool throttled, | 173 virtual void FrameRateControllerTick(const BeginFrameArgs& args) OVERRIDE; |
| 171 const BeginFrameArgs& args) OVERRIDE; | |
| 172 scoped_ptr<FrameRateController> frame_rate_controller_; | 174 scoped_ptr<FrameRateController> frame_rate_controller_; |
| 173 int max_frames_pending_; | 175 |
| 174 int pending_swap_buffers_; | 176 bool throttle_frame_production_; |
| 175 bool needs_begin_frame_; | 177 bool needs_begin_frame_; |
| 176 bool client_ready_for_begin_frame_; | 178 bool client_ready_for_begin_frame_; |
| 177 | 179 |
| 178 // This stores a BeginFrame that we couldn't process immediately, | 180 // This stores a BeginFrame that we couldn't process immediately, |
| 179 // but might process retroactively in the near future. | 181 // but might process retroactively in the near future. |
| 180 BeginFrameArgs skipped_begin_frame_args_; | 182 BeginFrameArgs skipped_begin_frame_args_; |
| 181 | 183 |
| 182 // Forwarded to OutputSurfaceClient but threaded through OutputSurface | 184 // Forwarded to OutputSurfaceClient but threaded through OutputSurface |
| 183 // first so OutputSurface has a chance to update the FrameRateController | 185 // first so OutputSurface has a chance to update the FrameRateController |
| 184 void SetNeedsRedrawRect(const gfx::Rect& damage_rect); | 186 void SetNeedsRedrawRect(const gfx::Rect& damage_rect); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 std::deque<unsigned> available_gpu_latency_query_ids_; | 219 std::deque<unsigned> available_gpu_latency_query_ids_; |
| 218 std::deque<unsigned> pending_gpu_latency_query_ids_; | 220 std::deque<unsigned> pending_gpu_latency_query_ids_; |
| 219 RollingTimeDeltaHistory gpu_latency_history_; | 221 RollingTimeDeltaHistory gpu_latency_history_; |
| 220 | 222 |
| 221 DISALLOW_COPY_AND_ASSIGN(OutputSurface); | 223 DISALLOW_COPY_AND_ASSIGN(OutputSurface); |
| 222 }; | 224 }; |
| 223 | 225 |
| 224 } // namespace cc | 226 } // namespace cc |
| 225 | 227 |
| 226 #endif // CC_OUTPUT_OUTPUT_SURFACE_H_ | 228 #endif // CC_OUTPUT_OUTPUT_SURFACE_H_ |
| OLD | NEW |