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

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

Issue 826423008: Use local ids for Surfaces APIs that can only apply to local surfaces (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 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
« no previous file with comments | « sky/compositor/layer_host.cc ('k') | sky/compositor/surface_holder.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/callback_forward.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
11 #include "mojo/services/surfaces/public/interfaces/surface_id.mojom.h" 11 #include "mojo/services/surfaces/public/interfaces/surface_id.mojom.h"
12 #include "mojo/services/surfaces/public/interfaces/surfaces.mojom.h" 12 #include "mojo/services/surfaces/public/interfaces/surfaces.mojom.h"
13 #include "mojo/services/surfaces/public/interfaces/surfaces_service.mojom.h" 13 #include "mojo/services/surfaces/public/interfaces/surfaces_service.mojom.h"
14 #include "ui/gfx/geometry/rect.h" 14 #include "ui/gfx/geometry/rect.h"
15 15
16 namespace mojo { 16 namespace mojo {
17 class Shell; 17 class Shell;
18 } 18 }
19 19
20 namespace sky { 20 namespace sky {
21 class SurfaceAllocator; 21 class SurfaceAllocator;
22 22
23 class SurfaceHolder : public mojo::SurfaceClient { 23 class SurfaceHolder : public mojo::SurfaceClient {
24 public: 24 public:
25 class Client { 25 class Client {
26 public: 26 public:
27 virtual void OnSurfaceConnectionCreated() = 0;
28 virtual void OnSurfaceIdAvailable(mojo::SurfaceIdPtr surface_id) = 0; 27 virtual void OnSurfaceIdAvailable(mojo::SurfaceIdPtr surface_id) = 0;
29 virtual void ReturnResources( 28 virtual void ReturnResources(
30 mojo::Array<mojo::ReturnedResourcePtr> resources) = 0; 29 mojo::Array<mojo::ReturnedResourcePtr> resources) = 0;
31 30
32 protected: 31 protected:
33 virtual ~Client(); 32 virtual ~Client();
34 }; 33 };
35 34
36 explicit SurfaceHolder(Client* client, mojo::Shell* shell); 35 explicit SurfaceHolder(Client* client, mojo::Shell* shell);
37 ~SurfaceHolder() override; 36 ~SurfaceHolder() override;
38 37
39 bool IsReadyForFrame() const;
40
41 void SetSize(const gfx::Size& size); 38 void SetSize(const gfx::Size& size);
42 void SubmitFrame(mojo::FramePtr frame, const base::Closure& callback); 39 void SubmitFrame(mojo::FramePtr frame, const base::Closure& callback);
43 40
44 private: 41 private:
45 // mojo::SurfaceClient 42 // mojo::SurfaceClient
46 void SetIdNamespace(uint32_t id_namespace) override; 43 void SetIdNamespace(uint32_t id_namespace) override;
47 void ReturnResources( 44 void ReturnResources(
48 mojo::Array<mojo::ReturnedResourcePtr> resources) override; 45 mojo::Array<mojo::ReturnedResourcePtr> resources) override;
49 46
50 void OnSurfaceConnectionCreated(mojo::SurfacePtr surface, 47 void SetQualifiedId();
51 uint32_t id_namespace);
52 48
53 Client* client_; 49 Client* client_;
54 gfx::Size size_; 50 gfx::Size size_;
55 scoped_ptr<SurfaceAllocator> surface_allocator_; 51 uint32_t id_namespace_;
56 mojo::SurfacesServicePtr surfaces_service_; 52 uint32_t local_id_;
57 mojo::SurfacePtr surface_; 53 mojo::SurfacePtr surface_;
58 mojo::SurfaceIdPtr surface_id_;
59 54
60 base::WeakPtrFactory<SurfaceHolder> weak_factory_; 55 base::WeakPtrFactory<SurfaceHolder> weak_factory_;
61 56
62 DISALLOW_COPY_AND_ASSIGN(SurfaceHolder); 57 DISALLOW_COPY_AND_ASSIGN(SurfaceHolder);
63 }; 58 };
64 59
65 } // namespace sky 60 } // namespace sky
66 61
67 #endif // SKY_COMPOSITOR_SURFACE_HOLDER_H_ 62 #endif // SKY_COMPOSITOR_SURFACE_HOLDER_H_
OLDNEW
« no previous file with comments | « sky/compositor/layer_host.cc ('k') | sky/compositor/surface_holder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698