Commit 4c43a285 authored by jbauman's avatar jbauman Committed by Commit bot

Add LatencyInfo support for Surfaces.

BUG=

Review URL: https://codereview.chromium.org/511423004

Cr-Commit-Position: refs/heads/master@{#292998}
parent fa5d9da2
...@@ -505,6 +505,7 @@ ...@@ -505,6 +505,7 @@
'<(DEPTH)/base/base.gyp:base', '<(DEPTH)/base/base.gyp:base',
'<(DEPTH)/base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations', '<(DEPTH)/base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations',
'<(DEPTH)/skia/skia.gyp:skia', '<(DEPTH)/skia/skia.gyp:skia',
'<(DEPTH)/ui/events/events.gyp:events_base',
'<(DEPTH)/ui/gfx/gfx.gyp:gfx', '<(DEPTH)/ui/gfx/gfx.gyp:gfx',
'<(DEPTH)/ui/gfx/gfx.gyp:gfx_geometry', '<(DEPTH)/ui/gfx/gfx.gyp:gfx_geometry',
], ],
......
...@@ -112,8 +112,7 @@ bool Display::Draw() { ...@@ -112,8 +112,7 @@ bool Display::Draw() {
device_viewport_rect, device_viewport_rect,
device_clip_rect, device_clip_rect,
disable_picture_quad_image_filtering); disable_picture_quad_image_filtering);
CompositorFrameMetadata metadata; renderer_->SwapBuffers(frame->metadata);
renderer_->SwapBuffers(metadata);
for (SurfaceAggregator::SurfaceIndexMap::iterator it = for (SurfaceAggregator::SurfaceIndexMap::iterator it =
aggregator_->previous_contained_surfaces().begin(); aggregator_->previous_contained_surfaces().begin();
it != aggregator_->previous_contained_surfaces().end(); it != aggregator_->previous_contained_surfaces().end();
......
...@@ -33,6 +33,7 @@ Surface::~Surface() { ...@@ -33,6 +33,7 @@ Surface::~Surface() {
void Surface::QueueFrame(scoped_ptr<CompositorFrame> frame, void Surface::QueueFrame(scoped_ptr<CompositorFrame> frame,
const base::Closure& callback) { const base::Closure& callback) {
TakeLatencyInfo(&frame->metadata.latency_info);
scoped_ptr<CompositorFrame> previous_frame = current_frame_.Pass(); scoped_ptr<CompositorFrame> previous_frame = current_frame_.Pass();
current_frame_ = frame.Pass(); current_frame_ = frame.Pass();
factory_->ReceiveFromChild( factory_->ReceiveFromChild(
...@@ -60,6 +61,19 @@ const CompositorFrame* Surface::GetEligibleFrame() { ...@@ -60,6 +61,19 @@ const CompositorFrame* Surface::GetEligibleFrame() {
return current_frame_.get(); return current_frame_.get();
} }
void Surface::TakeLatencyInfo(std::vector<ui::LatencyInfo>* latency_info) {
if (!current_frame_)
return;
if (latency_info->empty()) {
current_frame_->metadata.latency_info.swap(*latency_info);
return;
}
std::copy(current_frame_->metadata.latency_info.begin(),
current_frame_->metadata.latency_info.end(),
std::back_inserter(*latency_info));
current_frame_->metadata.latency_info.clear();
}
void Surface::RunDrawCallbacks() { void Surface::RunDrawCallbacks() {
if (!draw_callback_.is_null()) { if (!draw_callback_.is_null()) {
base::Closure callback = draw_callback_; base::Closure callback = draw_callback_;
......
...@@ -13,6 +13,10 @@ ...@@ -13,6 +13,10 @@
#include "cc/surfaces/surfaces_export.h" #include "cc/surfaces/surfaces_export.h"
#include "ui/gfx/size.h" #include "ui/gfx/size.h"
namespace ui {
struct LatencyInfo;
}
namespace cc { namespace cc {
class CompositorFrame; class CompositorFrame;
class CopyOutputRequest; class CopyOutputRequest;
...@@ -37,6 +41,7 @@ class CC_SURFACES_EXPORT Surface { ...@@ -37,6 +41,7 @@ class CC_SURFACES_EXPORT Surface {
// Returns a number that increments by 1 every time a new frame is enqueued. // Returns a number that increments by 1 every time a new frame is enqueued.
int frame_index() const { return frame_index_; } int frame_index() const { return frame_index_; }
void TakeLatencyInfo(std::vector<ui::LatencyInfo>* latency_info);
void RunDrawCallbacks(); void RunDrawCallbacks();
SurfaceFactory* factory() { return factory_; } SurfaceFactory* factory() { return factory_; }
......
...@@ -346,6 +346,14 @@ scoped_ptr<CompositorFrame> SurfaceAggregator::Aggregate(SurfaceId surface_id) { ...@@ -346,6 +346,14 @@ scoped_ptr<CompositorFrame> SurfaceAggregator::Aggregate(SurfaceId surface_id) {
contained_surfaces_.swap(previous_contained_surfaces_); contained_surfaces_.swap(previous_contained_surfaces_);
contained_surfaces_.clear(); contained_surfaces_.clear();
for (SurfaceIndexMap::iterator it = previous_contained_surfaces_.begin();
it != previous_contained_surfaces_.end();
++it) {
Surface* surface = manager_->GetSurfaceForId(it->first);
if (surface)
surface->TakeLatencyInfo(&frame->metadata.latency_info);
}
// TODO(jamesr): Aggregate all resource references into the returned frame's // TODO(jamesr): Aggregate all resource references into the returned frame's
// resource list. // resource list.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment