Rename InputLatency::ScrollUpdate to Latency::ScrollUpdate
[chromium-blink-merge.git] / components / surfaces / display_impl.h
blobd10150d9208496a36ea09d2d7fa3faec84d886bc
1 // Copyright 2015 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 #ifndef COMPONENTS_SURFACES_DISPLAY_IMPL_H_
6 #define COMPONENTS_SURFACES_DISPLAY_IMPL_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "cc/surfaces/display_client.h"
10 #include "cc/surfaces/surface_factory.h"
11 #include "cc/surfaces/surface_factory_client.h"
12 #include "components/surfaces/public/interfaces/display.mojom.h"
13 #include "third_party/mojo/src/mojo/public/cpp/bindings/strong_binding.h"
15 namespace cc {
16 class Display;
17 class SurfaceFactory;
20 namespace surfaces {
21 class SurfacesScheduler;
23 class DisplayImpl : public mojo::Display,
24 public mojo::ViewportParameterListener,
25 public cc::DisplayClient,
26 public cc::SurfaceFactoryClient {
27 public:
28 DisplayImpl(cc::SurfaceManager* manager,
29 cc::SurfaceId cc_id,
30 SurfacesScheduler* scheduler,
31 mojo::ContextProviderPtr context_provider,
32 mojo::ResourceReturnerPtr returner,
33 mojo::InterfaceRequest<mojo::Display> display_request);
34 ~DisplayImpl() override;
36 private:
37 void OnContextCreated(mojo::CommandBufferPtr gles2_client);
39 // mojo::Display implementation:
40 void SubmitFrame(mojo::FramePtr frame,
41 const SubmitFrameCallback& callback) override;
43 // DisplayClient implementation.
44 void DisplayDamaged() override;
45 void DidSwapBuffers() override;
46 void DidSwapBuffersComplete() override;
47 void CommitVSyncParameters(base::TimeTicks timebase,
48 base::TimeDelta interval) override;
49 void OutputSurfaceLost() override;
50 void SetMemoryPolicy(const cc::ManagedMemoryPolicy& policy) override;
52 // ViewportParameterListener
53 void OnVSyncParametersUpdated(int64_t timebase, int64_t interval) override;
55 // SurfaceFactoryClient implementation.
56 void ReturnResources(const cc::ReturnedResourceArray& resources) override;
58 void Draw();
60 cc::SurfaceManager* manager_;
61 cc::SurfaceFactory factory_;
62 cc::SurfaceId cc_id_;
63 SurfacesScheduler* scheduler_;
64 mojo::ContextProviderPtr context_provider_;
65 mojo::ResourceReturnerPtr returner_;
67 mojo::FramePtr pending_frame_;
68 SubmitFrameCallback pending_callback_;
70 scoped_ptr<cc::Display> display_;
72 mojo::Binding<mojo::ViewportParameterListener> viewport_param_binding_;
73 mojo::StrongBinding<mojo::Display> display_binding_;
75 DISALLOW_COPY_AND_ASSIGN(DisplayImpl);
78 } // namespace surfaces
80 #endif // COMPONENTS_SURFACES_DISPLAY_IMPL_H_