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

Side by Side Diff: cc/trees/layer_tree_host_impl.cc

Issue 16871016: cc: Use BeginFrameArgs (Closed) Base URL: http://git.chromium.org/chromium/src.git@bfargs2
Patch Set: rebase Created 7 years, 4 months 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
« no previous file with comments | « cc/trees/layer_tree_host_impl.h ('k') | cc/trees/layer_tree_host_impl_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #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 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/json/json_writer.h" 10 #include "base/json/json_writer.h"
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 rendering_stats_instrumentation)); 163 rendering_stats_instrumentation));
164 } 164 }
165 165
166 LayerTreeHostImpl::LayerTreeHostImpl( 166 LayerTreeHostImpl::LayerTreeHostImpl(
167 const LayerTreeSettings& settings, 167 const LayerTreeSettings& settings,
168 LayerTreeHostImplClient* client, 168 LayerTreeHostImplClient* client,
169 Proxy* proxy, 169 Proxy* proxy,
170 RenderingStatsInstrumentation* rendering_stats_instrumentation) 170 RenderingStatsInstrumentation* rendering_stats_instrumentation)
171 : client_(client), 171 : client_(client),
172 proxy_(proxy), 172 proxy_(proxy),
173 output_surface_lost_(true),
173 input_handler_client_(NULL), 174 input_handler_client_(NULL),
174 did_lock_scrolling_layer_(false), 175 did_lock_scrolling_layer_(false),
175 should_bubble_scrolls_(false), 176 should_bubble_scrolls_(false),
176 wheel_scrolling_(false), 177 wheel_scrolling_(false),
177 manage_tiles_needed_(false), 178 manage_tiles_needed_(false),
178 root_layer_scroll_offset_delegate_(NULL), 179 root_layer_scroll_offset_delegate_(NULL),
179 settings_(settings), 180 settings_(settings),
180 visible_(true), 181 visible_(true),
181 cached_managed_memory_policy_( 182 cached_managed_memory_policy_(
182 PrioritizedResourceManager::DefaultMemoryAllocationLimit(), 183 PrioritizedResourceManager::DefaultMemoryAllocationLimit(),
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 void LayerTreeHostImpl::CommitComplete() { 246 void LayerTreeHostImpl::CommitComplete() {
246 TRACE_EVENT0("cc", "LayerTreeHostImpl::CommitComplete"); 247 TRACE_EVENT0("cc", "LayerTreeHostImpl::CommitComplete");
247 248
248 // Impl-side painting needs an update immediately post-commit to have the 249 // Impl-side painting needs an update immediately post-commit to have the
249 // opportunity to create tilings. Other paths can call UpdateDrawProperties 250 // opportunity to create tilings. Other paths can call UpdateDrawProperties
250 // more lazily when needed prior to drawing. 251 // more lazily when needed prior to drawing.
251 if (settings_.impl_side_painting) { 252 if (settings_.impl_side_painting) {
252 pending_tree_->set_needs_update_draw_properties(); 253 pending_tree_->set_needs_update_draw_properties();
253 pending_tree_->UpdateDrawProperties(); 254 pending_tree_->UpdateDrawProperties();
254 // Start working on newly created tiles immediately if needed. 255 // Start working on newly created tiles immediately if needed.
255 ManageTiles(); 256 if (!ManageTiles())
257 client_->NotifyReadyToActivate();
256 } else { 258 } else {
257 active_tree_->set_needs_update_draw_properties(); 259 active_tree_->set_needs_update_draw_properties();
258 } 260 }
259 261
260 client_->SendManagedMemoryStats(); 262 client_->SendManagedMemoryStats();
261 } 263 }
262 264
263 bool LayerTreeHostImpl::CanDraw() const { 265 bool LayerTreeHostImpl::CanDraw() const {
264 // Note: If you are changing this function or any other function that might 266 // Note: If you are changing this function or any other function that might
265 // affect the result of CanDraw, make sure to call 267 // affect the result of CanDraw, make sure to call
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 void LayerTreeHostImpl::Animate(base::TimeTicks monotonic_time, 311 void LayerTreeHostImpl::Animate(base::TimeTicks monotonic_time,
310 base::Time wall_clock_time) { 312 base::Time wall_clock_time) {
311 if (input_handler_client_) 313 if (input_handler_client_)
312 input_handler_client_->Animate(monotonic_time); 314 input_handler_client_->Animate(monotonic_time);
313 AnimatePageScale(monotonic_time); 315 AnimatePageScale(monotonic_time);
314 AnimateLayers(monotonic_time, wall_clock_time); 316 AnimateLayers(monotonic_time, wall_clock_time);
315 AnimateScrollbars(monotonic_time); 317 AnimateScrollbars(monotonic_time);
316 AnimateTopControls(monotonic_time); 318 AnimateTopControls(monotonic_time);
317 } 319 }
318 320
319 void LayerTreeHostImpl::ManageTiles() { 321 bool LayerTreeHostImpl::ManageTiles() {
320 if (!tile_manager_) 322 if (!tile_manager_)
321 return; 323 return false;
322 if (!manage_tiles_needed_) 324 if (!manage_tiles_needed_)
323 return; 325 return false;
324 manage_tiles_needed_ = false; 326 manage_tiles_needed_ = false;
325 tile_manager_->ManageTiles(); 327 tile_manager_->ManageTiles();
326 328
327 size_t memory_required_bytes; 329 size_t memory_required_bytes;
328 size_t memory_nice_to_have_bytes; 330 size_t memory_nice_to_have_bytes;
329 size_t memory_used_bytes; 331 size_t memory_used_bytes;
330 tile_manager_->GetMemoryStats(&memory_required_bytes, 332 tile_manager_->GetMemoryStats(&memory_required_bytes,
331 &memory_nice_to_have_bytes, 333 &memory_nice_to_have_bytes,
332 &memory_used_bytes); 334 &memory_used_bytes);
333 SendManagedMemoryStats(memory_required_bytes, 335 SendManagedMemoryStats(memory_required_bytes,
334 memory_nice_to_have_bytes, 336 memory_nice_to_have_bytes,
335 memory_used_bytes); 337 memory_used_bytes);
338 return true;
336 } 339 }
337 340
338 void LayerTreeHostImpl::StartPageScaleAnimation(gfx::Vector2d target_offset, 341 void LayerTreeHostImpl::StartPageScaleAnimation(gfx::Vector2d target_offset,
339 bool anchor_point, 342 bool anchor_point,
340 float page_scale, 343 float page_scale,
341 base::TimeTicks start_time, 344 base::TimeTicks start_time,
342 base::TimeDelta duration) { 345 base::TimeDelta duration) {
343 if (!RootScrollLayer()) 346 if (!RootScrollLayer())
344 return; 347 return;
345 348
(...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after
1055 1058
1056 void LayerTreeHostImpl::DidInitializeVisibleTile() { 1059 void LayerTreeHostImpl::DidInitializeVisibleTile() {
1057 // TODO(reveman): Determine tiles that changed and only damage 1060 // TODO(reveman): Determine tiles that changed and only damage
1058 // what's necessary. 1061 // what's necessary.
1059 SetFullRootLayerDamage(); 1062 SetFullRootLayerDamage();
1060 if (client_) 1063 if (client_)
1061 client_->DidInitializeVisibleTileOnImplThread(); 1064 client_->DidInitializeVisibleTileOnImplThread();
1062 } 1065 }
1063 1066
1064 void LayerTreeHostImpl::NotifyReadyToActivate() { 1067 void LayerTreeHostImpl::NotifyReadyToActivate() {
1065 if (pending_tree_) { 1068 client_->NotifyReadyToActivate();
1066 need_to_update_visible_tiles_before_draw_ = true;
1067 ActivatePendingTree();
1068 }
1069 } 1069 }
1070 1070
1071 bool LayerTreeHostImpl::ShouldClearRootRenderPass() const { 1071 bool LayerTreeHostImpl::ShouldClearRootRenderPass() const {
1072 return settings_.should_clear_root_render_pass; 1072 return settings_.should_clear_root_render_pass;
1073 } 1073 }
1074 1074
1075 void LayerTreeHostImpl::SetMemoryPolicy(const ManagedMemoryPolicy& policy) { 1075 void LayerTreeHostImpl::SetMemoryPolicy(const ManagedMemoryPolicy& policy) {
1076 SetManagedMemoryPolicy(policy, zero_budget_); 1076 SetManagedMemoryPolicy(policy, zero_budget_);
1077 } 1077 }
1078 1078
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
1303 bool LayerTreeHostImpl::IsContextLost() { 1303 bool LayerTreeHostImpl::IsContextLost() {
1304 DCHECK(proxy_->IsImplThread()); 1304 DCHECK(proxy_->IsImplThread());
1305 return renderer_ && renderer_->IsContextLost(); 1305 return renderer_ && renderer_->IsContextLost();
1306 } 1306 }
1307 1307
1308 const RendererCapabilities& LayerTreeHostImpl::GetRendererCapabilities() const { 1308 const RendererCapabilities& LayerTreeHostImpl::GetRendererCapabilities() const {
1309 return renderer_->Capabilities(); 1309 return renderer_->Capabilities();
1310 } 1310 }
1311 1311
1312 bool LayerTreeHostImpl::SwapBuffers(const LayerTreeHostImpl::FrameData& frame) { 1312 bool LayerTreeHostImpl::SwapBuffers(const LayerTreeHostImpl::FrameData& frame) {
1313 if (frame.has_no_damage) 1313 if (frame.has_no_damage || output_surface_lost_)
1314 return false; 1314 return false;
1315 renderer_->SwapBuffers(); 1315 renderer_->SwapBuffers();
1316 active_tree_->ClearLatencyInfo(); 1316 active_tree_->ClearLatencyInfo();
1317 return true; 1317 return true;
1318 } 1318 }
1319 1319
1320 void LayerTreeHostImpl::SetNeedsBeginFrame(bool enable) { 1320 void LayerTreeHostImpl::SetNeedsBeginFrame(bool enable) {
1321 if (output_surface_) 1321 if (output_surface_)
1322 output_surface_->SetNeedsBeginFrame(enable); 1322 output_surface_->SetNeedsBeginFrame(enable);
1323 } 1323 }
(...skipping 22 matching lines...) Expand all
1346 } 1346 }
1347 1347
1348 const LayerTreeSettings& LayerTreeHostImpl::Settings() const { 1348 const LayerTreeSettings& LayerTreeHostImpl::Settings() const {
1349 return settings(); 1349 return settings();
1350 } 1350 }
1351 1351
1352 void LayerTreeHostImpl::DidLoseOutputSurface() { 1352 void LayerTreeHostImpl::DidLoseOutputSurface() {
1353 // TODO(jamesr): The renderer_ check is needed to make some of the 1353 // TODO(jamesr): The renderer_ check is needed to make some of the
1354 // LayerTreeHostContextTest tests pass, but shouldn't be necessary (or 1354 // LayerTreeHostContextTest tests pass, but shouldn't be necessary (or
1355 // important) in production. We should adjust the test to not need this. 1355 // important) in production. We should adjust the test to not need this.
1356 output_surface_lost_ = true;
1356 if (renderer_) 1357 if (renderer_)
1357 client_->DidLoseOutputSurfaceOnImplThread(); 1358 client_->DidLoseOutputSurfaceOnImplThread();
1358 } 1359 }
1359 1360
1360 void LayerTreeHostImpl::Readback(void* pixels, 1361 void LayerTreeHostImpl::Readback(void* pixels,
1361 gfx::Rect rect_in_device_viewport) { 1362 gfx::Rect rect_in_device_viewport) {
1362 DCHECK(renderer_); 1363 DCHECK(renderer_);
1363 renderer_->GetFramebufferPixels(pixels, rect_in_device_viewport); 1364 renderer_->GetFramebufferPixels(pixels, rect_in_device_viewport);
1364 } 1365 }
1365 1366
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
1413 void LayerTreeHostImpl::UpdateVisibleTiles() { 1414 void LayerTreeHostImpl::UpdateVisibleTiles() {
1414 DCHECK(!client_->IsInsideDraw()) << 1415 DCHECK(!client_->IsInsideDraw()) <<
1415 "Updating visible tiles within a draw may trigger " 1416 "Updating visible tiles within a draw may trigger "
1416 "spurious redraws."; 1417 "spurious redraws.";
1417 if (tile_manager_ && tile_manager_->UpdateVisibleTiles()) 1418 if (tile_manager_ && tile_manager_->UpdateVisibleTiles())
1418 DidInitializeVisibleTile(); 1419 DidInitializeVisibleTile();
1419 1420
1420 need_to_update_visible_tiles_before_draw_ = false; 1421 need_to_update_visible_tiles_before_draw_ = false;
1421 } 1422 }
1422 1423
1423 void LayerTreeHostImpl::ActivatePendingTreeIfNeeded() { 1424 void LayerTreeHostImpl::ActivatePendingTreeIfNeeded() {
reveman 2013/08/07 03:32:28 can this function be removed?
brianderson 2013/08/07 18:41:57 It's very close to being removable. LayerTreeHostI
reveman 2013/08/07 19:09:38 That's perfectly fine. I just wanted to make sure
1424 DCHECK(pending_tree_); 1425 DCHECK(pending_tree_);
1425 CHECK(settings_.impl_side_painting); 1426 CHECK(settings_.impl_side_painting);
1426 1427
1427 if (!pending_tree_) 1428 if (!pending_tree_)
1428 return; 1429 return;
1429 1430
1430 // The tile manager is usually responsible for notifying activation. 1431 // The tile manager is usually responsible for notifying activation.
1431 // If there is no tile manager, then we need to manually activate. 1432 // If there is no tile manager, then we need to manually activate.
1432 if (!tile_manager_ || tile_manager_->AreTilesRequiredForActivationReady()) { 1433 if (!tile_manager_ || tile_manager_->AreTilesRequiredForActivationReady()) {
1433 ActivatePendingTree(); 1434 ActivatePendingTree();
1434 return; 1435 return;
1435 } 1436 }
1436 1437
1437 // Manage tiles in case state affecting tile priority has changed. 1438 // Manage tiles in case state affecting tile priority has changed.
1438 ManageTiles(); 1439 ManageTiles();
1439 1440
1440 TRACE_EVENT_ASYNC_STEP1( 1441 TRACE_EVENT_ASYNC_STEP1(
1441 "cc", 1442 "cc",
1442 "PendingTree", pending_tree_.get(), "activate", 1443 "PendingTree", pending_tree_.get(), "activate",
1443 "state", TracedValue::FromValue(ActivationStateAsValue().release())); 1444 "state", TracedValue::FromValue(ActivationStateAsValue().release()));
1444 } 1445 }
1445 1446
1446 void LayerTreeHostImpl::ActivatePendingTree() { 1447 void LayerTreeHostImpl::ActivatePendingTree() {
1447 CHECK(pending_tree_); 1448 CHECK(pending_tree_);
1448 TRACE_EVENT_ASYNC_END0("cc", "PendingTree", pending_tree_.get()); 1449 TRACE_EVENT_ASYNC_END0("cc", "PendingTree", pending_tree_.get());
1449 1450
1451 need_to_update_visible_tiles_before_draw_ = true;
1452
1450 active_tree_->SetRootLayerScrollOffsetDelegate(NULL); 1453 active_tree_->SetRootLayerScrollOffsetDelegate(NULL);
1451 active_tree_->PushPersistedState(pending_tree_.get()); 1454 active_tree_->PushPersistedState(pending_tree_.get());
1452 if (pending_tree_->needs_full_tree_sync()) { 1455 if (pending_tree_->needs_full_tree_sync()) {
1453 active_tree_->SetRootLayer( 1456 active_tree_->SetRootLayer(
1454 TreeSynchronizer::SynchronizeTrees(pending_tree_->root_layer(), 1457 TreeSynchronizer::SynchronizeTrees(pending_tree_->root_layer(),
1455 active_tree_->DetachLayerTree(), 1458 active_tree_->DetachLayerTree(),
1456 active_tree_.get())); 1459 active_tree_.get()));
1457 } 1460 }
1458 TreeSynchronizer::PushProperties(pending_tree_->root_layer(), 1461 TreeSynchronizer::PushProperties(pending_tree_->root_layer(),
1459 active_tree_->root_layer()); 1462 active_tree_->root_layer());
1460 DCHECK(!recycle_tree_); 1463 DCHECK(!recycle_tree_);
1461 1464
1462 // Process any requests in the UI resource queue. The request queue is given 1465 // Process any requests in the UI resource queue. The request queue is given
1463 // in LayerTreeHost::FinishCommitOnImplThread. This must take place before 1466 // in LayerTreeHost::FinishCommitOnImplThread. This must take place before
1464 // the swap. 1467 // the swap.
1465 pending_tree_->ProcessUIResourceRequestQueue(); 1468 pending_tree_->ProcessUIResourceRequestQueue();
1466 1469
1467 pending_tree_->PushPropertiesTo(active_tree_.get()); 1470 pending_tree_->PushPropertiesTo(active_tree_.get());
1468 1471
1469 // Now that we've synced everything from the pending tree to the active 1472 // Now that we've synced everything from the pending tree to the active
1470 // tree, rename the pending tree the recycle tree so we can reuse it on the 1473 // tree, rename the pending tree the recycle tree so we can reuse it on the
1471 // next sync. 1474 // next sync.
1472 pending_tree_.swap(recycle_tree_); 1475 pending_tree_.swap(recycle_tree_);
1473 1476
1474 active_tree_->SetRootLayerScrollOffsetDelegate( 1477 active_tree_->SetRootLayerScrollOffsetDelegate(
1475 root_layer_scroll_offset_delegate_); 1478 root_layer_scroll_offset_delegate_);
1476 active_tree_->DidBecomeActive(); 1479 active_tree_->DidBecomeActive();
1477 1480
1481 client_->DidActivatePendingTree();
1482 if (!tree_activation_callback_.is_null())
1483 tree_activation_callback_.Run();
1484
1478 // Reduce wasted memory now that unlinked resources are guaranteed not 1485 // Reduce wasted memory now that unlinked resources are guaranteed not
1479 // to be used. 1486 // to be used.
1480 client_->ReduceWastedContentsTextureMemoryOnImplThread(); 1487 client_->ReduceWastedContentsTextureMemoryOnImplThread();
1481 1488
1482 client_->OnCanDrawStateChanged(CanDraw()); 1489 client_->OnCanDrawStateChanged(CanDraw());
1483 client_->OnHasPendingTreeStateChanged(pending_tree_); 1490 client_->OnHasPendingTreeStateChanged(pending_tree_);
1484 client_->SetNeedsRedrawOnImplThread(); 1491 client_->SetNeedsRedrawOnImplThread();
1485 client_->RenewTreePriority(); 1492 client_->RenewTreePriority();
1486 1493
1487 if (debug_state_.continuous_painting) { 1494 if (debug_state_.continuous_painting) {
1488 const RenderingStats& stats = 1495 const RenderingStats& stats =
1489 rendering_stats_instrumentation_->GetRenderingStats(); 1496 rendering_stats_instrumentation_->GetRenderingStats();
1490 paint_time_counter_->SavePaintTime( 1497 paint_time_counter_->SavePaintTime(
1491 stats.total_paint_time + stats.total_record_time + 1498 stats.total_paint_time + stats.total_record_time +
1492 stats.total_rasterize_time_for_now_bins_on_pending_tree); 1499 stats.total_rasterize_time_for_now_bins_on_pending_tree);
1493 } 1500 }
1494
1495 client_->DidActivatePendingTree();
1496 if (!tree_activation_callback_.is_null())
1497 tree_activation_callback_.Run();
1498 } 1501 }
1499 1502
1500 void LayerTreeHostImpl::SetVisible(bool visible) { 1503 void LayerTreeHostImpl::SetVisible(bool visible) {
1501 DCHECK(proxy_->IsImplThread()); 1504 DCHECK(proxy_->IsImplThread());
1502 1505
1503 if (visible_ == visible) 1506 if (visible_ == visible)
1504 return; 1507 return;
1505 visible_ = visible; 1508 visible_ = visible;
1506 DidVisibilityChange(this, visible_); 1509 DidVisibilityChange(this, visible_);
1507 EnforceManagedMemoryPolicy(ActualManagedMemoryPolicy()); 1510 EnforceManagedMemoryPolicy(ActualManagedMemoryPolicy());
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
1595 // before we destroy the old resource provider. 1598 // before we destroy the old resource provider.
1596 ReleaseTreeResources(); 1599 ReleaseTreeResources();
1597 if (resource_provider_) 1600 if (resource_provider_)
1598 resource_provider_->DidLoseOutputSurface(); 1601 resource_provider_->DidLoseOutputSurface();
1599 1602
1600 // Note: order is important here. 1603 // Note: order is important here.
1601 renderer_.reset(); 1604 renderer_.reset();
1602 tile_manager_.reset(); 1605 tile_manager_.reset();
1603 resource_provider_.reset(); 1606 resource_provider_.reset();
1604 output_surface_.reset(); 1607 output_surface_.reset();
1608 output_surface_lost_ = true;
1605 1609
1606 if (!output_surface->BindToClient(this)) 1610 if (!output_surface->BindToClient(this))
1607 return false; 1611 return false;
1608 1612
1609 scoped_ptr<ResourceProvider> resource_provider = ResourceProvider::Create( 1613 scoped_ptr<ResourceProvider> resource_provider = ResourceProvider::Create(
1610 output_surface.get(), settings_.highp_threshold_min); 1614 output_surface.get(), settings_.highp_threshold_min);
1611 if (!resource_provider) 1615 if (!resource_provider)
1612 return false; 1616 return false;
1613 1617
1614 if (output_surface->capabilities().deferred_gl_initialization) 1618 if (output_surface->capabilities().deferred_gl_initialization)
(...skipping 25 matching lines...) Expand all
1640 } 1644 }
1641 1645
1642 int max_frames_pending = 1646 int max_frames_pending =
1643 output_surface->capabilities().max_frames_pending; 1647 output_surface->capabilities().max_frames_pending;
1644 if (max_frames_pending <= 0) 1648 if (max_frames_pending <= 0)
1645 max_frames_pending = OutputSurface::DEFAULT_MAX_FRAMES_PENDING; 1649 max_frames_pending = OutputSurface::DEFAULT_MAX_FRAMES_PENDING;
1646 output_surface->SetMaxFramesPending(max_frames_pending); 1650 output_surface->SetMaxFramesPending(max_frames_pending);
1647 1651
1648 resource_provider_ = resource_provider.Pass(); 1652 resource_provider_ = resource_provider.Pass();
1649 output_surface_ = output_surface.Pass(); 1653 output_surface_ = output_surface.Pass();
1654 output_surface_lost_ = false;
1650 1655
1651 client_->OnCanDrawStateChanged(CanDraw()); 1656 client_->OnCanDrawStateChanged(CanDraw());
1652 1657
1653 // See note in LayerTreeImpl::UpdateDrawProperties. Renderer needs 1658 // See note in LayerTreeImpl::UpdateDrawProperties. Renderer needs
1654 // to be initialized to get max texture size. 1659 // to be initialized to get max texture size.
1655 active_tree_->set_needs_update_draw_properties(); 1660 active_tree_->set_needs_update_draw_properties();
1656 if (pending_tree_) 1661 if (pending_tree_)
1657 pending_tree_->set_needs_update_draw_properties(); 1662 pending_tree_->set_needs_update_draw_properties();
1658 1663
1659 return true; 1664 return true;
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after
2209 if (!page_scale_animation_ || !RootScrollLayer()) 2214 if (!page_scale_animation_ || !RootScrollLayer())
2210 return; 2215 return;
2211 2216
2212 double monotonic_time = (time - base::TimeTicks()).InSecondsF(); 2217 double monotonic_time = (time - base::TimeTicks()).InSecondsF();
2213 gfx::Vector2dF scroll_total = RootScrollLayer()->scroll_offset() + 2218 gfx::Vector2dF scroll_total = RootScrollLayer()->scroll_offset() +
2214 RootScrollLayer()->ScrollDelta(); 2219 RootScrollLayer()->ScrollDelta();
2215 2220
2216 active_tree_->SetPageScaleDelta( 2221 active_tree_->SetPageScaleDelta(
2217 page_scale_animation_->PageScaleFactorAtTime(monotonic_time) / 2222 page_scale_animation_->PageScaleFactorAtTime(monotonic_time) /
2218 active_tree_->page_scale_factor()); 2223 active_tree_->page_scale_factor());
2224
2219 gfx::Vector2dF next_scroll = 2225 gfx::Vector2dF next_scroll =
2220 page_scale_animation_->ScrollOffsetAtTime(monotonic_time); 2226 page_scale_animation_->ScrollOffsetAtTime(monotonic_time);
2221 2227
2222 RootScrollLayer()->ScrollBy(next_scroll - scroll_total); 2228 RootScrollLayer()->ScrollBy(next_scroll - scroll_total);
2223 client_->SetNeedsRedrawOnImplThread(); 2229 client_->SetNeedsRedrawOnImplThread();
2224 2230
2225 if (page_scale_animation_->IsAnimationCompleteAtTime(monotonic_time)) { 2231 if (page_scale_animation_->IsAnimationCompleteAtTime(monotonic_time)) {
2226 page_scale_animation_.reset(); 2232 page_scale_animation_.reset();
2227 client_->SetNeedsCommitOnImplThread(); 2233 client_->SetNeedsCommitOnImplThread();
2228 client_->RenewTreePriority(); 2234 client_->RenewTreePriority();
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
2495 2501
2496 ResourceProvider::ResourceId LayerTreeHostImpl::ResourceIdForUIResource( 2502 ResourceProvider::ResourceId LayerTreeHostImpl::ResourceIdForUIResource(
2497 UIResourceId uid) const { 2503 UIResourceId uid) const {
2498 UIResourceMap::const_iterator iter = ui_resource_map_.find(uid); 2504 UIResourceMap::const_iterator iter = ui_resource_map_.find(uid);
2499 if (iter != ui_resource_map_.end()) 2505 if (iter != ui_resource_map_.end())
2500 return iter->second; 2506 return iter->second;
2501 return 0; 2507 return 0;
2502 } 2508 }
2503 2509
2504 } // namespace cc 2510 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_impl.h ('k') | cc/trees/layer_tree_host_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698