Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(115)

Side by Side Diff: cc/trees/layer_tree_host.h

Issue 53153006: Simplify rate limiting since it's main thread shared context only (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 <list> 9 #include <list>
10 #include <string> 10 #include <string>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/basictypes.h" 13 #include "base/basictypes.h"
14 #include "base/cancelable_callback.h" 14 #include "base/cancelable_callback.h"
15 #include "base/containers/hash_tables.h" 15 #include "base/containers/hash_tables.h"
16 #include "base/memory/ref_counted.h" 16 #include "base/memory/ref_counted.h"
17 #include "base/memory/scoped_ptr.h" 17 #include "base/memory/scoped_ptr.h"
18 #include "base/memory/weak_ptr.h" 18 #include "base/memory/weak_ptr.h"
19 #include "base/time/time.h" 19 #include "base/time/time.h"
20 #include "base/timer/timer.h"
20 #include "cc/animation/animation_events.h" 21 #include "cc/animation/animation_events.h"
21 #include "cc/base/cc_export.h" 22 #include "cc/base/cc_export.h"
22 #include "cc/base/scoped_ptr_vector.h" 23 #include "cc/base/scoped_ptr_vector.h"
23 #include "cc/debug/micro_benchmark.h" 24 #include "cc/debug/micro_benchmark.h"
24 #include "cc/debug/micro_benchmark_controller.h" 25 #include "cc/debug/micro_benchmark_controller.h"
25 #include "cc/input/input_handler.h" 26 #include "cc/input/input_handler.h"
26 #include "cc/input/scrollbar.h" 27 #include "cc/input/scrollbar.h"
27 #include "cc/input/top_controls_state.h" 28 #include "cc/input/top_controls_state.h"
28 #include "cc/layers/layer_lists.h" 29 #include "cc/layers/layer_lists.h"
29 #include "cc/output/output_surface.h" 30 #include "cc/output/output_surface.h"
30 #include "cc/resources/resource_format.h" 31 #include "cc/resources/resource_format.h"
31 #include "cc/resources/scoped_ui_resource.h" 32 #include "cc/resources/scoped_ui_resource.h"
32 #include "cc/resources/ui_resource_bitmap.h" 33 #include "cc/resources/ui_resource_bitmap.h"
33 #include "cc/resources/ui_resource_client.h" 34 #include "cc/resources/ui_resource_client.h"
34 #include "cc/scheduler/rate_limiter.h"
35 #include "cc/trees/layer_tree_host_client.h" 35 #include "cc/trees/layer_tree_host_client.h"
36 #include "cc/trees/layer_tree_host_common.h" 36 #include "cc/trees/layer_tree_host_common.h"
37 #include "cc/trees/layer_tree_settings.h" 37 #include "cc/trees/layer_tree_settings.h"
38 #include "cc/trees/occlusion_tracker.h" 38 #include "cc/trees/occlusion_tracker.h"
39 #include "cc/trees/proxy.h" 39 #include "cc/trees/proxy.h"
40 #include "third_party/skia/include/core/SkColor.h" 40 #include "third_party/skia/include/core/SkColor.h"
41 #include "ui/events/latency_info.h" 41 #include "ui/events/latency_info.h"
42 #include "ui/gfx/rect.h" 42 #include "ui/gfx/rect.h"
43 43
44 namespace WebKit { class WebGraphicsContext3D; }
45
46 #if defined(COMPILER_GCC)
47 namespace BASE_HASH_NAMESPACE {
48 template <>
49 struct hash<WebKit::WebGraphicsContext3D*> {
50 size_t operator()(WebKit::WebGraphicsContext3D* ptr) const {
51 return hash<size_t>()(reinterpret_cast<size_t>(ptr));
52 }
53 };
54 } // namespace BASE_HASH_NAMESPACE
55 #endif // COMPILER
56
57 namespace cc { 44 namespace cc {
58 45
59 class AnimationRegistrar; 46 class AnimationRegistrar;
60 class HeadsUpDisplayLayer; 47 class HeadsUpDisplayLayer;
61 class Layer; 48 class Layer;
62 class LayerTreeHostImpl; 49 class LayerTreeHostImpl;
63 class LayerTreeHostImplClient; 50 class LayerTreeHostImplClient;
64 class PrioritizedResourceManager; 51 class PrioritizedResourceManager;
65 class PrioritizedResource; 52 class PrioritizedResource;
66 class Region; 53 class Region;
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 } 102 }
116 103
117 UIResourceRequest& operator=(const UIResourceRequest& request); 104 UIResourceRequest& operator=(const UIResourceRequest& request);
118 105
119 private: 106 private:
120 UIResourceRequestType type_; 107 UIResourceRequestType type_;
121 UIResourceId id_; 108 UIResourceId id_;
122 scoped_ptr<UIResourceBitmap> bitmap_; 109 scoped_ptr<UIResourceBitmap> bitmap_;
123 }; 110 };
124 111
125 class CC_EXPORT LayerTreeHost : NON_EXPORTED_BASE(public RateLimiterClient) { 112 class CC_EXPORT LayerTreeHost {
126 public: 113 public:
127 // The SharedBitmapManager will be used on the compositor thread. 114 // The SharedBitmapManager will be used on the compositor thread.
128 static scoped_ptr<LayerTreeHost> Create( 115 static scoped_ptr<LayerTreeHost> Create(
129 LayerTreeHostClient* client, 116 LayerTreeHostClient* client,
130 SharedBitmapManager* manager, 117 SharedBitmapManager* manager,
131 const LayerTreeSettings& settings, 118 const LayerTreeSettings& settings,
132 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner); 119 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner);
133 virtual ~LayerTreeHost(); 120 virtual ~LayerTreeHost();
134 121
135 void SetLayerTreeHostClientReady(); 122 void SetLayerTreeHostClientReady();
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 void StartPageScaleAnimation(gfx::Vector2d target_offset, 256 void StartPageScaleAnimation(gfx::Vector2d target_offset,
270 bool use_anchor, 257 bool use_anchor,
271 float scale, 258 float scale,
272 base::TimeDelta duration); 259 base::TimeDelta duration);
273 260
274 void ApplyScrollAndScale(const ScrollAndScaleSet& info); 261 void ApplyScrollAndScale(const ScrollAndScaleSet& info);
275 262
276 void SetImplTransform(const gfx::Transform& transform); 263 void SetImplTransform(const gfx::Transform& transform);
277 void SetLatencyInfo(const ui::LatencyInfo& latency_info); 264 void SetLatencyInfo(const ui::LatencyInfo& latency_info);
278 265
279 virtual void StartRateLimiter(WebKit::WebGraphicsContext3D* context3d); 266 // Virtual for tests.
280 virtual void StopRateLimiter(WebKit::WebGraphicsContext3D* context3d); 267 virtual void StartRateLimiter();
268 virtual void StopRateLimiter();
281 269
282 // RateLimiterClient implementation. 270 void RateLimit();
283 virtual void RateLimit() OVERRIDE;
284 271
285 bool AlwaysUsePartialTextureUpdates(); 272 bool AlwaysUsePartialTextureUpdates();
286 size_t MaxPartialTextureUpdates() const; 273 size_t MaxPartialTextureUpdates() const;
287 bool RequestPartialTextureUpdate(); 274 bool RequestPartialTextureUpdate();
288 275
289 void SetDeviceScaleFactor(float device_scale_factor); 276 void SetDeviceScaleFactor(float device_scale_factor);
290 float device_scale_factor() const { return device_scale_factor_; } 277 float device_scale_factor() const { return device_scale_factor_; }
291 278
292 void UpdateTopControlsState(TopControlsState constraints, 279 void UpdateTopControlsState(TopControlsState constraints,
293 TopControlsState current, 280 TopControlsState current,
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 397
411 const LayerTreeSettings settings_; 398 const LayerTreeSettings settings_;
412 LayerTreeDebugState debug_state_; 399 LayerTreeDebugState debug_state_;
413 400
414 gfx::Size device_viewport_size_; 401 gfx::Size device_viewport_size_;
415 float overdraw_bottom_height_; 402 float overdraw_bottom_height_;
416 float device_scale_factor_; 403 float device_scale_factor_;
417 404
418 bool visible_; 405 bool visible_;
419 406
420 typedef base::hash_map<WebKit::WebGraphicsContext3D*, 407 base::OneShotTimer<LayerTreeHost> rate_limit_timer_;
421 scoped_refptr<RateLimiter> > RateLimiterMap;
422 RateLimiterMap rate_limiters_;
423 408
424 float page_scale_factor_; 409 float page_scale_factor_;
425 float min_page_scale_factor_; 410 float min_page_scale_factor_;
426 float max_page_scale_factor_; 411 float max_page_scale_factor_;
427 gfx::Transform impl_transform_; 412 gfx::Transform impl_transform_;
428 bool trigger_idle_updates_; 413 bool trigger_idle_updates_;
429 414
430 SkColor background_color_; 415 SkColor background_color_;
431 bool has_transparent_background_; 416 bool has_transparent_background_;
432 417
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 scoped_refptr<Layer> outer_viewport_scroll_layer_; 458 scoped_refptr<Layer> outer_viewport_scroll_layer_;
474 459
475 SharedBitmapManager* shared_bitmap_manager_; 460 SharedBitmapManager* shared_bitmap_manager_;
476 461
477 DISALLOW_COPY_AND_ASSIGN(LayerTreeHost); 462 DISALLOW_COPY_AND_ASSIGN(LayerTreeHost);
478 }; 463 };
479 464
480 } // namespace cc 465 } // namespace cc
481 466
482 #endif // CC_TREES_LAYER_TREE_HOST_H_ 467 #endif // CC_TREES_LAYER_TREE_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698