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

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

Issue 100443006: Remove some LatencyInfo merging code path (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: fix android/mac build Created 6 years, 11 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
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 <cmath> 7 #include <cmath>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 5305 matching lines...) Expand 10 before | Expand all | Expand 10 after
5316 root->SetPosition(gfx::PointF()); 5316 root->SetPosition(gfx::PointF());
5317 root->SetBounds(gfx::Size(10, 10)); 5317 root->SetBounds(gfx::Size(10, 10));
5318 root->SetContentBounds(gfx::Size(10, 10)); 5318 root->SetContentBounds(gfx::Size(10, 10));
5319 root->SetDrawsContent(true); 5319 root->SetDrawsContent(true);
5320 5320
5321 host_impl_->active_tree()->SetRootLayer(root.PassAs<LayerImpl>()); 5321 host_impl_->active_tree()->SetRootLayer(root.PassAs<LayerImpl>());
5322 5322
5323 FakeOutputSurface* fake_output_surface = 5323 FakeOutputSurface* fake_output_surface =
5324 static_cast<FakeOutputSurface*>(host_impl_->output_surface()); 5324 static_cast<FakeOutputSurface*>(host_impl_->output_surface());
5325 5325
5326 const ui::LatencyInfo& metadata_latency_before = 5326 const std::vector<ui::LatencyInfo>& metadata_latency_before =
5327 fake_output_surface->last_sent_frame().metadata.latency_info; 5327 fake_output_surface->last_sent_frame().metadata.latency_info;
5328 EXPECT_FALSE(metadata_latency_before.FindLatency( 5328 EXPECT_TRUE(metadata_latency_before.empty());
5329 ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, 0, NULL));
5330 5329
5331 ui::LatencyInfo latency_info; 5330 ui::LatencyInfo latency_info;
5332 latency_info.AddLatencyNumber( 5331 latency_info.AddLatencyNumber(
5333 ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, 0, 0); 5332 ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, 0, 0);
5334 scoped_ptr<SwapPromise> swap_promise( 5333 scoped_ptr<SwapPromise> swap_promise(
5335 new LatencyInfoSwapPromise(latency_info)); 5334 new LatencyInfoSwapPromise(latency_info));
5336 host_impl_->active_tree()->QueueSwapPromise(swap_promise.Pass()); 5335 host_impl_->active_tree()->QueueSwapPromise(swap_promise.Pass());
5337 host_impl_->SetNeedsRedraw(); 5336 host_impl_->SetNeedsRedraw();
5338 5337
5339 gfx::Rect full_frame_damage(host_impl_->DrawViewportSize()); 5338 gfx::Rect full_frame_damage(host_impl_->DrawViewportSize());
5340 LayerTreeHostImpl::FrameData frame; 5339 LayerTreeHostImpl::FrameData frame;
5341 EXPECT_TRUE(host_impl_->PrepareToDraw(&frame, gfx::Rect())); 5340 EXPECT_TRUE(host_impl_->PrepareToDraw(&frame, gfx::Rect()));
5342 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); 5341 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now());
5343 host_impl_->DidDrawAllLayers(frame); 5342 host_impl_->DidDrawAllLayers(frame);
5344 EXPECT_TRUE(host_impl_->SwapBuffers(frame)); 5343 EXPECT_TRUE(host_impl_->SwapBuffers(frame));
5345 5344
5346 const ui::LatencyInfo& metadata_latency_after = 5345 const std::vector<ui::LatencyInfo>& metadata_latency_after =
5347 fake_output_surface->last_sent_frame().metadata.latency_info; 5346 fake_output_surface->last_sent_frame().metadata.latency_info;
5348 EXPECT_TRUE(metadata_latency_after.FindLatency( 5347 EXPECT_EQ(1u, metadata_latency_after.size());
5348 EXPECT_TRUE(metadata_latency_after[0].FindLatency(
5349 ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, 0, NULL)); 5349 ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, 0, NULL));
5350 } 5350 }
5351 5351
5352 class SimpleSwapPromiseMonitor : public SwapPromiseMonitor { 5352 class SimpleSwapPromiseMonitor : public SwapPromiseMonitor {
5353 public: 5353 public:
5354 SimpleSwapPromiseMonitor(LayerTreeHost* layer_tree_host, 5354 SimpleSwapPromiseMonitor(LayerTreeHost* layer_tree_host,
5355 LayerTreeHostImpl* layer_tree_host_impl, 5355 LayerTreeHostImpl* layer_tree_host_impl,
5356 int* set_needs_commit_count, 5356 int* set_needs_commit_count,
5357 int* set_needs_redraw_count) 5357 int* set_needs_redraw_count)
5358 : SwapPromiseMonitor(layer_tree_host, layer_tree_host_impl), 5358 : SwapPromiseMonitor(layer_tree_host, layer_tree_host_impl),
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
5414 &set_needs_redraw_count)); 5414 &set_needs_redraw_count));
5415 // Empty damage rect won't signal the monitor. 5415 // Empty damage rect won't signal the monitor.
5416 host_impl_->SetNeedsRedrawRect(gfx::Rect()); 5416 host_impl_->SetNeedsRedrawRect(gfx::Rect());
5417 EXPECT_EQ(0, set_needs_commit_count); 5417 EXPECT_EQ(0, set_needs_commit_count);
5418 EXPECT_EQ(2, set_needs_redraw_count); 5418 EXPECT_EQ(2, set_needs_redraw_count);
5419 } 5419 }
5420 } 5420 }
5421 5421
5422 } // namespace 5422 } // namespace
5423 } // namespace cc 5423 } // namespace cc
OLDNEW
« no previous file with comments | « cc/output/compositor_frame_metadata.h ('k') | content/browser/aura/software_browser_compositor_output_surface.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698