| Index: cc/trees/layer_tree_host_impl.cc
|
| diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc
|
| index 2278a4ac23330a062951732300ed9ce145b70cb4..e3180989d2ad0e1822015b46844875842fcf7600 100644
|
| --- a/cc/trees/layer_tree_host_impl.cc
|
| +++ b/cc/trees/layer_tree_host_impl.cc
|
| @@ -5,6 +5,7 @@
|
| #include "cc/trees/layer_tree_host_impl.h"
|
|
|
| #include <algorithm>
|
| +#include <iostream>
|
| #include <limits>
|
|
|
| #include "base/basictypes.h"
|
| @@ -27,6 +28,7 @@
|
| #include "cc/debug/frame_rate_counter.h"
|
| #include "cc/debug/paint_time_counter.h"
|
| #include "cc/debug/rendering_stats_instrumentation.h"
|
| +#include "cc/debug/smoothness_timing_tracker.h"
|
| #include "cc/debug/traced_value.h"
|
| #include "cc/input/page_scale_animation.h"
|
| #include "cc/input/top_controls_manager.h"
|
| @@ -247,6 +249,7 @@ LayerTreeHostImpl::LayerTreeHostImpl(
|
| pinch_gesture_active_(false),
|
| pinch_gesture_end_should_clear_scrolling_layer_(false),
|
| fps_counter_(FrameRateCounter::Create(proxy_->HasImplThread())),
|
| + smoothness_tracker_(SmoothnessTimingTracker::Create()),
|
| paint_time_counter_(PaintTimeCounter::Create()),
|
| memory_history_(MemoryHistory::Create()),
|
| debug_rect_history_(DebugRectHistory::Create()),
|
| @@ -864,8 +867,41 @@ DrawResult LayerTreeHostImpl::CalculateRenderPasses(
|
| *it,
|
| occlusion_tracker,
|
| &append_quads_data);
|
| - }
|
|
|
| + const std::vector<std::pair<int64_t, gfx::Rect> >& vec =
|
| + it->smoothness_timing_requests();
|
| + if (vec.size()) {
|
| + gfx::Rect damage =
|
| + root_surface->damage_tracker()->current_damage_rect();
|
| +
|
| + gfx::Transform inverse_screen_space_transform(
|
| + gfx::Transform::kSkipInitialization);
|
| + if (it->screen_space_transform().GetInverse(
|
| + &inverse_screen_space_transform))
|
| + damage = gfx::ToEnclosingRect(MathUtil::ProjectClippedRect(
|
| + inverse_screen_space_transform,
|
| + root_surface->damage_tracker()->current_damage_rect()));
|
| +
|
| + std::cout << "[LayerTreeHostImpl] it->id() " << it->id()
|
| + << " it->damage = [" << damage.x() << ", " << damage.y()
|
| + << ", " << damage.right() << ", " << damage.bottom() << "]"
|
| + << std::endl;
|
| + for (size_t i = 0; i < vec.size(); ++i) {
|
| + int64_t rect_id = vec[i].first;
|
| + gfx::Rect rect = gfx::ScaleToEnclosingRect(
|
| + vec[i].second, it->contents_scale_x(), it->contents_scale_y());
|
| + bool intersects = damage.Intersects(rect);
|
| + std::cout << "[LayerTreeHostImpl] Target " << rect_id
|
| + << (intersects ? " Intersects " : " Misses ") << " - ["
|
| + << rect.x() << ", " << rect.y() << ", " << rect.width()
|
| + << ", " << rect.height() << "]" << std::endl;
|
| + if (intersects) {
|
| + uncommitted_composite_ids_.push_back(
|
| + std::make_pair(active_tree_->source_frame_number(), rect_id));
|
| + }
|
| + }
|
| + }
|
| + }
|
| ++layers_drawn;
|
| }
|
|
|
| @@ -1507,6 +1543,7 @@ void LayerTreeHostImpl::DrawLayers(FrameData* frame,
|
| TRACE_EVENT_INSTANT0("cc", "EarlyOut_NoDamage", TRACE_EVENT_SCOPE_THREAD);
|
| DCHECK(!output_surface_->capabilities()
|
| .draw_and_swap_full_viewport_every_frame);
|
| + uncommitted_composite_ids_.clear();
|
| return;
|
| }
|
|
|
| @@ -1596,6 +1633,10 @@ void LayerTreeHostImpl::DrawLayers(FrameData* frame,
|
| DCHECK(frame->render_passes.empty());
|
| frame->render_passes_by_id.clear();
|
|
|
| + smoothness_tracker_->SaveTimeStamps(gfx::FrameTime::Now(),
|
| + uncommitted_composite_ids_);
|
| + uncommitted_composite_ids_.clear();
|
| +
|
| // The next frame should start by assuming nothing has changed, and changes
|
| // are noted as they occur.
|
| // TODO(boliu): If we did a temporary software renderer frame, propogate the
|
|
|