| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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_TREES_LAYER_TREE_HOST_H_ | 5 #ifndef CC_TREES_LAYER_TREE_HOST_H_ |
| 6 #define CC_TREES_LAYER_TREE_HOST_H_ | 6 #define CC_TREES_LAYER_TREE_HOST_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 void WillCommit(); | 138 void WillCommit(); |
| 139 void CommitComplete(); | 139 void CommitComplete(); |
| 140 void SetOutputSurface(std::unique_ptr<OutputSurface> output_surface); | 140 void SetOutputSurface(std::unique_ptr<OutputSurface> output_surface); |
| 141 std::unique_ptr<OutputSurface> ReleaseOutputSurface(); | 141 std::unique_ptr<OutputSurface> ReleaseOutputSurface(); |
| 142 void RequestNewOutputSurface(); | 142 void RequestNewOutputSurface(); |
| 143 void DidInitializeOutputSurface(); | 143 void DidInitializeOutputSurface(); |
| 144 void DidFailToInitializeOutputSurface(); | 144 void DidFailToInitializeOutputSurface(); |
| 145 virtual std::unique_ptr<LayerTreeHostImpl> CreateLayerTreeHostImpl( | 145 virtual std::unique_ptr<LayerTreeHostImpl> CreateLayerTreeHostImpl( |
| 146 LayerTreeHostImplClient* client); | 146 LayerTreeHostImplClient* client); |
| 147 void DidLoseOutputSurface(); | 147 void DidLoseOutputSurface(); |
| 148 bool output_surface_lost() const { return output_surface_lost_; } | |
| 149 void DidCommitAndDrawFrame() { client_->DidCommitAndDrawFrame(); } | 148 void DidCommitAndDrawFrame() { client_->DidCommitAndDrawFrame(); } |
| 150 void DidCompleteSwapBuffers() { client_->DidCompleteSwapBuffers(); } | 149 void DidCompleteSwapBuffers() { client_->DidCompleteSwapBuffers(); } |
| 151 bool UpdateLayers(); | 150 bool UpdateLayers(); |
| 152 // Called when the compositor completed page scale animation. | 151 // Called when the compositor completed page scale animation. |
| 153 void DidCompletePageScaleAnimation(); | 152 void DidCompletePageScaleAnimation(); |
| 154 | 153 |
| 155 LayerTreeHostClient* client() { return client_; } | 154 LayerTreeHostClient* client() { return client_; } |
| 156 const base::WeakPtr<InputHandler>& GetInputHandler() { | 155 const base::WeakPtr<InputHandler>& GetInputHandler() { |
| 157 return input_handler_weak_ptr_; | 156 return input_handler_weak_ptr_; |
| 158 } | 157 } |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 void UpdateTopControlsState(TopControlsState constraints, | 209 void UpdateTopControlsState(TopControlsState constraints, |
| 211 TopControlsState current, | 210 TopControlsState current, |
| 212 bool animate); | 211 bool animate); |
| 213 | 212 |
| 214 Proxy* proxy() const { return proxy_.get(); } | 213 Proxy* proxy() const { return proxy_.get(); } |
| 215 TaskRunnerProvider* task_runner_provider() const { | 214 TaskRunnerProvider* task_runner_provider() const { |
| 216 return task_runner_provider_.get(); | 215 return task_runner_provider_.get(); |
| 217 } | 216 } |
| 218 AnimationHost* animation_host() const; | 217 AnimationHost* animation_host() const; |
| 219 | 218 |
| 220 bool has_output_surface() const { return !!current_output_surface_; } | |
| 221 | |
| 222 // CreateUIResource creates a resource given a bitmap. The bitmap is | 219 // CreateUIResource creates a resource given a bitmap. The bitmap is |
| 223 // generated via an interface function, which is called when initializing the | 220 // generated via an interface function, which is called when initializing the |
| 224 // resource and when the resource has been lost (due to lost context). The | 221 // resource and when the resource has been lost (due to lost context). The |
| 225 // parameter of the interface is a single boolean, which indicates whether the | 222 // parameter of the interface is a single boolean, which indicates whether the |
| 226 // resource has been lost or not. CreateUIResource returns an Id of the | 223 // resource has been lost or not. CreateUIResource returns an Id of the |
| 227 // resource, which is always positive. | 224 // resource, which is always positive. |
| 228 virtual UIResourceId CreateUIResource(UIResourceClient* client); | 225 virtual UIResourceId CreateUIResource(UIResourceClient* client); |
| 229 // Deletes a UI resource. May safely be called more than once. | 226 // Deletes a UI resource. May safely be called more than once. |
| 230 virtual void DeleteUIResource(UIResourceId id); | 227 virtual void DeleteUIResource(UIResourceId id); |
| 231 // Put the recreation of all UI resources into the resource queue after they | 228 // Put the recreation of all UI resources into the resource queue after they |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner); | 317 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner); |
| 321 void InitializeRemoteClient( | 318 void InitializeRemoteClient( |
| 322 RemoteProtoChannel* remote_proto_channel, | 319 RemoteProtoChannel* remote_proto_channel, |
| 323 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | 320 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
| 324 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner); | 321 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner); |
| 325 void InitializeForTesting( | 322 void InitializeForTesting( |
| 326 std::unique_ptr<TaskRunnerProvider> task_runner_provider, | 323 std::unique_ptr<TaskRunnerProvider> task_runner_provider, |
| 327 std::unique_ptr<Proxy> proxy_for_testing, | 324 std::unique_ptr<Proxy> proxy_for_testing, |
| 328 std::unique_ptr<BeginFrameSource> external_begin_frame_source); | 325 std::unique_ptr<BeginFrameSource> external_begin_frame_source); |
| 329 void InitializePictureCacheForTesting(); | 326 void InitializePictureCacheForTesting(); |
| 330 void SetOutputSurfaceLostForTesting(bool is_lost) { | |
| 331 output_surface_lost_ = is_lost; | |
| 332 } | |
| 333 void SetTaskRunnerProviderForTesting( | 327 void SetTaskRunnerProviderForTesting( |
| 334 std::unique_ptr<TaskRunnerProvider> task_runner_provider); | 328 std::unique_ptr<TaskRunnerProvider> task_runner_provider); |
| 335 | 329 |
| 336 // shared_bitmap_manager(), gpu_memory_buffer_manager(), and | 330 // shared_bitmap_manager(), gpu_memory_buffer_manager(), and |
| 337 // task_graph_runner() return valid values only until the LayerTreeHostImpl is | 331 // task_graph_runner() return valid values only until the LayerTreeHostImpl is |
| 338 // created in CreateLayerTreeHostImpl(). | 332 // created in CreateLayerTreeHostImpl(). |
| 339 SharedBitmapManager* shared_bitmap_manager() const { | 333 SharedBitmapManager* shared_bitmap_manager() const { |
| 340 return shared_bitmap_manager_; | 334 return shared_bitmap_manager_; |
| 341 } | 335 } |
| 342 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager() const { | 336 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager() const { |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 std::unique_ptr<RenderingStatsInstrumentation> | 394 std::unique_ptr<RenderingStatsInstrumentation> |
| 401 rendering_stats_instrumentation_; | 395 rendering_stats_instrumentation_; |
| 402 | 396 |
| 403 // |current_output_surface_| can't be updated until we've successfully | 397 // |current_output_surface_| can't be updated until we've successfully |
| 404 // initialized a new output surface. |new_output_surface_| contains the | 398 // initialized a new output surface. |new_output_surface_| contains the |
| 405 // new output surface that is currently being initialized. If initialization | 399 // new output surface that is currently being initialized. If initialization |
| 406 // is successful then |new_output_surface_| replaces | 400 // is successful then |new_output_surface_| replaces |
| 407 // |current_output_surface_|. | 401 // |current_output_surface_|. |
| 408 std::unique_ptr<OutputSurface> new_output_surface_; | 402 std::unique_ptr<OutputSurface> new_output_surface_; |
| 409 std::unique_ptr<OutputSurface> current_output_surface_; | 403 std::unique_ptr<OutputSurface> current_output_surface_; |
| 410 bool output_surface_lost_; | |
| 411 | 404 |
| 412 const LayerTreeSettings settings_; | 405 const LayerTreeSettings settings_; |
| 413 LayerTreeDebugState debug_state_; | 406 LayerTreeDebugState debug_state_; |
| 414 | 407 |
| 415 bool visible_; | 408 bool visible_; |
| 416 | 409 |
| 417 bool has_gpu_rasterization_trigger_; | 410 bool has_gpu_rasterization_trigger_; |
| 418 bool content_is_suitable_for_gpu_rasterization_; | 411 bool content_is_suitable_for_gpu_rasterization_; |
| 419 bool gpu_rasterization_histogram_recorded_; | 412 bool gpu_rasterization_histogram_recorded_; |
| 420 | 413 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 439 uint32_t surface_client_id_; | 432 uint32_t surface_client_id_; |
| 440 uint32_t next_surface_sequence_; | 433 uint32_t next_surface_sequence_; |
| 441 uint32_t num_consecutive_frames_suitable_for_gpu_ = 0; | 434 uint32_t num_consecutive_frames_suitable_for_gpu_ = 0; |
| 442 | 435 |
| 443 DISALLOW_COPY_AND_ASSIGN(LayerTreeHost); | 436 DISALLOW_COPY_AND_ASSIGN(LayerTreeHost); |
| 444 }; | 437 }; |
| 445 | 438 |
| 446 } // namespace cc | 439 } // namespace cc |
| 447 | 440 |
| 448 #endif // CC_TREES_LAYER_TREE_HOST_H_ | 441 #endif // CC_TREES_LAYER_TREE_HOST_H_ |
| OLD | NEW |