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

Side by Side Diff: components/mus/public/cpp/window_surface.h

Issue 2119963002: Move mus to //services/ui (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 5 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
OLDNEW
(Empty)
1 // Copyright 2015 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 COMPONENTS_MUS_PUBLIC_CPP_WINDOW_SURFACE_H_
6 #define COMPONENTS_MUS_PUBLIC_CPP_WINDOW_SURFACE_H_
7
8 #include <memory>
9
10 #include "base/callback.h"
11 #include "base/macros.h"
12 #include "base/observer_list.h"
13 #include "base/threading/thread_checker.h"
14 #include "components/mus/public/interfaces/surface.mojom.h"
15 #include "mojo/public/cpp/bindings/binding.h"
16 #include "mojo/public/cpp/bindings/interface_ptr_info.h"
17
18 namespace mus {
19
20 class WindowSurfaceBinding;
21 class WindowSurfaceClient;
22 class Window;
23
24 // A WindowSurface is wrapper to simplify submitting CompositorFrames to
25 // Windows, and receiving ReturnedResources.
26 class WindowSurface : public mojom::SurfaceClient {
27 public:
28 // static
29 static std::unique_ptr<WindowSurface> Create(
30 std::unique_ptr<WindowSurfaceBinding>* surface_binding);
31
32 ~WindowSurface() override;
33
34 // Called to indicate that the current thread has assumed control of this
35 // object.
36 void BindToThread();
37
38 void SubmitCompositorFrame(cc::CompositorFrame frame,
39 const base::Closure& callback);
40
41 void set_client(WindowSurfaceClient* client) { client_ = client; }
42
43 private:
44 friend class Window;
45
46 WindowSurface(mojo::InterfacePtrInfo<mojom::Surface> surface_info,
47 mojo::InterfaceRequest<mojom::SurfaceClient> client_request);
48
49 // SurfaceClient implementation:
50 void ReturnResources(mojo::Array<cc::ReturnedResource> resources) override;
51
52 WindowSurfaceClient* client_;
53 mojo::InterfacePtrInfo<mojom::Surface> surface_info_;
54 mojo::InterfaceRequest<mojom::SurfaceClient> client_request_;
55 mojom::SurfacePtr surface_;
56 std::unique_ptr<mojo::Binding<mojom::SurfaceClient>> client_binding_;
57 std::unique_ptr<base::ThreadChecker> thread_checker_;
58
59 DISALLOW_COPY_AND_ASSIGN(WindowSurface);
60 };
61
62 // A WindowSurfaceBinding is a bundle of mojo interfaces that are to be used by
63 // or implemented by the Mus window server when passed into
64 // Window::AttachSurface. WindowSurfaceBinding has no standalone functionality.
65 class WindowSurfaceBinding {
66 public:
67 ~WindowSurfaceBinding();
68
69 private:
70 friend class WindowSurface;
71 friend class Window;
72
73 WindowSurfaceBinding(
74 mojo::InterfaceRequest<mojom::Surface> surface_request,
75 mojo::InterfacePtrInfo<mojom::SurfaceClient> surface_client);
76
77 mojo::InterfaceRequest<mojom::Surface> surface_request_;
78 mojo::InterfacePtrInfo<mojom::SurfaceClient> surface_client_;
79
80 DISALLOW_COPY_AND_ASSIGN(WindowSurfaceBinding);
81 };
82
83 } // namespace mus
84
85 #endif // COMPONENTS_MUS_PUBLIC_CPP_WINDOW_SURFACE_H_
OLDNEW
« no previous file with comments | « components/mus/public/cpp/window_property.h ('k') | components/mus/public/cpp/window_surface_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698