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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 class AnimationRegistrar; | 56 class AnimationRegistrar; |
57 class AnimationHost; | 57 class AnimationHost; |
58 class BeginFrameSource; | 58 class BeginFrameSource; |
59 class HeadsUpDisplayLayer; | 59 class HeadsUpDisplayLayer; |
60 class Layer; | 60 class Layer; |
61 class LayerTreeHostImpl; | 61 class LayerTreeHostImpl; |
62 class LayerTreeHostImplClient; | 62 class LayerTreeHostImplClient; |
63 class LayerTreeHostSingleThreadClient; | 63 class LayerTreeHostSingleThreadClient; |
64 class PropertyTrees; | 64 class PropertyTrees; |
65 class Region; | 65 class Region; |
| 66 class RemoteProtoChannel; |
66 class RenderingStatsInstrumentation; | 67 class RenderingStatsInstrumentation; |
67 class ResourceProvider; | 68 class ResourceProvider; |
68 class ResourceUpdateQueue; | 69 class ResourceUpdateQueue; |
69 class SharedBitmapManager; | 70 class SharedBitmapManager; |
70 class TaskGraphRunner; | 71 class TaskGraphRunner; |
71 class TopControlsManager; | 72 class TopControlsManager; |
72 class UIResourceRequest; | 73 class UIResourceRequest; |
73 struct PendingPageScaleAnimation; | 74 struct PendingPageScaleAnimation; |
74 struct RenderingStats; | 75 struct RenderingStats; |
75 struct ScrollAndScaleSet; | 76 struct ScrollAndScaleSet; |
(...skipping 20 matching lines...) Expand all Loading... |
96 }; | 97 }; |
97 | 98 |
98 // The SharedBitmapManager will be used on the compositor thread. | 99 // The SharedBitmapManager will be used on the compositor thread. |
99 static scoped_ptr<LayerTreeHost> CreateThreaded( | 100 static scoped_ptr<LayerTreeHost> CreateThreaded( |
100 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner, | 101 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner, |
101 InitParams* params); | 102 InitParams* params); |
102 | 103 |
103 static scoped_ptr<LayerTreeHost> CreateSingleThreaded( | 104 static scoped_ptr<LayerTreeHost> CreateSingleThreaded( |
104 LayerTreeHostSingleThreadClient* single_thread_client, | 105 LayerTreeHostSingleThreadClient* single_thread_client, |
105 InitParams* params); | 106 InitParams* params); |
| 107 |
| 108 static scoped_ptr<LayerTreeHost> CreateRemoteServer( |
| 109 RemoteProtoChannel* remote_proto_channel, |
| 110 InitParams* params); |
| 111 |
| 112 // The lifetime of this LayerTreeHost is tied to the lifetime of the remote |
| 113 // server LayerTreeHost. It should be created on receiving |
| 114 // CompositorMessageToImpl::InitializeImpl message and destroyed on receiving |
| 115 // a CompositorMessageToImpl::CloseImpl message from the server. This ensures |
| 116 // that the client will not send any compositor messages once the |
| 117 // LayerTreeHost on the server is destroyed. |
| 118 static scoped_ptr<LayerTreeHost> CreateRemoteClient( |
| 119 RemoteProtoChannel* remote_proto_channel, |
| 120 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner, |
| 121 InitParams* params); |
| 122 |
106 virtual ~LayerTreeHost(); | 123 virtual ~LayerTreeHost(); |
107 | 124 |
108 // LayerTreeHost interface to Proxy. | 125 // LayerTreeHost interface to Proxy. |
109 void WillBeginMainFrame(); | 126 void WillBeginMainFrame(); |
110 void DidBeginMainFrame(); | 127 void DidBeginMainFrame(); |
111 void BeginMainFrame(const BeginFrameArgs& args); | 128 void BeginMainFrame(const BeginFrameArgs& args); |
112 void BeginMainFrameNotExpectedSoon(); | 129 void BeginMainFrameNotExpectedSoon(); |
113 void AnimateLayers(base::TimeTicks monotonic_frame_begin_time); | 130 void AnimateLayers(base::TimeTicks monotonic_frame_begin_time); |
114 void DidStopFlinging(); | 131 void DidStopFlinging(); |
115 void RequestMainFrameUpdate(); | 132 void RequestMainFrameUpdate(); |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 // Serializes the parts of this LayerTreeHost that is needed for a commit to a | 392 // Serializes the parts of this LayerTreeHost that is needed for a commit to a |
376 // protobuf message. Not all members are serialized as they are not helpful | 393 // protobuf message. Not all members are serialized as they are not helpful |
377 // for remote usage. | 394 // for remote usage. |
378 void ToProtobufForCommit(proto::LayerTreeHost* proto) const; | 395 void ToProtobufForCommit(proto::LayerTreeHost* proto) const; |
379 | 396 |
380 // Deserializes the protobuf into this LayerTreeHost before a commit. The | 397 // Deserializes the protobuf into this LayerTreeHost before a commit. The |
381 // expected input is a serialized remote LayerTreeHost. After deserializing | 398 // expected input is a serialized remote LayerTreeHost. After deserializing |
382 // the protobuf, the normal commit-flow should continue. | 399 // the protobuf, the normal commit-flow should continue. |
383 void FromProtobufForCommit(const proto::LayerTreeHost& proto); | 400 void FromProtobufForCommit(const proto::LayerTreeHost& proto); |
384 | 401 |
| 402 bool IsSingleThreaded() const; |
| 403 bool IsThreaded() const; |
| 404 bool IsRemoteServer() const; |
| 405 bool IsRemoteClient() const; |
| 406 |
385 protected: | 407 protected: |
386 LayerTreeHost(InitParams* params, CompositorMode mode); | 408 LayerTreeHost(InitParams* params, CompositorMode mode); |
387 void InitializeThreaded( | 409 void InitializeThreaded( |
388 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | 410 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
389 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner, | 411 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner, |
390 scoped_ptr<BeginFrameSource> external_begin_frame_source); | 412 scoped_ptr<BeginFrameSource> external_begin_frame_source); |
391 void InitializeSingleThreaded( | 413 void InitializeSingleThreaded( |
392 LayerTreeHostSingleThreadClient* single_thread_client, | 414 LayerTreeHostSingleThreadClient* single_thread_client, |
393 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | 415 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
394 scoped_ptr<BeginFrameSource> external_begin_frame_source); | 416 scoped_ptr<BeginFrameSource> external_begin_frame_source); |
| 417 void InitializeRemoteServer( |
| 418 RemoteProtoChannel* remote_proto_channel, |
| 419 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner); |
| 420 void InitializeRemoteClient( |
| 421 RemoteProtoChannel* remote_proto_channel, |
| 422 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
| 423 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner); |
395 void InitializeForTesting( | 424 void InitializeForTesting( |
396 scoped_ptr<TaskRunnerProvider> task_runner_provider, | 425 scoped_ptr<TaskRunnerProvider> task_runner_provider, |
397 scoped_ptr<Proxy> proxy_for_testing, | 426 scoped_ptr<Proxy> proxy_for_testing, |
398 scoped_ptr<BeginFrameSource> external_begin_frame_source); | 427 scoped_ptr<BeginFrameSource> external_begin_frame_source); |
399 void SetOutputSurfaceLostForTesting(bool is_lost) { | 428 void SetOutputSurfaceLostForTesting(bool is_lost) { |
400 output_surface_lost_ = is_lost; | 429 output_surface_lost_ = is_lost; |
401 } | 430 } |
402 void SetTaskRunnerProviderForTesting( | 431 void SetTaskRunnerProviderForTesting( |
403 scoped_ptr<TaskRunnerProvider> task_runner_provider); | 432 scoped_ptr<TaskRunnerProvider> task_runner_provider); |
404 | 433 |
(...skipping 19 matching lines...) Expand all Loading... |
424 | 453 |
425 void InitializeProxy( | 454 void InitializeProxy( |
426 scoped_ptr<Proxy> proxy, | 455 scoped_ptr<Proxy> proxy, |
427 scoped_ptr<BeginFrameSource> external_begin_frame_source); | 456 scoped_ptr<BeginFrameSource> external_begin_frame_source); |
428 | 457 |
429 bool DoUpdateLayers(Layer* root_layer); | 458 bool DoUpdateLayers(Layer* root_layer); |
430 void UpdateHudLayer(); | 459 void UpdateHudLayer(); |
431 | 460 |
432 bool AnimateLayersRecursive(Layer* current, base::TimeTicks time); | 461 bool AnimateLayersRecursive(Layer* current, base::TimeTicks time); |
433 | 462 |
434 bool IsSingleThreaded() const; | |
435 bool IsThreaded() const; | |
436 | |
437 struct UIResourceClientData { | 463 struct UIResourceClientData { |
438 UIResourceClient* client; | 464 UIResourceClient* client; |
439 gfx::Size size; | 465 gfx::Size size; |
440 }; | 466 }; |
441 | 467 |
442 using UIResourceClientMap = | 468 using UIResourceClientMap = |
443 std::unordered_map<UIResourceId, UIResourceClientData>; | 469 std::unordered_map<UIResourceId, UIResourceClientData>; |
444 UIResourceClientMap ui_resource_client_map_; | 470 UIResourceClientMap ui_resource_client_map_; |
445 int next_ui_resource_id_; | 471 int next_ui_resource_id_; |
446 | 472 |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
538 | 564 |
539 uint32_t surface_id_namespace_; | 565 uint32_t surface_id_namespace_; |
540 uint32_t next_surface_sequence_; | 566 uint32_t next_surface_sequence_; |
541 | 567 |
542 DISALLOW_COPY_AND_ASSIGN(LayerTreeHost); | 568 DISALLOW_COPY_AND_ASSIGN(LayerTreeHost); |
543 }; | 569 }; |
544 | 570 |
545 } // namespace cc | 571 } // namespace cc |
546 | 572 |
547 #endif // CC_TREES_LAYER_TREE_HOST_H_ | 573 #endif // CC_TREES_LAYER_TREE_HOST_H_ |
OLD | NEW |