summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormiletus@chromium.org <miletus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-29 00:01:22 +0000
committermiletus@chromium.org <miletus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-29 00:01:22 +0000
commit580ec6b79c40a7e58e896e4f0063ad9eca5d16a3 (patch)
treecb376ccd50dabd9e5a63ade75acdc70532109171
parent4b7718ac366ed68a86b710dd74486e4c487c6492 (diff)
downloadchromium_src-580ec6b79c40a7e58e896e4f0063ad9eca5d16a3.zip
chromium_src-580ec6b79c40a7e58e896e4f0063ad9eca5d16a3.tar.gz
chromium_src-580ec6b79c40a7e58e896e4f0063ad9eca5d16a3.tar.bz2
Use LatencyInfoSwapPromise to track LatencyInfo through compositor
Originally we cache LatencyInfo directly in compositor. Now that with the support of SwapPromise, we can use LatencyInfoSwapPromise to track the LatencyInfo. BUG=246034 TEST=Input LatencyInfo are still correctly passed to output surface through LatencyInfoSwapPromise. Review URL: https://codereview.chromium.org/81533002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@237848 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--cc/base/latency_info_swap_promise.cc50
-rw-r--r--cc/base/latency_info_swap_promise.h28
-rw-r--r--cc/base/swap_promise.h12
-rw-r--r--cc/cc.gyp2
-rw-r--r--cc/cc_tests.gyp1
-rw-r--r--cc/trees/layer_tree_host.cc9
-rw-r--r--cc/trees/layer_tree_host.h4
-rw-r--r--cc/trees/layer_tree_host_impl.cc9
-rw-r--r--cc/trees/layer_tree_host_impl_unittest.cc39
-rw-r--r--cc/trees/layer_tree_host_unittest.cc2
-rw-r--r--cc/trees/layer_tree_impl.cc21
-rw-r--r--cc/trees/layer_tree_impl.h9
-rw-r--r--content/browser/renderer_host/render_widget_host_view_android.cc8
-rw-r--r--content/renderer/gpu/render_widget_compositor.cc5
-rw-r--r--ui/compositor/compositor.cc5
-rw-r--r--ui/events/latency_info.cc7
-rw-r--r--ui/events/latency_info.h15
17 files changed, 169 insertions, 57 deletions
diff --git a/cc/base/latency_info_swap_promise.cc b/cc/base/latency_info_swap_promise.cc
new file mode 100644
index 0000000..41c0e997
--- /dev/null
+++ b/cc/base/latency_info_swap_promise.cc
@@ -0,0 +1,50 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "cc/base/latency_info_swap_promise.h"
+
+#include "base/logging.h"
+
+namespace {
+ ui::LatencyComponentType DidNotSwapReasonToLatencyComponentType(
+ cc::SwapPromise::DidNotSwapReason reason) {
+ switch (reason) {
+ case cc::SwapPromise::DID_NOT_SWAP_UNKNOWN:
+ case cc::SwapPromise::SWAP_FAILS:
+ return ui::INPUT_EVENT_LATENCY_TERMINATED_SWAP_FAILED_COMPONENT;
+ case cc::SwapPromise::COMMIT_FAILS:
+ return ui::INPUT_EVENT_LATENCY_TERMINATED_COMMIT_FAILED_COMPONENT;
+ case cc::SwapPromise::SWAP_PROMISE_LIST_OVERFLOW:
+ return ui::LATENCY_INFO_LIST_TERMINATED_OVERFLOW_COMPONENT;
+ }
+ NOTREACHED() << "Unhandled DidNotSwapReason.";
+ return ui::INPUT_EVENT_LATENCY_TERMINATED_SWAP_FAILED_COMPONENT;
+ }
+} // namespace
+
+namespace cc {
+
+LatencyInfoSwapPromise::LatencyInfoSwapPromise(const ui::LatencyInfo& latency)
+ : latency_(latency) {
+}
+
+LatencyInfoSwapPromise::~LatencyInfoSwapPromise() {
+}
+
+void LatencyInfoSwapPromise::DidSwap(CompositorFrameMetadata* metadata) {
+ DCHECK(!latency_.terminated);
+ // TODO(miletus): Append the |latency_| into metadata's LatencyInfo list
+ // once we remove LatencyInfo merge in GPU side.
+ metadata->latency_info.MergeWith(latency_);
+}
+
+void LatencyInfoSwapPromise::DidNotSwap(DidNotSwapReason reason) {
+ latency_.AddLatencyNumber(DidNotSwapReasonToLatencyComponentType(reason),
+ 0, 0);
+ // TODO(miletus): Turn this back on once per-event LatencyInfo tracking
+ // is enabled in GPU side.
+ // DCHECK(latency_.terminated);
+}
+
+} // namespace cc
diff --git a/cc/base/latency_info_swap_promise.h b/cc/base/latency_info_swap_promise.h
new file mode 100644
index 0000000..1a2b1d6
--- /dev/null
+++ b/cc/base/latency_info_swap_promise.h
@@ -0,0 +1,28 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CC_BASE_LATENCY_INFO_SWAP_PROMISE_H_
+#define CC_BASE_LATENCY_INFO_SWAP_PROMISE_H_
+
+#include "base/compiler_specific.h"
+#include "cc/base/swap_promise.h"
+#include "ui/events/latency_info.h"
+
+namespace cc {
+
+class CC_EXPORT LatencyInfoSwapPromise : public SwapPromise {
+ public:
+ explicit LatencyInfoSwapPromise(const ui::LatencyInfo& latency_info);
+ virtual ~LatencyInfoSwapPromise();
+
+ virtual void DidSwap(CompositorFrameMetadata* metadata) OVERRIDE;
+ virtual void DidNotSwap(DidNotSwapReason reason) OVERRIDE;
+
+ private:
+ ui::LatencyInfo latency_;
+};
+
+} // namespace cc
+
+#endif // CC_BASE_LATENCY_INFO_SWAP_PROMISE_H_
diff --git a/cc/base/swap_promise.h b/cc/base/swap_promise.h
index 90bf6af..36a5b13 100644
--- a/cc/base/swap_promise.h
+++ b/cc/base/swap_promise.h
@@ -5,6 +5,8 @@
#ifndef CC_BASE_SWAP_PROMISE_H_
#define CC_BASE_SWAP_PROMISE_H_
+#include "cc/output/compositor_frame_metadata.h"
+
namespace cc {
const unsigned int kMaxQueuedSwapPromiseNumber = 100;
@@ -27,11 +29,8 @@ const unsigned int kMaxQueuedSwapPromiseNumber = 100;
// DidNotSwap() are called at a particular thread. It is better to let the
// subclass carry thread-safe member data and operate on that member data in
// DidSwap() and DidNotSwap().
-class SwapPromise {
+class CC_EXPORT SwapPromise {
public:
- SwapPromise() {}
- virtual ~SwapPromise() {}
-
enum DidNotSwapReason {
DID_NOT_SWAP_UNKNOWN,
SWAP_FAILS,
@@ -39,7 +38,10 @@ class SwapPromise {
SWAP_PROMISE_LIST_OVERFLOW,
};
- virtual void DidSwap() = 0;
+ SwapPromise() {}
+ virtual ~SwapPromise() {}
+
+ virtual void DidSwap(CompositorFrameMetadata* metadata) = 0;
virtual void DidNotSwap(DidNotSwapReason reason) = 0;
};
diff --git a/cc/cc.gyp b/cc/cc.gyp
index 3914f41..847a428 100644
--- a/cc/cc.gyp
+++ b/cc/cc.gyp
@@ -58,6 +58,8 @@
'base/completion_event.h',
'base/invalidation_region.cc',
'base/invalidation_region.h',
+ 'base/latency_info_swap_promise.cc',
+ 'base/latency_info_swap_promise.h',
'base/math_util.cc',
'base/math_util.h',
'base/ref_counted_managed.h',
diff --git a/cc/cc_tests.gyp b/cc/cc_tests.gyp
index 5b318fa27..a3666ec 100644
--- a/cc/cc_tests.gyp
+++ b/cc/cc_tests.gyp
@@ -218,6 +218,7 @@
'../skia/skia.gyp:skia',
'../testing/gmock.gyp:gmock',
'../testing/gtest.gyp:gtest',
+ '../ui/events/events.gyp:events_base',
'../ui/gfx/gfx.gyp:gfx',
'../webkit/common/gpu/webkit_gpu.gyp:webkit_gpu',
'cc.gyp:cc',
diff --git a/cc/trees/layer_tree_host.cc b/cc/trees/layer_tree_host.cc
index ac471c3..b5c368b 100644
--- a/cc/trees/layer_tree_host.cc
+++ b/cc/trees/layer_tree_host.cc
@@ -382,8 +382,6 @@ void LayerTreeHost::FinishCommitOnImplThread(LayerTreeHostImpl* host_impl) {
min_page_scale_factor_,
max_page_scale_factor_);
sync_tree->SetPageScaleDelta(page_scale_delta / sent_page_scale_delta);
- sync_tree->SetLatencyInfo(latency_info_);
- latency_info_.Clear();
sync_tree->PassSwapPromises(&swap_promise_list_);
@@ -705,10 +703,6 @@ void LayerTreeHost::SetVisible(bool visible) {
proxy_->SetVisible(visible);
}
-void LayerTreeHost::SetLatencyInfo(const ui::LatencyInfo& latency_info) {
- latency_info_.MergeWith(latency_info);
-}
-
void LayerTreeHost::StartPageScaleAnimation(gfx::Vector2d target_offset,
bool use_anchor,
float scale,
@@ -1271,9 +1265,6 @@ bool LayerTreeHost::ScheduleMicroBenchmark(
}
void LayerTreeHost::QueueSwapPromise(scoped_ptr<SwapPromise> swap_promise) {
- if (proxy_->HasImplThread()) {
- DCHECK(proxy_->CommitRequested() || proxy_->BeginMainFrameRequested());
- }
DCHECK(swap_promise);
if (swap_promise_list_.size() > kMaxQueuedSwapPromiseNumber)
BreakSwapPromises(SwapPromise::SWAP_PROMISE_LIST_OVERFLOW);
diff --git a/cc/trees/layer_tree_host.h b/cc/trees/layer_tree_host.h
index 47bfa11..adc559f 100644
--- a/cc/trees/layer_tree_host.h
+++ b/cc/trees/layer_tree_host.h
@@ -37,7 +37,6 @@
#include "cc/trees/occlusion_tracker.h"
#include "cc/trees/proxy.h"
#include "third_party/skia/include/core/SkColor.h"
-#include "ui/events/latency_info.h"
#include "ui/gfx/rect.h"
namespace cc {
@@ -233,7 +232,6 @@ class CC_EXPORT LayerTreeHost {
void ApplyScrollAndScale(const ScrollAndScaleSet& info);
void SetImplTransform(const gfx::Transform& transform);
- void SetLatencyInfo(const ui::LatencyInfo& latency_info);
// Virtual for tests.
virtual void StartRateLimiter();
@@ -415,8 +413,6 @@ class CC_EXPORT LayerTreeHost {
bool in_paint_layer_contents_;
- ui::LatencyInfo latency_info_;
-
static const int kTotalFramesToUseForLCDTextMetrics = 50;
int total_frames_used_for_lcd_text_metrics_;
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc
index 21d71cf..67b7a1a 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -15,6 +15,7 @@
#include "base/strings/stringprintf.h"
#include "cc/animation/scrollbar_animation_controller.h"
#include "cc/animation/timing_function.h"
+#include "cc/base/latency_info_swap_promise.h"
#include "cc/base/math_util.h"
#include "cc/base/util.h"
#include "cc/debug/benchmark_instrumentation.h"
@@ -474,7 +475,9 @@ bool LayerTreeHostImpl::HaveTouchEventHandlersAt(gfx::Point viewport_point) {
void LayerTreeHostImpl::SetLatencyInfoForInputEvent(
const ui::LatencyInfo& latency_info) {
- active_tree()->SetLatencyInfo(latency_info);
+ scoped_ptr<SwapPromise> swap_promise(
+ new LatencyInfoSwapPromise(latency_info));
+ active_tree()->QueueSwapPromise(swap_promise.Pass());
}
void LayerTreeHostImpl::TrackDamageForAllSurfaces(
@@ -1269,7 +1272,6 @@ CompositorFrameMetadata LayerTreeHostImpl::MakeCompositorFrameMetadata() const {
metadata.root_layer_size = active_tree_->ScrollableSize();
metadata.min_page_scale_factor = active_tree_->min_page_scale_factor();
metadata.max_page_scale_factor = active_tree_->max_page_scale_factor();
- metadata.latency_info = active_tree_->GetLatencyInfo();
if (top_controls_manager_) {
metadata.location_bar_offset =
gfx::Vector2dF(0.f, top_controls_manager_->controls_top_offset());
@@ -1428,9 +1430,8 @@ bool LayerTreeHostImpl::SwapBuffers(const LayerTreeHostImpl::FrameData& frame) {
return false;
}
CompositorFrameMetadata metadata = MakeCompositorFrameMetadata();
+ active_tree()->FinishSwapPromises(&metadata);
renderer_->SwapBuffers(metadata);
- active_tree_->ClearLatencyInfo();
- active_tree()->FinishSwapPromises();
return true;
}
diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc
index 4439ff3..e8bd22a1 100644
--- a/cc/trees/layer_tree_host_impl_unittest.cc
+++ b/cc/trees/layer_tree_host_impl_unittest.cc
@@ -5335,5 +5335,44 @@ TEST_F(LayerTreeHostImplTest, WheelFlingShouldBubble) {
}
}
+// Make sure LatencyInfo carried by LatencyInfoSwapPromise are passed
+// to CompositorFrameMetadata after SwapBuffers();
+TEST_F(LayerTreeHostImplTest, LatencyInfoPassedToCompositorFrameMetadata) {
+ scoped_ptr<SolidColorLayerImpl> root =
+ SolidColorLayerImpl::Create(host_impl_->active_tree(), 1);
+ root->SetAnchorPoint(gfx::PointF());
+ root->SetPosition(gfx::PointF());
+ root->SetBounds(gfx::Size(10, 10));
+ root->SetContentBounds(gfx::Size(10, 10));
+ root->SetDrawsContent(true);
+
+ host_impl_->active_tree()->SetRootLayer(root.PassAs<LayerImpl>());
+
+ FakeOutputSurface* fake_output_surface =
+ static_cast<FakeOutputSurface*>(host_impl_->output_surface());
+
+ const ui::LatencyInfo& metadata_latency_before =
+ fake_output_surface->last_sent_frame().metadata.latency_info;
+ EXPECT_FALSE(metadata_latency_before.FindLatency(
+ ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, 0, NULL));
+
+ ui::LatencyInfo latency_info;
+ latency_info.AddLatencyNumber(
+ ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, 0, 0);
+ host_impl_->SetLatencyInfoForInputEvent(latency_info);
+
+ gfx::Rect full_frame_damage(host_impl_->DrawViewportSize());
+ LayerTreeHostImpl::FrameData frame;
+ EXPECT_TRUE(host_impl_->PrepareToDraw(&frame, gfx::Rect()));
+ host_impl_->DrawLayers(&frame, gfx::FrameTime::Now());
+ host_impl_->DidDrawAllLayers(frame);
+ EXPECT_TRUE(host_impl_->SwapBuffers(frame));
+
+ const ui::LatencyInfo& metadata_latency_after =
+ fake_output_surface->last_sent_frame().metadata.latency_info;
+ EXPECT_TRUE(metadata_latency_after.FindLatency(
+ ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, 0, NULL));
+}
+
} // namespace
} // namespace cc
diff --git a/cc/trees/layer_tree_host_unittest.cc b/cc/trees/layer_tree_host_unittest.cc
index e7dfa97..fa70d95 100644
--- a/cc/trees/layer_tree_host_unittest.cc
+++ b/cc/trees/layer_tree_host_unittest.cc
@@ -5241,7 +5241,7 @@ class TestSwapPromise : public SwapPromise {
result_->dtor_called = true;
}
- virtual void DidSwap() OVERRIDE {
+ virtual void DidSwap(CompositorFrameMetadata* metadata) OVERRIDE {
base::AutoLock lock(result_->lock);
EXPECT_FALSE(result_->did_swap_called);
EXPECT_FALSE(result_->did_not_swap_called);
diff --git a/cc/trees/layer_tree_impl.cc b/cc/trees/layer_tree_impl.cc
index ea3218d..eb1d471 100644
--- a/cc/trees/layer_tree_impl.cc
+++ b/cc/trees/layer_tree_impl.cc
@@ -120,9 +120,6 @@ void LayerTreeImpl::PushPropertiesTo(LayerTreeImpl* target_tree) {
next_activation_forces_redraw_ = false;
}
- target_tree->SetLatencyInfo(latency_info_);
- latency_info_.Clear();
-
target_tree->PassSwapPromises(&swap_promise_list_);
target_tree->SetPageScaleFactorAndLimits(
@@ -464,8 +461,6 @@ void LayerTreeImpl::PushPersistedState(LayerTreeImpl* pending_tree) {
pending_tree->SetCurrentlyScrollingLayer(
LayerTreeHostCommon::FindLayerInSubtree(pending_tree->root_layer(),
currently_scrolling_layer_ ? currently_scrolling_layer_->id() : 0));
- pending_tree->SetLatencyInfo(latency_info_);
- latency_info_.Clear();
}
static void DidBecomeActiveRecursive(LayerImpl* layer) {
@@ -699,18 +694,6 @@ void LayerTreeImpl::UpdateRootScrollLayerSizeDelta() {
scrollable_viewport_size - original_viewport_size);
}
-void LayerTreeImpl::SetLatencyInfo(const ui::LatencyInfo& latency_info) {
- latency_info_.MergeWith(latency_info);
-}
-
-const ui::LatencyInfo& LayerTreeImpl::GetLatencyInfo() {
- return latency_info_;
-}
-
-void LayerTreeImpl::ClearLatencyInfo() {
- latency_info_.Clear();
-}
-
void LayerTreeImpl::QueueSwapPromise(scoped_ptr<SwapPromise> swap_promise) {
DCHECK(swap_promise);
if (swap_promise_list_.size() > kMaxQueuedSwapPromiseNumber)
@@ -725,9 +708,9 @@ void LayerTreeImpl::PassSwapPromises(
new_swap_promise->clear();
}
-void LayerTreeImpl::FinishSwapPromises() {
+void LayerTreeImpl::FinishSwapPromises(CompositorFrameMetadata* metadata) {
for (size_t i = 0; i < swap_promise_list_.size(); i++)
- swap_promise_list_[i]->DidSwap();
+ swap_promise_list_[i]->DidSwap(metadata);
swap_promise_list_.clear();
}
diff --git a/cc/trees/layer_tree_impl.h b/cc/trees/layer_tree_impl.h
index 63d01ef..d27cd6d 100644
--- a/cc/trees/layer_tree_impl.h
+++ b/cc/trees/layer_tree_impl.h
@@ -15,7 +15,6 @@
#include "cc/base/swap_promise.h"
#include "cc/layers/layer_impl.h"
#include "cc/resources/ui_resource_client.h"
-#include "ui/events/latency_info.h"
#if defined(COMPILER_GCC)
namespace BASE_HASH_NAMESPACE {
@@ -207,17 +206,13 @@ class CC_EXPORT LayerTreeImpl {
void SetRootLayerScrollOffsetDelegate(
LayerScrollOffsetDelegate* root_layer_scroll_offset_delegate);
- void SetLatencyInfo(const ui::LatencyInfo& latency_info);
- const ui::LatencyInfo& GetLatencyInfo();
- void ClearLatencyInfo();
-
// Call this function when you expect there to be a swap buffer.
// See swap_promise.h for how to use SwapPromise.
void QueueSwapPromise(scoped_ptr<SwapPromise> swap_promise);
// Take the |new_swap_promise| and append it to |swap_promise_list_|.
void PassSwapPromises(ScopedPtrVector<SwapPromise>* new_swap_promise);
- void FinishSwapPromises();
+ void FinishSwapPromises(CompositorFrameMetadata* metadata);
void BreakSwapPromises(SwapPromise::DidNotSwapReason reason);
void DidModifyTilePriorities();
@@ -280,8 +275,6 @@ class CC_EXPORT LayerTreeImpl {
bool next_activation_forces_redraw_;
- ui::LatencyInfo latency_info_;
-
ScopedPtrVector<SwapPromise> swap_promise_list_;
UIResourceRequestQueue ui_resource_request_queue_;
diff --git a/content/browser/renderer_host/render_widget_host_view_android.cc b/content/browser/renderer_host/render_widget_host_view_android.cc
index a481504..c8c559b 100644
--- a/content/browser/renderer_host/render_widget_host_view_android.cc
+++ b/content/browser/renderer_host/render_widget_host_view_android.cc
@@ -14,6 +14,7 @@
#include "base/message_loop/message_loop.h"
#include "base/strings/utf_string_conversions.h"
#include "base/threading/worker_pool.h"
+#include "cc/base/latency_info_swap_promise.h"
#include "cc/layers/delegated_frame_provider.h"
#include "cc/layers/delegated_renderer_layer.h"
#include "cc/layers/layer.h"
@@ -779,8 +780,11 @@ void RenderWidgetHostViewAndroid::OnSwapCompositorFrame(
texture_size_in_layer_ = frame->gl_frame_data->size;
ComputeContentsSize(frame->metadata);
- if (layer_->layer_tree_host())
- layer_->layer_tree_host()->SetLatencyInfo(frame->metadata.latency_info);
+ if (layer_->layer_tree_host()) {
+ scoped_ptr<cc::SwapPromise> swap_promise(
+ new cc::LatencyInfoSwapPromise(frame->metadata.latency_info));
+ layer_->layer_tree_host()->QueueSwapPromise(swap_promise.Pass());
+ }
BuffersSwapped(frame->gl_frame_data->mailbox, output_surface_id, callback);
}
diff --git a/content/renderer/gpu/render_widget_compositor.cc b/content/renderer/gpu/render_widget_compositor.cc
index 917aba7..b0b4433 100644
--- a/content/renderer/gpu/render_widget_compositor.cc
+++ b/content/renderer/gpu/render_widget_compositor.cc
@@ -17,6 +17,7 @@
#include "base/synchronization/lock.h"
#include "base/time/time.h"
#include "base/values.h"
+#include "cc/base/latency_info_swap_promise.h"
#include "cc/base/switches.h"
#include "cc/debug/layer_tree_debug_state.h"
#include "cc/debug/micro_benchmark.h"
@@ -391,7 +392,9 @@ void RenderWidgetCompositor::SetNeedsForcedRedraw() {
void RenderWidgetCompositor::SetLatencyInfo(
const ui::LatencyInfo& latency_info) {
- layer_tree_host_->SetLatencyInfo(latency_info);
+ scoped_ptr<cc::SwapPromise> swap_promise(
+ new cc::LatencyInfoSwapPromise(latency_info));
+ layer_tree_host_->QueueSwapPromise(swap_promise.Pass());
}
int RenderWidgetCompositor::GetLayerTreeId() const {
diff --git a/ui/compositor/compositor.cc b/ui/compositor/compositor.cc
index b4ad3ef..1232866 100644
--- a/ui/compositor/compositor.cc
+++ b/ui/compositor/compositor.cc
@@ -17,6 +17,7 @@
#include "base/sys_info.h"
#include "base/threading/thread.h"
#include "base/threading/thread_restrictions.h"
+#include "cc/base/latency_info_swap_promise.h"
#include "cc/base/switches.h"
#include "cc/input/input_handler.h"
#include "cc/layers/layer.h"
@@ -437,7 +438,9 @@ void Compositor::ScheduleRedrawRect(const gfx::Rect& damage_rect) {
}
void Compositor::SetLatencyInfo(const ui::LatencyInfo& latency_info) {
- host_->SetLatencyInfo(latency_info);
+ scoped_ptr<cc::SwapPromise> swap_promise(
+ new cc::LatencyInfoSwapPromise(latency_info));
+ host_->QueueSwapPromise(swap_promise.Pass());
}
bool Compositor::ReadPixels(SkBitmap* bitmap,
diff --git a/ui/events/latency_info.cc b/ui/events/latency_info.cc
index 754f580..9972999 100644
--- a/ui/events/latency_info.cc
+++ b/ui/events/latency_info.cc
@@ -21,10 +21,14 @@ const char* GetComponentName(ui::LatencyComponentType type) {
CASE_TYPE(INPUT_EVENT_LATENCY_UI_COMPONENT);
CASE_TYPE(INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_COMPONENT);
CASE_TYPE(INPUT_EVENT_LATENCY_ACKED_TOUCH_COMPONENT);
+ CASE_TYPE(WINDOW_SNAPSHOT_FRAME_NUMBER_COMPONENT);
CASE_TYPE(INPUT_EVENT_LATENCY_TERMINATED_MOUSE_COMPONENT);
CASE_TYPE(INPUT_EVENT_LATENCY_TERMINATED_TOUCH_COMPONENT);
CASE_TYPE(INPUT_EVENT_LATENCY_TERMINATED_GESTURE_COMPONENT);
CASE_TYPE(INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT);
+ CASE_TYPE(INPUT_EVENT_LATENCY_TERMINATED_COMMIT_FAILED_COMPONENT);
+ CASE_TYPE(INPUT_EVENT_LATENCY_TERMINATED_SWAP_FAILED_COMPONENT);
+ CASE_TYPE(LATENCY_INFO_LIST_TERMINATED_OVERFLOW_COMPONENT);
default:
DLOG(WARNING) << "Unhandled LatencyComponentType.\n";
break;
@@ -39,6 +43,9 @@ bool IsTerminalComponent(ui::LatencyComponentType type) {
case ui::INPUT_EVENT_LATENCY_TERMINATED_TOUCH_COMPONENT:
case ui::INPUT_EVENT_LATENCY_TERMINATED_GESTURE_COMPONENT:
case ui::INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT:
+ case ui::INPUT_EVENT_LATENCY_TERMINATED_COMMIT_FAILED_COMPONENT:
+ case ui::INPUT_EVENT_LATENCY_TERMINATED_SWAP_FAILED_COMPONENT:
+ case ui::LATENCY_INFO_LIST_TERMINATED_OVERFLOW_COMPONENT:
return true;
default:
return false;
diff --git a/ui/events/latency_info.h b/ui/events/latency_info.h
index ea3293c..7b70654 100644
--- a/ui/events/latency_info.h
+++ b/ui/events/latency_info.h
@@ -38,6 +38,9 @@ enum LatencyComponentType {
INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_COMPONENT,
// Timestamp when the touch event is acked.
INPUT_EVENT_LATENCY_ACKED_TOUCH_COMPONENT,
+ // Frame number when a window snapshot was requested. The snapshot
+ // is taken when the rendering results actually reach the screen.
+ WINDOW_SNAPSHOT_FRAME_NUMBER_COMPONENT,
// ---------------------------TERMINAL COMPONENT-----------------------------
// TERMINAL COMPONENT is when we show the latency end in chrome://tracing.
// Timestamp when the mouse event is acked from renderer and it does not
@@ -52,9 +55,15 @@ enum LatencyComponentType {
// Timestamp when the frame is swapped (i.e. when the rendering caused by
// input event actually takes effect).
INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT,
- // Frame number when a window snapshot was requested. The snapshot
- // is taken when the rendering results actually reach the screen.
- WINDOW_SNAPSHOT_FRAME_NUMBER_COMPONENT
+ // This component indicates that the input causes a commit to be scheduled
+ // but the commit failed.
+ INPUT_EVENT_LATENCY_TERMINATED_COMMIT_FAILED_COMPONENT,
+ // This component indicates that the input causes a swap to be scheduled
+ // but the swap failed.
+ INPUT_EVENT_LATENCY_TERMINATED_SWAP_FAILED_COMPONENT,
+ // This component indicates that the cached LatencyInfo number exceeds the
+ // maximal allowed size.
+ LATENCY_INFO_LIST_TERMINATED_OVERFLOW_COMPONENT,
};
struct EVENTS_BASE_EXPORT LatencyInfo {