IndexedDBFactory now ForceCloses databases.
[chromium-blink-merge.git] / content / browser / aura / software_browser_compositor_output_surface.cc
blob6516f93948a81fc173c19da523c1cf2921cc800f
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.
5 #include "content/browser/aura/software_browser_compositor_output_surface.h"
7 #include "base/memory/ref_counted.h"
8 #include "base/message_loop/message_loop.h"
9 #include "base/time/time.h"
10 #include "cc/output/compositor_frame.h"
11 #include "cc/output/software_output_device.h"
12 #include "content/browser/aura/browser_compositor_output_surface_proxy.h"
13 #include "content/browser/renderer_host/render_widget_host_impl.h"
14 #include "ui/events/latency_info.h"
15 #include "ui/gfx/vsync_provider.h"
17 namespace content {
19 SoftwareBrowserCompositorOutputSurface::SoftwareBrowserCompositorOutputSurface(
20 scoped_refptr<BrowserCompositorOutputSurfaceProxy> surface_proxy,
21 scoped_ptr<cc::SoftwareOutputDevice> software_device,
22 int surface_id,
23 IDMap<BrowserCompositorOutputSurface>* output_surface_map,
24 base::MessageLoopProxy* compositor_message_loop,
25 base::WeakPtr<ui::Compositor> compositor)
26 : BrowserCompositorOutputSurface(software_device.Pass(),
27 surface_id,
28 output_surface_map,
29 compositor_message_loop,
30 compositor),
31 output_surface_proxy_(surface_proxy) {}
33 SoftwareBrowserCompositorOutputSurface::
34 ~SoftwareBrowserCompositorOutputSurface() {}
36 void SoftwareBrowserCompositorOutputSurface::SwapBuffers(
37 cc::CompositorFrame* frame) {
38 // TODO(miletus) : Convert RenderWidgetHostImpl::CompositorFrameDrawn() to
39 // take std::vector<ui::LatencyInfo> directly so we only post the task once.
40 for (size_t i = 0; i < frame->metadata.latency_info.size(); i++) {
41 frame->metadata.latency_info[i].AddLatencyNumber(
42 ui::INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT, 0, 0);
43 base::MessageLoop::current()->PostTask(
44 FROM_HERE,
45 base::Bind(
46 &RenderWidgetHostImpl::CompositorFrameDrawn,
47 frame->metadata.latency_info[i]));
50 gfx::VSyncProvider* vsync_provider = software_device()->GetVSyncProvider();
51 if (vsync_provider) {
52 vsync_provider->GetVSyncParameters(
53 base::Bind(&BrowserCompositorOutputSurfaceProxy::
54 OnUpdateVSyncParametersOnCompositorThread,
55 output_surface_proxy_,
56 surface_id_));
60 } // namespace content