Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1056)

Side by Side Diff: services/surfaces/display_impl.h

Issue 940293003: Add a Display and ContextProvider concept to mojom, use to recreate (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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.
4
5 #ifndef SERVICES_SURFACES_DISPLAY_IMPL_H_
6 #define SERVICES_SURFACES_DISPLAY_IMPL_H_
7
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 "mojo/public/cpp/bindings/strong_binding.h"
13 #include "mojo/services/surfaces/public/interfaces/display.mojom.h"
14
15 namespace cc {
16 class Display;
17 class SurfaceFactory;
18 }
19
20 namespace surfaces {
21
22 class DisplayImpl : public mojo::Display,
23 public mojo::ViewportParameterListener,
24 public cc::DisplayClient,
25 public cc::SurfaceFactoryClient {
26 public:
27 class Client {
28 public:
29 virtual void FrameSubmitted() = 0;
30 virtual void OnVSyncParametersUpdated(base::TimeTicks timebase,
31 base::TimeDelta interval) = 0;
32 virtual void SetDisplay(cc::Display* display) = 0;
33 virtual void OnDisplayBeingDestroyed(cc::Display* display) = 0;
34 };
35
36 DisplayImpl(cc::SurfaceManager* manager,
37 cc::SurfaceId cc_id,
38 Client* client,
39 mojo::ContextProviderPtr context_provider,
40 mojo::ViewportParameterListenerPtr viewport_parameter_listener,
41 mojo::ResourceReturnerPtr returner,
42 mojo::InterfaceRequest<mojo::Display> display_request);
43 ~DisplayImpl() override;
44
45 private:
46 void OnContextCreated(mojo::CommandBufferPtr gles2_client);
47
48 // mojo::Display implementation:
49 void SubmitFrame(mojo::FramePtr frame,
50 const SubmitFrameCallback& callback) override;
51
52 // DisplayClient implementation.
53 void DisplayDamaged() override;
54 void DidSwapBuffers() override;
55 void DidSwapBuffersComplete() override;
56 void CommitVSyncParameters(base::TimeTicks timebase,
57 base::TimeDelta interval) override;
58 void OutputSurfaceLost() override;
59 void SetMemoryPolicy(const cc::ManagedMemoryPolicy& policy) override;
60
61 // ViewportParameterListener
62 void OnVSyncParametersUpdated(int64_t timebase, int64_t interval) override;
63
64 // SurfaceFactoryClient implementation.
65 void ReturnResources(const cc::ReturnedResourceArray& resources) override;
66
67 void Draw();
68
69 cc::SurfaceManager* manager_;
70 cc::SurfaceFactory factory_;
71 cc::SurfaceId cc_id_;
72 Client* client_;
73 mojo::ContextProviderPtr context_provider_;
74 mojo::ResourceReturnerPtr returner_;
75
76 mojo::FramePtr pending_frame_;
77 SubmitFrameCallback pending_callback_;
78
79 scoped_ptr<cc::Display> display_;
80
81 mojo::StrongBinding<mojo::Display> binding_;
82
83 DISALLOW_COPY_AND_ASSIGN(DisplayImpl);
84 };
85
86 } // namespace surfaces
87
88 #endif // SERVICES_SURFACES_DISPLAY_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698