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 SKY_COMPOSITOR_SURFACE_HOLDER_H_ |
| 6 #define SKY_COMPOSITOR_SURFACE_HOLDER_H_ |
| 7 |
| 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/memory/weak_ptr.h" |
| 10 #include "mojo/services/public/interfaces/surfaces/surface_id.mojom.h" |
| 11 #include "mojo/services/public/interfaces/surfaces/surfaces.mojom.h" |
| 12 #include "mojo/services/public/interfaces/surfaces/surfaces_service.mojom.h" |
| 13 #include "ui/gfx/geometry/rect.h" |
| 14 |
| 15 namespace mojo { |
| 16 class Shell; |
| 17 } |
| 18 |
| 19 namespace sky { |
| 20 class SurfaceAllocator; |
| 21 |
| 22 class SurfaceHolder : public mojo::SurfaceClient { |
| 23 public: |
| 24 class Client { |
| 25 public: |
| 26 virtual void OnReadyForNextFrame() = 0; |
| 27 virtual void OnSurfaceIdAvailable(mojo::SurfaceIdPtr surface_id) = 0; |
| 28 virtual void ReturnResources( |
| 29 mojo::Array<mojo::ReturnedResourcePtr> resources) = 0; |
| 30 |
| 31 protected: |
| 32 virtual ~Client(); |
| 33 }; |
| 34 |
| 35 explicit SurfaceHolder(Client* client, mojo::Shell* shell); |
| 36 ~SurfaceHolder() override; |
| 37 |
| 38 void SetSize(const gfx::Size& size); |
| 39 void SubmitFrame(mojo::FramePtr frame); |
| 40 |
| 41 private: |
| 42 // mojo::SurfaceClient |
| 43 void ReturnResources( |
| 44 mojo::Array<mojo::ReturnedResourcePtr> resources) override; |
| 45 |
| 46 void OnSurfaceConnectionCreated(mojo::SurfacePtr surface, |
| 47 uint32_t id_namespace); |
| 48 |
| 49 Client* client_; |
| 50 gfx::Size size_; |
| 51 scoped_ptr<SurfaceAllocator> surface_allocator_; |
| 52 mojo::SurfacesServicePtr surfaces_service_; |
| 53 mojo::SurfacePtr surface_; |
| 54 mojo::SurfaceIdPtr surface_id_; |
| 55 |
| 56 base::WeakPtrFactory<SurfaceHolder> weak_factory_; |
| 57 |
| 58 DISALLOW_COPY_AND_ASSIGN(SurfaceHolder); |
| 59 }; |
| 60 |
| 61 } // namespace sky |
| 62 |
| 63 #endif // SKY_COMPOSITOR_SURFACE_HOLDER_H_ |
OLD | NEW |