| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 2342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2353 // Since the new context may be capable of MSAA, update status here. We don't | 2353 // Since the new context may be capable of MSAA, update status here. We don't |
| 2354 // need to check the return value since we are recreating all resources | 2354 // need to check the return value since we are recreating all resources |
| 2355 // already. | 2355 // already. |
| 2356 UpdateGpuRasterizationStatus(); | 2356 UpdateGpuRasterizationStatus(); |
| 2357 | 2357 |
| 2358 CreateAndSetRenderer(); | 2358 CreateAndSetRenderer(); |
| 2359 | 2359 |
| 2360 CreateTileManagerResources(); | 2360 CreateTileManagerResources(); |
| 2361 RecreateTreeResources(); | 2361 RecreateTreeResources(); |
| 2362 | 2362 |
| 2363 // Initialize vsync parameters to sane values. |
| 2364 const base::TimeDelta display_refresh_interval = |
| 2365 base::TimeDelta::FromMicroseconds( |
| 2366 base::Time::kMicrosecondsPerSecond / |
| 2367 settings_.renderer_settings.refresh_rate); |
| 2368 CommitVSyncParameters(base::TimeTicks(), display_refresh_interval); |
| 2369 |
| 2363 // TODO(brianderson): Don't use a hard-coded parent draw time. | 2370 // TODO(brianderson): Don't use a hard-coded parent draw time. |
| 2364 base::TimeDelta parent_draw_time = | 2371 base::TimeDelta parent_draw_time = |
| 2365 (!settings_.use_external_begin_frame_source && | 2372 (!settings_.use_external_begin_frame_source && |
| 2366 output_surface_->capabilities().adjust_deadline_for_parent) | 2373 output_surface_->capabilities().adjust_deadline_for_parent) |
| 2367 ? BeginFrameArgs::DefaultEstimatedParentDrawTime() | 2374 ? BeginFrameArgs::DefaultEstimatedParentDrawTime() |
| 2368 : base::TimeDelta(); | 2375 : base::TimeDelta(); |
| 2369 client_->SetEstimatedParentDrawTime(parent_draw_time); | 2376 client_->SetEstimatedParentDrawTime(parent_draw_time); |
| 2370 | 2377 |
| 2371 DCHECK_EQ(1, output_surface_->capabilities().max_frames_pending); | 2378 DCHECK_EQ(1, output_surface_->capabilities().max_frames_pending); |
| 2372 client_->OnCanDrawStateChanged(CanDraw()); | 2379 client_->OnCanDrawStateChanged(CanDraw()); |
| 2373 | 2380 |
| 2374 // There will not be anything to draw here, so set high res | 2381 // There will not be anything to draw here, so set high res |
| 2375 // to avoid checkerboards, typically when we are recovering | 2382 // to avoid checkerboards, typically when we are recovering |
| 2376 // from lost context. | 2383 // from lost context. |
| 2377 // TODO(crbug.com/469175): Replace with RequiresHighResToDraw. | 2384 // TODO(crbug.com/469175): Replace with RequiresHighResToDraw. |
| 2378 SetRequiresHighResToDraw(); | 2385 SetRequiresHighResToDraw(); |
| 2379 | 2386 |
| 2380 return true; | 2387 return true; |
| 2381 } | 2388 } |
| 2382 | 2389 |
| 2390 void LayerTreeHostImpl::CommitVSyncParameters(base::TimeTicks timebase, |
| 2391 base::TimeDelta interval) { |
| 2392 client_->CommitVSyncParameters(timebase, interval); |
| 2393 } |
| 2394 |
| 2383 void LayerTreeHostImpl::SetBeginFrameSource(BeginFrameSource* source) { | 2395 void LayerTreeHostImpl::SetBeginFrameSource(BeginFrameSource* source) { |
| 2384 client_->SetBeginFrameSource(source); | 2396 client_->SetBeginFrameSource(source); |
| 2385 } | 2397 } |
| 2386 | 2398 |
| 2387 void LayerTreeHostImpl::SetViewportSize(const gfx::Size& device_viewport_size) { | 2399 void LayerTreeHostImpl::SetViewportSize(const gfx::Size& device_viewport_size) { |
| 2388 if (device_viewport_size == device_viewport_size_) | 2400 if (device_viewport_size == device_viewport_size_) |
| 2389 return; | 2401 return; |
| 2390 TRACE_EVENT_INSTANT2("cc", "LayerTreeHostImpl::SetViewportSize", | 2402 TRACE_EVENT_INSTANT2("cc", "LayerTreeHostImpl::SetViewportSize", |
| 2391 TRACE_EVENT_SCOPE_THREAD, "width", | 2403 TRACE_EVENT_SCOPE_THREAD, "width", |
| 2392 device_viewport_size.width(), "height", | 2404 device_viewport_size.width(), "height", |
| (...skipping 1797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4190 if (is_visible) { | 4202 if (is_visible) { |
| 4191 worker_context_visibility_ = | 4203 worker_context_visibility_ = |
| 4192 worker_context->CacheController()->ClientBecameVisible(); | 4204 worker_context->CacheController()->ClientBecameVisible(); |
| 4193 } else { | 4205 } else { |
| 4194 worker_context->CacheController()->ClientBecameNotVisible( | 4206 worker_context->CacheController()->ClientBecameNotVisible( |
| 4195 std::move(worker_context_visibility_)); | 4207 std::move(worker_context_visibility_)); |
| 4196 } | 4208 } |
| 4197 } | 4209 } |
| 4198 | 4210 |
| 4199 } // namespace cc | 4211 } // namespace cc |
| OLD | NEW |