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

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

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

Powered by Google App Engine
This is Rietveld 408576698