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 | |
2370 // TODO(brianderson): Don't use a hard-coded parent draw time. | 2363 // TODO(brianderson): Don't use a hard-coded parent draw time. |
2371 base::TimeDelta parent_draw_time = | 2364 base::TimeDelta parent_draw_time = |
2372 (!settings_.use_external_begin_frame_source && | 2365 (!settings_.use_external_begin_frame_source && |
2373 output_surface_->capabilities().adjust_deadline_for_parent) | 2366 output_surface_->capabilities().adjust_deadline_for_parent) |
2374 ? BeginFrameArgs::DefaultEstimatedParentDrawTime() | 2367 ? BeginFrameArgs::DefaultEstimatedParentDrawTime() |
2375 : base::TimeDelta(); | 2368 : base::TimeDelta(); |
2376 client_->SetEstimatedParentDrawTime(parent_draw_time); | 2369 client_->SetEstimatedParentDrawTime(parent_draw_time); |
2377 | 2370 |
2378 DCHECK_EQ(1, output_surface_->capabilities().max_frames_pending); | 2371 DCHECK_EQ(1, output_surface_->capabilities().max_frames_pending); |
2379 client_->OnCanDrawStateChanged(CanDraw()); | 2372 client_->OnCanDrawStateChanged(CanDraw()); |
2380 | 2373 |
2381 // There will not be anything to draw here, so set high res | 2374 // There will not be anything to draw here, so set high res |
2382 // to avoid checkerboards, typically when we are recovering | 2375 // to avoid checkerboards, typically when we are recovering |
2383 // from lost context. | 2376 // from lost context. |
2384 // TODO(crbug.com/469175): Replace with RequiresHighResToDraw. | 2377 // TODO(crbug.com/469175): Replace with RequiresHighResToDraw. |
2385 SetRequiresHighResToDraw(); | 2378 SetRequiresHighResToDraw(); |
2386 | 2379 |
2387 return true; | 2380 return true; |
2388 } | 2381 } |
2389 | 2382 |
2390 void LayerTreeHostImpl::CommitVSyncParameters(base::TimeTicks timebase, | |
2391 base::TimeDelta interval) { | |
2392 client_->CommitVSyncParameters(timebase, interval); | |
2393 } | |
2394 | |
2395 void LayerTreeHostImpl::SetBeginFrameSource(BeginFrameSource* source) { | 2383 void LayerTreeHostImpl::SetBeginFrameSource(BeginFrameSource* source) { |
2396 client_->SetBeginFrameSource(source); | 2384 client_->SetBeginFrameSource(source); |
2397 } | 2385 } |
2398 | 2386 |
2399 void LayerTreeHostImpl::SetViewportSize(const gfx::Size& device_viewport_size) { | 2387 void LayerTreeHostImpl::SetViewportSize(const gfx::Size& device_viewport_size) { |
2400 if (device_viewport_size == device_viewport_size_) | 2388 if (device_viewport_size == device_viewport_size_) |
2401 return; | 2389 return; |
2402 TRACE_EVENT_INSTANT2("cc", "LayerTreeHostImpl::SetViewportSize", | 2390 TRACE_EVENT_INSTANT2("cc", "LayerTreeHostImpl::SetViewportSize", |
2403 TRACE_EVENT_SCOPE_THREAD, "width", | 2391 TRACE_EVENT_SCOPE_THREAD, "width", |
2404 device_viewport_size.width(), "height", | 2392 device_viewport_size.width(), "height", |
(...skipping 1799 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4204 if (is_visible) { | 4192 if (is_visible) { |
4205 worker_context_visibility_ = | 4193 worker_context_visibility_ = |
4206 worker_context->CacheController()->ClientBecameVisible(); | 4194 worker_context->CacheController()->ClientBecameVisible(); |
4207 } else { | 4195 } else { |
4208 worker_context->CacheController()->ClientBecameNotVisible( | 4196 worker_context->CacheController()->ClientBecameNotVisible( |
4209 std::move(worker_context_visibility_)); | 4197 std::move(worker_context_visibility_)); |
4210 } | 4198 } |
4211 } | 4199 } |
4212 | 4200 |
4213 } // namespace cc | 4201 } // namespace cc |
OLD | NEW |