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

Side by Side Diff: sky/compositor/surface_holder.h

Issue 756673004: Surfaces should acknowledge frame submissions (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef SKY_COMPOSITOR_SURFACE_HOLDER_H_ 5 #ifndef SKY_COMPOSITOR_SURFACE_HOLDER_H_
6 #define SKY_COMPOSITOR_SURFACE_HOLDER_H_ 6 #define SKY_COMPOSITOR_SURFACE_HOLDER_H_
7 7
8 #include "base/callback_forward.h"
8 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
9 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
10 #include "mojo/services/public/interfaces/surfaces/surface_id.mojom.h" 11 #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.mojom.h"
12 #include "mojo/services/public/interfaces/surfaces/surfaces_service.mojom.h" 13 #include "mojo/services/public/interfaces/surfaces/surfaces_service.mojom.h"
13 #include "ui/gfx/geometry/rect.h" 14 #include "ui/gfx/geometry/rect.h"
14 15
15 namespace mojo { 16 namespace mojo {
16 class Shell; 17 class Shell;
17 } 18 }
18 19
19 namespace sky { 20 namespace sky {
20 class SurfaceAllocator; 21 class SurfaceAllocator;
21 22
22 class SurfaceHolder : public mojo::SurfaceClient { 23 class SurfaceHolder : public mojo::SurfaceClient {
23 public: 24 public:
24 class Client { 25 class Client {
25 public: 26 public:
27 virtual void OnSurfaceConnectionCreated() = 0;
26 virtual void OnSurfaceIdAvailable(mojo::SurfaceIdPtr surface_id) = 0; 28 virtual void OnSurfaceIdAvailable(mojo::SurfaceIdPtr surface_id) = 0;
27 virtual void ReturnResources( 29 virtual void ReturnResources(
28 mojo::Array<mojo::ReturnedResourcePtr> resources) = 0; 30 mojo::Array<mojo::ReturnedResourcePtr> resources) = 0;
29 31
30 protected: 32 protected:
31 virtual ~Client(); 33 virtual ~Client();
32 }; 34 };
33 35
34 explicit SurfaceHolder(Client* client, mojo::Shell* shell); 36 explicit SurfaceHolder(Client* client, mojo::Shell* shell);
35 ~SurfaceHolder() override; 37 ~SurfaceHolder() override;
36 38
37 bool IsReadyForFrame() const; 39 bool IsReadyForFrame() const;
38 40
39 void SetSize(const gfx::Size& size); 41 void SetSize(const gfx::Size& size);
40 void SubmitFrame(mojo::FramePtr frame); 42 void SubmitFrame(mojo::FramePtr frame, const base::Closure& callback);
41 43
42 private: 44 private:
43 // mojo::SurfaceClient 45 // mojo::SurfaceClient
44 void ReturnResources( 46 void ReturnResources(
45 mojo::Array<mojo::ReturnedResourcePtr> resources) override; 47 mojo::Array<mojo::ReturnedResourcePtr> resources) override;
46 48
47 void OnSurfaceConnectionCreated(mojo::SurfacePtr surface, 49 void OnSurfaceConnectionCreated(mojo::SurfacePtr surface,
48 uint32_t id_namespace); 50 uint32_t id_namespace);
49 51
50 Client* client_; 52 Client* client_;
51 gfx::Size size_; 53 gfx::Size size_;
52 scoped_ptr<SurfaceAllocator> surface_allocator_; 54 scoped_ptr<SurfaceAllocator> surface_allocator_;
53 mojo::SurfacesServicePtr surfaces_service_; 55 mojo::SurfacesServicePtr surfaces_service_;
54 mojo::SurfacePtr surface_; 56 mojo::SurfacePtr surface_;
55 mojo::SurfaceIdPtr surface_id_; 57 mojo::SurfaceIdPtr surface_id_;
56 58
57 base::WeakPtrFactory<SurfaceHolder> weak_factory_; 59 base::WeakPtrFactory<SurfaceHolder> weak_factory_;
58 60
59 DISALLOW_COPY_AND_ASSIGN(SurfaceHolder); 61 DISALLOW_COPY_AND_ASSIGN(SurfaceHolder);
60 }; 62 };
61 63
62 } // namespace sky 64 } // namespace sky
63 65
64 #endif // SKY_COMPOSITOR_SURFACE_HOLDER_H_ 66 #endif // SKY_COMPOSITOR_SURFACE_HOLDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698