| 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 <limits> | 8 #include <limits> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/cancelable_callback.h" | 12 #include "base/cancelable_callback.h" |
| 13 #include "base/hash_tables.h" | 13 #include "base/hash_tables.h" |
| 14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
| 15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
| 16 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
| 17 #include "base/time.h" | 17 #include "base/time.h" |
| 18 #include "cc/animation/animation_events.h" | 18 #include "cc/animation/animation_events.h" |
| 19 #include "cc/base/cc_export.h" | 19 #include "cc/base/cc_export.h" |
| 20 #include "cc/base/scoped_ptr_vector.h" | 20 #include "cc/base/scoped_ptr_vector.h" |
| 21 #include "cc/layers/layer_lists.h" | 21 #include "cc/layers/layer_lists.h" |
| 22 #include "cc/output/output_surface.h" | 22 #include "cc/output/output_surface.h" |
| 23 #include "cc/scheduler/rate_limiter.h" | 23 #include "cc/scheduler/rate_limiter.h" |
| 24 #include "cc/trees/layer_tree_host_client.h" | 24 #include "cc/trees/layer_tree_host_client.h" |
| 25 #include "cc/trees/layer_tree_host_common.h" | 25 #include "cc/trees/layer_tree_host_common.h" |
| 26 #include "cc/trees/layer_tree_settings.h" | 26 #include "cc/trees/layer_tree_settings.h" |
| 27 #include "cc/trees/occlusion_tracker.h" | 27 #include "cc/trees/occlusion_tracker.h" |
| 28 #include "cc/trees/proxy.h" | 28 #include "cc/trees/proxy.h" |
| 29 #include "skia/ext/refptr.h" | 29 #include "skia/ext/refptr.h" |
| 30 #include "third_party/WebKit/Source/Platform/chromium/public/WebScrollbar.h" |
| 30 #include "third_party/skia/include/core/SkColor.h" | 31 #include "third_party/skia/include/core/SkColor.h" |
| 31 #include "third_party/skia/include/core/SkPicture.h" | 32 #include "third_party/skia/include/core/SkPicture.h" |
| 32 #include "ui/gfx/rect.h" | 33 #include "ui/gfx/rect.h" |
| 33 | 34 |
| 34 #if defined(COMPILER_GCC) | 35 #if defined(COMPILER_GCC) |
| 35 namespace BASE_HASH_NAMESPACE { | 36 namespace BASE_HASH_NAMESPACE { |
| 36 template <> | 37 template <> |
| 37 struct hash<WebKit::WebGraphicsContext3D*> { | 38 struct hash<WebKit::WebGraphicsContext3D*> { |
| 38 size_t operator()(WebKit::WebGraphicsContext3D* ptr) const { | 39 size_t operator()(WebKit::WebGraphicsContext3D* ptr) const { |
| 39 return hash<size_t>()(reinterpret_cast<size_t>(ptr)); | 40 return hash<size_t>()(reinterpret_cast<size_t>(ptr)); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 } | 98 } |
| 98 | 99 |
| 99 // LayerTreeHost interface to Proxy. | 100 // LayerTreeHost interface to Proxy. |
| 100 void WillBeginFrame() { client_->WillBeginFrame(); } | 101 void WillBeginFrame() { client_->WillBeginFrame(); } |
| 101 void DidBeginFrame(); | 102 void DidBeginFrame(); |
| 102 void UpdateAnimations(base::TimeTicks monotonic_frame_begin_time); | 103 void UpdateAnimations(base::TimeTicks monotonic_frame_begin_time); |
| 103 void DidStopFlinging(); | 104 void DidStopFlinging(); |
| 104 void Layout(); | 105 void Layout(); |
| 105 void BeginCommitOnImplThread(LayerTreeHostImpl* host_impl); | 106 void BeginCommitOnImplThread(LayerTreeHostImpl* host_impl); |
| 106 void FinishCommitOnImplThread(LayerTreeHostImpl* host_impl); | 107 void FinishCommitOnImplThread(LayerTreeHostImpl* host_impl); |
| 108 gfx::Size PinchZoomScrollbarSize( |
| 109 WebKit::WebScrollbar::Orientation orientation) const; |
| 107 void SetPinchZoomScrollbarsBoundsAndPosition(); | 110 void SetPinchZoomScrollbarsBoundsAndPosition(); |
| 108 void CreateAndAddPinchZoomScrollbars(); | 111 void CreateAndAddPinchZoomScrollbars(); |
| 109 void WillCommit(); | 112 void WillCommit(); |
| 110 void CommitComplete(); | 113 void CommitComplete(); |
| 111 scoped_ptr<OutputSurface> CreateOutputSurface(); | 114 scoped_ptr<OutputSurface> CreateOutputSurface(); |
| 112 scoped_ptr<InputHandler> CreateInputHandler(); | 115 scoped_ptr<InputHandler> CreateInputHandler(); |
| 113 virtual scoped_ptr<LayerTreeHostImpl> CreateLayerTreeHostImpl( | 116 virtual scoped_ptr<LayerTreeHostImpl> CreateLayerTreeHostImpl( |
| 114 LayerTreeHostImplClient* client); | 117 LayerTreeHostImplClient* client); |
| 115 void DidLoseOutputSurface(); | 118 void DidLoseOutputSurface(); |
| 116 enum RecreateResult { | 119 enum RecreateResult { |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 void SetRootLayer(scoped_refptr<Layer> root_layer); | 172 void SetRootLayer(scoped_refptr<Layer> root_layer); |
| 170 Layer* root_layer() { return root_layer_.get(); } | 173 Layer* root_layer() { return root_layer_.get(); } |
| 171 const Layer* root_layer() const { return root_layer_.get(); } | 174 const Layer* root_layer() const { return root_layer_.get(); } |
| 172 const Layer* RootScrollLayer() const; | 175 const Layer* RootScrollLayer() const; |
| 173 | 176 |
| 174 const LayerTreeSettings& settings() const { return settings_; } | 177 const LayerTreeSettings& settings() const { return settings_; } |
| 175 | 178 |
| 176 void SetDebugState(const LayerTreeDebugState& debug_state); | 179 void SetDebugState(const LayerTreeDebugState& debug_state); |
| 177 const LayerTreeDebugState& debug_state() const { return debug_state_; } | 180 const LayerTreeDebugState& debug_state() const { return debug_state_; } |
| 178 | 181 |
| 179 void SetViewportSize(gfx::Size layout_viewport_size, | 182 void SetViewportSize(gfx::Size device_viewport_size); |
| 180 gfx::Size device_viewport_size); | |
| 181 void SetOverdrawBottomHeight(float overdraw_bottom_height); | 183 void SetOverdrawBottomHeight(float overdraw_bottom_height); |
| 182 | 184 |
| 183 gfx::Size layout_viewport_size() const { return layout_viewport_size_; } | |
| 184 gfx::Size device_viewport_size() const { return device_viewport_size_; } | 185 gfx::Size device_viewport_size() const { return device_viewport_size_; } |
| 185 float overdraw_bottom_height() const { return overdraw_bottom_height_; } | 186 float overdraw_bottom_height() const { return overdraw_bottom_height_; } |
| 186 | 187 |
| 187 void SetPageScaleFactorAndLimits(float page_scale_factor, | 188 void SetPageScaleFactorAndLimits(float page_scale_factor, |
| 188 float min_page_scale_factor, | 189 float min_page_scale_factor, |
| 189 float max_page_scale_factor); | 190 float max_page_scale_factor); |
| 190 | 191 |
| 191 void set_background_color(SkColor color) { background_color_ = color; } | 192 void set_background_color(SkColor color) { background_color_ = color; } |
| 192 | 193 |
| 193 void set_has_transparent_background(bool transparent) { | 194 void set_has_transparent_background(bool transparent) { |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 scoped_refptr<ScrollbarLayer> pinch_zoom_scrollbar_vertical_; | 295 scoped_refptr<ScrollbarLayer> pinch_zoom_scrollbar_vertical_; |
| 295 | 296 |
| 296 scoped_ptr<PrioritizedResourceManager> contents_texture_manager_; | 297 scoped_ptr<PrioritizedResourceManager> contents_texture_manager_; |
| 297 scoped_ptr<PrioritizedResource> surface_memory_placeholder_; | 298 scoped_ptr<PrioritizedResource> surface_memory_placeholder_; |
| 298 | 299 |
| 299 base::WeakPtr<TopControlsManager> top_controls_manager_weak_ptr_; | 300 base::WeakPtr<TopControlsManager> top_controls_manager_weak_ptr_; |
| 300 | 301 |
| 301 LayerTreeSettings settings_; | 302 LayerTreeSettings settings_; |
| 302 LayerTreeDebugState debug_state_; | 303 LayerTreeDebugState debug_state_; |
| 303 | 304 |
| 304 gfx::Size layout_viewport_size_; | |
| 305 gfx::Size device_viewport_size_; | 305 gfx::Size device_viewport_size_; |
| 306 float overdraw_bottom_height_; | 306 float overdraw_bottom_height_; |
| 307 float device_scale_factor_; | 307 float device_scale_factor_; |
| 308 | 308 |
| 309 bool visible_; | 309 bool visible_; |
| 310 | 310 |
| 311 typedef base::hash_map<WebKit::WebGraphicsContext3D*, | 311 typedef base::hash_map<WebKit::WebGraphicsContext3D*, |
| 312 scoped_refptr<RateLimiter> > RateLimiterMap; | 312 scoped_refptr<RateLimiter> > RateLimiterMap; |
| 313 RateLimiterMap rate_limiters_; | 313 RateLimiterMap rate_limiters_; |
| 314 | 314 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 332 base::TimeDelta duration; | 332 base::TimeDelta duration; |
| 333 }; | 333 }; |
| 334 scoped_ptr<PendingPageScaleAnimation> pending_page_scale_animation_; | 334 scoped_ptr<PendingPageScaleAnimation> pending_page_scale_animation_; |
| 335 | 335 |
| 336 DISALLOW_COPY_AND_ASSIGN(LayerTreeHost); | 336 DISALLOW_COPY_AND_ASSIGN(LayerTreeHost); |
| 337 }; | 337 }; |
| 338 | 338 |
| 339 } // namespace cc | 339 } // namespace cc |
| 340 | 340 |
| 341 #endif // CC_TREES_LAYER_TREE_HOST_H_ | 341 #endif // CC_TREES_LAYER_TREE_HOST_H_ |
| OLD | NEW |