| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 CONTENT_RENDERER_GPU_RENDER_WIDGET_COMPOSITOR_H_ | 5 #ifndef CONTENT_RENDERER_GPU_RENDER_WIDGET_COMPOSITOR_H_ |
| 6 #define CONTENT_RENDERER_GPU_RENDER_WIDGET_COMPOSITOR_H_ | 6 #define CONTENT_RENDERER_GPU_RENDER_WIDGET_COMPOSITOR_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 void BeginMainFrame(const cc::BeginFrameArgs& args) override; | 136 void BeginMainFrame(const cc::BeginFrameArgs& args) override; |
| 137 void Layout() override; | 137 void Layout() override; |
| 138 void ApplyViewportDeltas(const gfx::Vector2d& inner_delta, | 138 void ApplyViewportDeltas(const gfx::Vector2d& inner_delta, |
| 139 const gfx::Vector2d& outer_delta, | 139 const gfx::Vector2d& outer_delta, |
| 140 const gfx::Vector2dF& elastic_overscroll_delta, | 140 const gfx::Vector2dF& elastic_overscroll_delta, |
| 141 float page_scale, | 141 float page_scale, |
| 142 float top_controls_delta) override; | 142 float top_controls_delta) override; |
| 143 void ApplyViewportDeltas(const gfx::Vector2d& scroll_delta, | 143 void ApplyViewportDeltas(const gfx::Vector2d& scroll_delta, |
| 144 float page_scale, | 144 float page_scale, |
| 145 float top_controls_delta) override; | 145 float top_controls_delta) override; |
| 146 void RequestNewOutputSurface(bool fallback) override; | 146 void RequestNewOutputSurface() override; |
| 147 void DidInitializeOutputSurface() override; | 147 void DidInitializeOutputSurface() override; |
| 148 void DidFailToInitializeOutputSurface() override; |
| 148 void WillCommit() override; | 149 void WillCommit() override; |
| 149 void DidCommit() override; | 150 void DidCommit() override; |
| 150 void DidCommitAndDrawFrame() override; | 151 void DidCommitAndDrawFrame() override; |
| 151 void DidCompleteSwapBuffers() override; | 152 void DidCompleteSwapBuffers() override; |
| 152 void RateLimitSharedMainThreadContext() override; | 153 void RateLimitSharedMainThreadContext() override; |
| 153 | 154 |
| 154 // cc::LayerTreeHostSingleThreadClient implementation. | 155 // cc::LayerTreeHostSingleThreadClient implementation. |
| 155 void ScheduleAnimation() override; | 156 void ScheduleAnimation() override; |
| 156 void DidPostSwapBuffers() override; | 157 void DidPostSwapBuffers() override; |
| 157 void DidAbortSwapBuffers() override; | 158 void DidAbortSwapBuffers() override; |
| 158 | 159 |
| 159 private: | 160 enum { |
| 161 OUTPUT_SURFACE_RETRIES_BEFORE_FALLBACK = 4, |
| 162 MAX_OUTPUT_SURFACE_RETRIES = 5, |
| 163 }; |
| 164 |
| 165 protected: |
| 160 RenderWidgetCompositor(RenderWidget* widget, bool threaded); | 166 RenderWidgetCompositor(RenderWidget* widget, bool threaded); |
| 161 | 167 |
| 162 void Initialize(cc::LayerTreeSettings settings); | 168 void Initialize(const cc::LayerTreeSettings& settings); |
| 163 | 169 |
| 170 cc::LayerTreeHost* layer_tree_host() { return layer_tree_host_.get(); } |
| 171 |
| 172 private: |
| 173 int num_failed_recreate_attempts_; |
| 164 bool threaded_; | 174 bool threaded_; |
| 165 RenderWidget* widget_; | 175 RenderWidget* widget_; |
| 166 scoped_ptr<cc::LayerTreeHost> layer_tree_host_; | 176 scoped_ptr<cc::LayerTreeHost> layer_tree_host_; |
| 167 | 177 |
| 168 scoped_ptr<cc::CopyOutputRequest> temporary_copy_output_request_; | 178 scoped_ptr<cc::CopyOutputRequest> temporary_copy_output_request_; |
| 169 | 179 |
| 170 bool send_v8_idle_notification_after_commit_; | 180 bool send_v8_idle_notification_after_commit_; |
| 171 base::TimeTicks begin_main_frame_time_; | 181 base::TimeTicks begin_main_frame_time_; |
| 172 // The time interval between BeginMainFrame calls, provided by the scheduler. | 182 // The time interval between BeginMainFrame calls, provided by the scheduler. |
| 173 base::TimeDelta begin_main_frame_interval_; | 183 base::TimeDelta begin_main_frame_interval_; |
| 184 |
| 185 base::WeakPtrFactory<RenderWidgetCompositor> weak_factory_; |
| 174 }; | 186 }; |
| 175 | 187 |
| 176 } // namespace content | 188 } // namespace content |
| 177 | 189 |
| 178 #endif // CONTENT_RENDERER_GPU_RENDER_WIDGET_COMPOSITOR_H_ | 190 #endif // CONTENT_RENDERER_GPU_RENDER_WIDGET_COMPOSITOR_H_ |
| OLD | NEW |