Chromium Code Reviews| 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 <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 "cc/animation/animation_events.h" | 20 #include "cc/animation/animation_events.h" |
| 21 #include "cc/base/cc_export.h" | 21 #include "cc/base/cc_export.h" |
| 22 #include "cc/base/scoped_ptr_vector.h" | 22 #include "cc/base/scoped_ptr_vector.h" |
| 23 #include "cc/base/swap_promise.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" |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 321 | 322 |
| 322 virtual gfx::Size GetUIResourceSize(UIResourceId id) const; | 323 virtual gfx::Size GetUIResourceSize(UIResourceId id) const; |
| 323 | 324 |
| 324 bool UsingSharedMemoryResources(); | 325 bool UsingSharedMemoryResources(); |
| 325 int id() const { return tree_id_; } | 326 int id() const { return tree_id_; } |
| 326 | 327 |
| 327 bool ScheduleMicroBenchmark(const std::string& benchmark_name, | 328 bool ScheduleMicroBenchmark(const std::string& benchmark_name, |
| 328 scoped_ptr<base::Value> value, | 329 scoped_ptr<base::Value> value, |
| 329 const MicroBenchmark::DoneCallback& callback); | 330 const MicroBenchmark::DoneCallback& callback); |
| 330 | 331 |
| 332 // Call this function when you expect there to be a swap buffer and want to | |
| 333 // have something done when the swap buffer actaully happens. Provide a | |
| 334 // did_swap_callback in the SwapPromise to be called when swap buffer happens, | |
|
jamesr
2013/11/12 03:15:04
what thread will these callbacks be invoked on?
Yufeng Shen (Slow to review)
2013/11/13 21:05:04
Please see the comments in thread_proxy.cc
| |
| 335 // and a swap_aborted_callback to be called when the swap buffer is aborted ( | |
|
jamesr
2013/11/12 03:15:04
what about when the context is lost? see LayerTree
Yufeng Shen (Slow to review)
2013/11/13 21:05:04
We started an email thread "Swap Promises" discuss
| |
| 336 // e.g. the next commit aborts, the next frame generated does not have actual | |
| 337 // damage). | |
| 338 void QueueSwapPromise(const SwapPromise& swap_promise); | |
| 339 | |
| 340 bool HasQueuedSwapPromise(); | |
| 341 void FinishSwapPromise(); | |
| 342 void BreakSwapPromise(const std::string& msg); | |
| 343 | |
| 331 protected: | 344 protected: |
| 332 LayerTreeHost(LayerTreeHostClient* client, | 345 LayerTreeHost(LayerTreeHostClient* client, |
| 333 SharedBitmapManager* manager, | 346 SharedBitmapManager* manager, |
| 334 const LayerTreeSettings& settings); | 347 const LayerTreeSettings& settings); |
| 335 bool Initialize(scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner); | 348 bool Initialize(scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner); |
| 336 bool InitializeForTesting(scoped_ptr<Proxy> proxy_for_testing); | 349 bool InitializeForTesting(scoped_ptr<Proxy> proxy_for_testing); |
| 337 void SetOutputSurfaceLostForTesting(bool is_lost) { | 350 void SetOutputSurfaceLostForTesting(bool is_lost) { |
| 338 output_surface_lost_ = is_lost; | 351 output_surface_lost_ = is_lost; |
| 339 } | 352 } |
| 340 | 353 |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 467 LCDTextMetrics lcd_text_metrics_; | 480 LCDTextMetrics lcd_text_metrics_; |
| 468 int tree_id_; | 481 int tree_id_; |
| 469 bool next_commit_forces_redraw_; | 482 bool next_commit_forces_redraw_; |
| 470 | 483 |
| 471 scoped_refptr<Layer> page_scale_layer_; | 484 scoped_refptr<Layer> page_scale_layer_; |
| 472 scoped_refptr<Layer> inner_viewport_scroll_layer_; | 485 scoped_refptr<Layer> inner_viewport_scroll_layer_; |
| 473 scoped_refptr<Layer> outer_viewport_scroll_layer_; | 486 scoped_refptr<Layer> outer_viewport_scroll_layer_; |
| 474 | 487 |
| 475 SharedBitmapManager* shared_bitmap_manager_; | 488 SharedBitmapManager* shared_bitmap_manager_; |
| 476 | 489 |
| 490 std::vector<SwapPromise> swap_promise_list_; | |
| 491 | |
| 477 DISALLOW_COPY_AND_ASSIGN(LayerTreeHost); | 492 DISALLOW_COPY_AND_ASSIGN(LayerTreeHost); |
| 478 }; | 493 }; |
| 479 | 494 |
| 480 } // namespace cc | 495 } // namespace cc |
| 481 | 496 |
| 482 #endif // CC_TREES_LAYER_TREE_HOST_H_ | 497 #endif // CC_TREES_LAYER_TREE_HOST_H_ |
| OLD | NEW |