- add sources.
[platform/framework/web/crosswalk.git] / src / content / browser / aura / software_browser_compositor_output_surface.cc
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "content/browser/aura/software_browser_compositor_output_surface.h"
6
7 #include "base/message_loop/message_loop.h"
8 #include "base/time/time.h"
9 #include "cc/output/compositor_frame.h"
10 #include "cc/output/software_output_device.h"
11 #include "content/browser/renderer_host/render_widget_host_impl.h"
12 #include "ui/events/latency_info.h"
13
14 namespace content {
15
16 SoftwareBrowserCompositorOutputSurface::SoftwareBrowserCompositorOutputSurface(
17     scoped_ptr<cc::SoftwareOutputDevice> software_device)
18     : cc::OutputSurface(software_device.Pass()) {}
19
20 void SoftwareBrowserCompositorOutputSurface::SwapBuffers(
21     cc::CompositorFrame* frame) {
22   ui::LatencyInfo latency_info = frame->metadata.latency_info;
23   latency_info.AddLatencyNumber(
24       ui::INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT, 0, 0);
25
26   base::MessageLoop::current()->PostTask(
27       FROM_HERE,
28       base::Bind(
29           &RenderWidgetHostImpl::CompositorFrameDrawn,
30           latency_info));
31 }
32
33 }  // namespace content