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 #include "cc/trees/layer_tree_host_impl.h" | 5 #include "cc/trees/layer_tree_host_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 1442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1453 gfx::SizeF dip_size = | 1453 gfx::SizeF dip_size = |
1454 gfx::ScaleSize(device_viewport_size_, 1.f / device_scale_factor()); | 1454 gfx::ScaleSize(device_viewport_size_, 1.f / device_scale_factor()); |
1455 | 1455 |
1456 float top_offset = | 1456 float top_offset = |
1457 top_controls_manager_ ? top_controls_manager_->content_top_offset() : 0.f; | 1457 top_controls_manager_ ? top_controls_manager_->content_top_offset() : 0.f; |
1458 return gfx::SizeF(dip_size.width(), | 1458 return gfx::SizeF(dip_size.width(), |
1459 dip_size.height() - top_offset - overdraw_bottom_height_); | 1459 dip_size.height() - top_offset - overdraw_bottom_height_); |
1460 } | 1460 } |
1461 | 1461 |
1462 void LayerTreeHostImpl::DidLoseOutputSurface() { | 1462 void LayerTreeHostImpl::DidLoseOutputSurface() { |
| 1463 if (resource_provider_) |
| 1464 resource_provider_->DidLoseOutputSurface(); |
1463 // TODO(jamesr): The renderer_ check is needed to make some of the | 1465 // TODO(jamesr): The renderer_ check is needed to make some of the |
1464 // LayerTreeHostContextTest tests pass, but shouldn't be necessary (or | 1466 // LayerTreeHostContextTest tests pass, but shouldn't be necessary (or |
1465 // important) in production. We should adjust the test to not need this. | 1467 // important) in production. We should adjust the test to not need this. |
1466 if (renderer_) | 1468 if (renderer_) |
1467 client_->DidLoseOutputSurfaceOnImplThread(); | 1469 client_->DidLoseOutputSurfaceOnImplThread(); |
1468 #ifndef NDEBUG | 1470 #ifndef NDEBUG |
1469 did_lose_called_ = true; | 1471 did_lose_called_ = true; |
1470 #endif | 1472 #endif |
1471 } | 1473 } |
1472 | 1474 |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1703 bool LayerTreeHostImpl::InitializeRenderer( | 1705 bool LayerTreeHostImpl::InitializeRenderer( |
1704 scoped_ptr<OutputSurface> output_surface) { | 1706 scoped_ptr<OutputSurface> output_surface) { |
1705 #ifndef NDEBUG | 1707 #ifndef NDEBUG |
1706 DCHECK(!renderer_ || did_lose_called_); | 1708 DCHECK(!renderer_ || did_lose_called_); |
1707 #endif | 1709 #endif |
1708 | 1710 |
1709 // Since we will create a new resource provider, we cannot continue to use | 1711 // Since we will create a new resource provider, we cannot continue to use |
1710 // the old resources (i.e. render_surfaces and texture IDs). Clear them | 1712 // the old resources (i.e. render_surfaces and texture IDs). Clear them |
1711 // before we destroy the old resource provider. | 1713 // before we destroy the old resource provider. |
1712 ReleaseTreeResources(); | 1714 ReleaseTreeResources(); |
1713 if (resource_provider_) | |
1714 resource_provider_->DidLoseOutputSurface(); | |
1715 | 1715 |
1716 // Note: order is important here. | 1716 // Note: order is important here. |
1717 renderer_.reset(); | 1717 renderer_.reset(); |
1718 tile_manager_.reset(); | 1718 tile_manager_.reset(); |
1719 resource_provider_.reset(); | 1719 resource_provider_.reset(); |
1720 output_surface_.reset(); | 1720 output_surface_.reset(); |
1721 | 1721 |
1722 if (!output_surface->BindToClient(this)) | 1722 if (!output_surface->BindToClient(this)) |
1723 return false; | 1723 return false; |
1724 | 1724 |
(...skipping 1151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2876 if (evicted_ui_resources_.empty()) | 2876 if (evicted_ui_resources_.empty()) |
2877 client_->OnCanDrawStateChanged(CanDraw()); | 2877 client_->OnCanDrawStateChanged(CanDraw()); |
2878 } | 2878 } |
2879 | 2879 |
2880 void LayerTreeHostImpl::ScheduleMicroBenchmark( | 2880 void LayerTreeHostImpl::ScheduleMicroBenchmark( |
2881 scoped_ptr<MicroBenchmarkImpl> benchmark) { | 2881 scoped_ptr<MicroBenchmarkImpl> benchmark) { |
2882 micro_benchmark_controller_.ScheduleRun(benchmark.Pass()); | 2882 micro_benchmark_controller_.ScheduleRun(benchmark.Pass()); |
2883 } | 2883 } |
2884 | 2884 |
2885 } // namespace cc | 2885 } // namespace cc |
OLD | NEW |