OLD | NEW |
| (Empty) |
1 // Copyright 2014 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 MOJO_SERVICES_SURFACES_SURFACES_IMPL_H_ | |
6 #define MOJO_SERVICES_SURFACES_SURFACES_IMPL_H_ | |
7 | |
8 #include "cc/surfaces/display_client.h" | |
9 #include "cc/surfaces/surface_factory.h" | |
10 #include "cc/surfaces/surface_factory_client.h" | |
11 #include "mojo/public/cpp/application/application_connection.h" | |
12 #include "mojo/services/public/interfaces/gpu/command_buffer.mojom.h" | |
13 #include "mojo/services/public/interfaces/surfaces/surfaces.mojom.h" | |
14 | |
15 namespace cc { | |
16 class Display; | |
17 } | |
18 | |
19 namespace mojo { | |
20 class ApplicationManager; | |
21 | |
22 class SurfaceNativeViewportClient; | |
23 | |
24 class SurfacesImpl : public InterfaceImpl<Surface>, | |
25 public cc::SurfaceFactoryClient, | |
26 public cc::DisplayClient { | |
27 public: | |
28 class Client { | |
29 public: | |
30 virtual void FrameSubmitted() = 0; | |
31 virtual void SetDisplay(cc::Display*) = 0; | |
32 }; | |
33 | |
34 SurfacesImpl(cc::SurfaceManager* manager, | |
35 uint32_t id_namespace, | |
36 Client* client); | |
37 ~SurfacesImpl() override; | |
38 | |
39 // Surface implementation. | |
40 void CreateSurface(SurfaceIdPtr id, mojo::SizePtr size) override; | |
41 void SubmitFrame(SurfaceIdPtr id, FramePtr frame) override; | |
42 void DestroySurface(SurfaceIdPtr id) override; | |
43 void CreateGLES2BoundSurface(CommandBufferPtr gles2_client, | |
44 SurfaceIdPtr id, | |
45 mojo::SizePtr size) override; | |
46 | |
47 // SurfaceFactoryClient implementation. | |
48 void ReturnResources(const cc::ReturnedResourceArray& resources) override; | |
49 | |
50 // DisplayClient implementation. | |
51 void DisplayDamaged() override; | |
52 void DidSwapBuffers() override; | |
53 void DidSwapBuffersComplete() override; | |
54 void CommitVSyncParameters(base::TimeTicks timebase, | |
55 base::TimeDelta interval) override; | |
56 void OutputSurfaceLost() override; | |
57 void SetMemoryPolicy(const cc::ManagedMemoryPolicy& policy) override; | |
58 | |
59 cc::SurfaceFactory* factory() { return &factory_; } | |
60 | |
61 private: | |
62 cc::SurfaceManager* manager_; | |
63 cc::SurfaceFactory factory_; | |
64 uint32_t id_namespace_; | |
65 Client* client_; | |
66 scoped_ptr<cc::Display> display_; | |
67 ScopedMessagePipeHandle command_buffer_handle_; | |
68 | |
69 DISALLOW_COPY_AND_ASSIGN(SurfacesImpl); | |
70 }; | |
71 | |
72 } // namespace mojo | |
73 | |
74 #endif // MOJO_SERVICES_SURFACES_SURFACES_IMPL_H_ | |
OLD | NEW |