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

Side by Side Diff: services/surfaces/surfaces_impl.h

Issue 940293003: Add a Display and ContextProvider concept to mojom, use to recreate (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 9 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 | « services/surfaces/display_impl.cc ('k') | services/surfaces/surfaces_impl.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 SERVICES_SURFACES_SURFACES_IMPL_H_ 5 #ifndef SERVICES_SURFACES_SURFACES_IMPL_H_
6 #define SERVICES_SURFACES_SURFACES_IMPL_H_ 6 #define SERVICES_SURFACES_SURFACES_IMPL_H_
7 7
8 #include "cc/surfaces/display_client.h" 8 #include "cc/surfaces/display_client.h"
9 #include "cc/surfaces/surface_factory.h" 9 #include "cc/surfaces/surface_factory.h"
10 #include "cc/surfaces/surface_factory_client.h" 10 #include "cc/surfaces/surface_factory_client.h"
11 #include "mojo/common/weak_binding_set.h" 11 #include "mojo/common/weak_binding_set.h"
12 #include "mojo/public/cpp/application/application_connection.h" 12 #include "mojo/public/cpp/application/application_connection.h"
13 #include "mojo/public/cpp/bindings/strong_binding.h" 13 #include "mojo/public/cpp/bindings/strong_binding.h"
14 #include "mojo/services/gpu/public/interfaces/command_buffer.mojom.h" 14 #include "mojo/services/gpu/public/interfaces/command_buffer.mojom.h"
15 #include "mojo/services/gpu/public/interfaces/viewport_parameter_listener.mojom. h" 15 #include "mojo/services/gpu/public/interfaces/viewport_parameter_listener.mojom. h"
16 #include "mojo/services/surfaces/public/interfaces/surfaces.mojom.h" 16 #include "mojo/services/surfaces/public/interfaces/surfaces.mojom.h"
17 17
18 namespace cc { 18 namespace cc {
19 class Display; 19 class Display;
20 } 20 }
21 21
22 namespace mojo { 22 namespace mojo {
23 class ApplicationManager; 23 class ApplicationManager;
24 } 24 }
25 25
26 namespace surfaces { 26 namespace surfaces {
27 class SurfacesScheduler;
27 28
28 class SurfacesImpl : public mojo::Surface, 29 class SurfacesImpl : public mojo::Surface, public cc::SurfaceFactoryClient {
29 public mojo::ViewportParameterListener,
30 public cc::SurfaceFactoryClient,
31 public cc::DisplayClient {
32 public: 30 public:
33 class Client {
34 public:
35 virtual void OnVSyncParametersUpdated(base::TimeTicks timebase,
36 base::TimeDelta interval) = 0;
37 virtual void FrameSubmitted() = 0;
38 virtual void SetDisplay(cc::Display* display) = 0;
39 virtual void OnDisplayBeingDestroyed(cc::Display* display) = 0;
40 };
41
42 SurfacesImpl(cc::SurfaceManager* manager, 31 SurfacesImpl(cc::SurfaceManager* manager,
43 uint32_t id_namespace, 32 uint32_t id_namespace,
44 Client* client, 33 SurfacesScheduler* scheduler,
45 mojo::InterfaceRequest<mojo::Surface> request); 34 mojo::InterfaceRequest<mojo::Surface> request);
46 35
47 SurfacesImpl(cc::SurfaceManager* manager,
48 uint32_t id_namespace,
49 Client* client,
50 mojo::SurfacePtr* surface);
51
52 ~SurfacesImpl() override; 36 ~SurfacesImpl() override;
53 37
54 // Surface implementation. 38 // Surface implementation.
55 void GetIdNamespace(const Surface::GetIdNamespaceCallback& callback) override; 39 void GetIdNamespace(const Surface::GetIdNamespaceCallback& callback) override;
56 void SetResourceReturner(mojo::ResourceReturnerPtr returner) override; 40 void SetResourceReturner(mojo::ResourceReturnerPtr returner) override;
57 void CreateSurface(uint32_t local_id) override; 41 void CreateSurface(uint32_t local_id) override;
58 void SubmitFrame(uint32_t local_id, 42 void SubmitFrame(uint32_t local_id,
59 mojo::FramePtr frame, 43 mojo::FramePtr frame,
60 const mojo::Closure& callback) override; 44 const mojo::Closure& callback) override;
61 void DestroySurface(uint32_t local_id) override; 45 void DestroySurface(uint32_t local_id) override;
62 void CreateGLES2BoundSurface(
63 mojo::CommandBufferPtr gles2_client,
64 uint32_t local_id,
65 mojo::SizePtr size,
66 mojo::InterfaceRequest<mojo::ViewportParameterListener> listener_request)
67 override;
68 46
69 // SurfaceFactoryClient implementation. 47 // SurfaceFactoryClient implementation.
70 void ReturnResources(const cc::ReturnedResourceArray& resources) override; 48 void ReturnResources(const cc::ReturnedResourceArray& resources) override;
71 49
72 // DisplayClient implementation.
73 void DisplayDamaged() override;
74 void DidSwapBuffers() override;
75 void DidSwapBuffersComplete() override;
76 void CommitVSyncParameters(base::TimeTicks timebase,
77 base::TimeDelta interval) override;
78 void OutputSurfaceLost() override;
79 void SetMemoryPolicy(const cc::ManagedMemoryPolicy& policy) override;
80
81 // ViewportParameterListener
82 void OnVSyncParametersUpdated(int64_t timebase, int64_t interval) override;
83
84 cc::SurfaceFactory* factory() { return &factory_; } 50 cc::SurfaceFactory* factory() { return &factory_; }
85 51
86 private: 52 private:
87 SurfacesImpl(cc::SurfaceManager* manager,
88 uint32_t id_namespace,
89 Client* client);
90
91 cc::SurfaceId QualifyIdentifier(uint32_t local_id); 53 cc::SurfaceId QualifyIdentifier(uint32_t local_id);
92 54
93 cc::SurfaceManager* manager_; 55 cc::SurfaceManager* manager_;
94 cc::SurfaceFactory factory_; 56 cc::SurfaceFactory factory_;
95 const uint32_t id_namespace_; 57 const uint32_t id_namespace_;
96 Client* client_; 58 SurfacesScheduler* scheduler_;
97 uint32_t displayed_surface_;
98 scoped_ptr<cc::Display> display_;
99 mojo::ScopedMessagePipeHandle command_buffer_handle_; 59 mojo::ScopedMessagePipeHandle command_buffer_handle_;
100 mojo::WeakBindingSet<ViewportParameterListener> parameter_listeners_;
101 mojo::ResourceReturnerPtr returner_; 60 mojo::ResourceReturnerPtr returner_;
102 mojo::StrongBinding<Surface> binding_; 61 mojo::StrongBinding<Surface> binding_;
103 62
104 DISALLOW_COPY_AND_ASSIGN(SurfacesImpl); 63 DISALLOW_COPY_AND_ASSIGN(SurfacesImpl);
105 }; 64 };
106 65
107 } // namespace surfaces 66 } // namespace surfaces
108 67
109 #endif // SERVICES_SURFACES_SURFACES_IMPL_H_ 68 #endif // SERVICES_SURFACES_SURFACES_IMPL_H_
OLDNEW
« no previous file with comments | « services/surfaces/display_impl.cc ('k') | services/surfaces/surfaces_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698