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

Side by Side Diff: services/ui/ws/gpu_host.h

Issue 2741343003: Update liftetime management of GpuClient (Closed)
Patch Set: fix x11 re-definition Created 3 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/ui/ws/gpu_client.cc ('k') | services/ui/ws/gpu_host.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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_UI_WS_GPU_HOST_H_ 5 #ifndef SERVICES_UI_WS_GPU_HOST_H_
6 #define SERVICES_UI_WS_GPU_HOST_H_ 6 #define SERVICES_UI_WS_GPU_HOST_H_
7 7
8 #include "base/single_thread_task_runner.h" 8 #include "base/single_thread_task_runner.h"
9 #include "base/synchronization/waitable_event.h" 9 #include "base/synchronization/waitable_event.h"
10 #include "base/threading/thread.h" 10 #include "base/threading/thread.h"
11 #include "gpu/config/gpu_info.h" 11 #include "gpu/config/gpu_info.h"
12 #include "gpu/ipc/client/gpu_channel_host.h" 12 #include "gpu/ipc/client/gpu_channel_host.h"
13 #include "mojo/public/cpp/bindings/binding_set.h" 13 #include "mojo/public/cpp/bindings/binding_set.h"
14 #include "mojo/public/cpp/bindings/interface_request.h" 14 #include "mojo/public/cpp/bindings/interface_request.h"
15 #include "mojo/public/cpp/bindings/strong_binding_set.h"
15 #include "services/ui/gpu/gpu_main.h" 16 #include "services/ui/gpu/gpu_main.h"
16 #include "services/ui/gpu/interfaces/gpu_host.mojom.h" 17 #include "services/ui/gpu/interfaces/gpu_host.mojom.h"
17 #include "services/ui/gpu/interfaces/gpu_service.mojom.h" 18 #include "services/ui/gpu/interfaces/gpu_service.mojom.h"
18 #include "services/ui/public/interfaces/gpu.mojom.h" 19 #include "services/ui/public/interfaces/gpu.mojom.h"
19 20
20 namespace ui { 21 namespace ui {
21 22
22 class ServerGpuMemoryBufferManager; 23 class ServerGpuMemoryBufferManager;
23 24
24 namespace ws { 25 namespace ws {
25 26
27 class GpuClient;
28
29 namespace test {
30 class GpuHostTest;
31 } // namespace test
32
26 class GpuHostDelegate; 33 class GpuHostDelegate;
27 34
28 // Sets up connection from clients to the real service implementation in the GPU 35 // Sets up connection from clients to the real service implementation in the GPU
29 // process. 36 // process.
30 class GpuHost : public mojom::GpuHost { 37 class GpuHost : public mojom::GpuHost {
31 public: 38 public:
32 explicit GpuHost(GpuHostDelegate* delegate); 39 explicit GpuHost(GpuHostDelegate* delegate);
33 ~GpuHost() override; 40 ~GpuHost() override;
34 41
35 void Add(mojom::GpuRequest request); 42 void Add(mojom::GpuRequest request);
36 43
37 void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget); 44 void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget);
38 void OnAcceleratedWidgetDestroyed(gfx::AcceleratedWidget widget); 45 void OnAcceleratedWidgetDestroyed(gfx::AcceleratedWidget widget);
39 46
40 // Requests a cc::mojom::DisplayCompositor interface from mus-gpu. 47 // Requests a cc::mojom::DisplayCompositor interface from mus-gpu.
41 void CreateDisplayCompositor(cc::mojom::DisplayCompositorRequest request, 48 void CreateDisplayCompositor(cc::mojom::DisplayCompositorRequest request,
42 cc::mojom::DisplayCompositorClientPtr client); 49 cc::mojom::DisplayCompositorClientPtr client);
43 50
44 private: 51 private:
52 friend class test::GpuHostTest;
53
54 GpuClient* AddInternal(mojom::GpuRequest request);
45 void OnBadMessageFromGpu(); 55 void OnBadMessageFromGpu();
46 56
47 // mojom::GpuHost: 57 // mojom::GpuHost:
48 void DidInitialize(const gpu::GPUInfo& gpu_info) override; 58 void DidInitialize(const gpu::GPUInfo& gpu_info) override;
49 void DidCreateOffscreenContext(const GURL& url) override; 59 void DidCreateOffscreenContext(const GURL& url) override;
50 void DidDestroyOffscreenContext(const GURL& url) override; 60 void DidDestroyOffscreenContext(const GURL& url) override;
51 void DidDestroyChannel(int32_t client_id) override; 61 void DidDestroyChannel(int32_t client_id) override;
52 void DidLoseContext(bool offscreen, 62 void DidLoseContext(bool offscreen,
53 gpu::error::ContextLostReason reason, 63 gpu::error::ContextLostReason reason,
54 const GURL& active_url) override; 64 const GURL& active_url) override;
(...skipping 13 matching lines...) Expand all
68 mojo::Binding<mojom::GpuHost> gpu_host_binding_; 78 mojo::Binding<mojom::GpuHost> gpu_host_binding_;
69 gpu::GPUInfo gpu_info_; 79 gpu::GPUInfo gpu_info_;
70 std::unique_ptr<ServerGpuMemoryBufferManager> gpu_memory_buffer_manager_; 80 std::unique_ptr<ServerGpuMemoryBufferManager> gpu_memory_buffer_manager_;
71 81
72 mojom::GpuMainPtr gpu_main_; 82 mojom::GpuMainPtr gpu_main_;
73 83
74 // TODO(fsamuel): GpuHost should not be holding onto |gpu_main_impl| 84 // TODO(fsamuel): GpuHost should not be holding onto |gpu_main_impl|
75 // because that will live in another process soon. 85 // because that will live in another process soon.
76 std::unique_ptr<GpuMain> gpu_main_impl_; 86 std::unique_ptr<GpuMain> gpu_main_impl_;
77 87
88 mojo::StrongBindingSet<mojom::Gpu> gpu_bindings_;
89
78 DISALLOW_COPY_AND_ASSIGN(GpuHost); 90 DISALLOW_COPY_AND_ASSIGN(GpuHost);
79 }; 91 };
80 92
81 } // namespace ws 93 } // namespace ws
82 } // namespace ui 94 } // namespace ui
83 95
84 #endif // SERVICES_UI_WS_GPU_HOST_H_ 96 #endif // SERVICES_UI_WS_GPU_HOST_H_
OLDNEW
« no previous file with comments | « services/ui/ws/gpu_client.cc ('k') | services/ui/ws/gpu_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698