Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / mojo / services / surfaces / surfaces_impl.h
blobbf6f37b324a34df4bb882cb4f53cf3f72aafcd64
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.
5 #ifndef MOJO_SERVICES_SURFACES_SURFACES_IMPL_H_
6 #define MOJO_SERVICES_SURFACES_SURFACES_IMPL_H_
8 #include "base/compiler_specific.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/application/application_connection.h"
13 #include "mojo/services/gles2/command_buffer.mojom.h"
14 #include "mojo/services/public/interfaces/surfaces/surfaces.mojom.h"
16 namespace cc {
17 class Display;
20 namespace mojo {
21 class ApplicationManager;
23 class SurfaceNativeViewportClient;
25 class SurfacesImpl : public InterfaceImpl<Surface>,
26 public cc::SurfaceFactoryClient,
27 public cc::DisplayClient {
28 public:
29 class Client {
30 public:
31 virtual void FrameSubmitted() = 0;
32 virtual void SetDisplay(cc::Display*) = 0;
35 SurfacesImpl(cc::SurfaceManager* manager,
36 uint32_t id_namespace,
37 Client* client);
38 virtual ~SurfacesImpl();
40 // Surface implementation.
41 virtual void CreateSurface(SurfaceIdPtr id, mojo::SizePtr size) OVERRIDE;
42 virtual void SubmitFrame(SurfaceIdPtr id, FramePtr frame) OVERRIDE;
43 virtual void DestroySurface(SurfaceIdPtr id) OVERRIDE;
44 virtual void CreateGLES2BoundSurface(CommandBufferPtr gles2_client,
45 SurfaceIdPtr id,
46 mojo::SizePtr size) OVERRIDE;
48 // SurfaceFactoryClient implementation.
49 virtual void ReturnResources(
50 const cc::ReturnedResourceArray& resources) OVERRIDE;
52 // DisplayClient implementation.
53 virtual scoped_ptr<cc::OutputSurface> CreateOutputSurface() OVERRIDE;
54 virtual void DisplayDamaged() OVERRIDE;
56 cc::SurfaceFactory* factory() { return &factory_; }
58 private:
59 cc::SurfaceManager* manager_;
60 cc::SurfaceFactory factory_;
61 uint32_t id_namespace_;
62 Client* client_;
63 scoped_ptr<cc::Display> display_;
64 ScopedMessagePipeHandle command_buffer_handle_;
66 DISALLOW_COPY_AND_ASSIGN(SurfacesImpl);
69 } // namespace mojo
71 #endif // MOJO_SERVICES_SURFACES_SURFACES_IMPL_H_