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

Side by Side Diff: services/ui/gpu/gpu_service_internal.h

Issue 2559183003: mus: More gpu-related renames. (Closed)
Patch Set: . Created 4 years 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/gpu/gpu_service.cc ('k') | services/ui/gpu/gpu_service_internal.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef SERVICES_UI_GPU_GPU_SERVICE_INTERNAL_H_
6 #define SERVICES_UI_GPU_GPU_SERVICE_INTERNAL_H_
7
8 #include "base/callback.h"
9 #include "base/synchronization/waitable_event.h"
10 #include "base/threading/non_thread_safe.h"
11 #include "base/threading/thread.h"
12 #include "build/build_config.h"
13 #include "gpu/command_buffer/client/gpu_memory_buffer_manager.h"
14 #include "gpu/command_buffer/service/gpu_preferences.h"
15 #include "gpu/config/gpu_info.h"
16 #include "gpu/ipc/common/surface_handle.h"
17 #include "gpu/ipc/service/gpu_channel.h"
18 #include "gpu/ipc/service/gpu_channel_manager.h"
19 #include "gpu/ipc/service/gpu_channel_manager_delegate.h"
20 #include "gpu/ipc/service/gpu_config.h"
21 #include "gpu/ipc/service/x_util.h"
22 #include "mojo/public/cpp/bindings/binding.h"
23 #include "mojo/public/cpp/bindings/binding_set.h"
24 #include "services/ui/gpu/interfaces/gpu_service_host.mojom.h"
25 #include "services/ui/gpu/interfaces/gpu_service_internal.mojom.h"
26 #include "ui/gfx/native_widget_types.h"
27
28 namespace gpu {
29 class GpuMemoryBufferFactory;
30 class GpuWatchdogThread;
31 class SyncPointManager;
32 }
33
34 namespace media {
35 class MediaGpuChannelManager;
36 }
37
38 namespace ui {
39
40 class GpuMain;
41
42 // This runs in the GPU process, and communicates with the gpu host (which is
43 // the window server) over the mojom APIs. This is responsible for setting up
44 // the connection to clients, allocating/free'ing gpu memory etc.
45 class GpuServiceInternal : public gpu::GpuChannelManagerDelegate,
46 public mojom::GpuServiceInternal,
47 public base::NonThreadSafe {
48 public:
49 GpuServiceInternal(const gpu::GPUInfo& gpu_info,
50 std::unique_ptr<gpu::GpuWatchdogThread> watchdog,
51 gpu::GpuMemoryBufferFactory* memory_buffer_factory,
52 scoped_refptr<base::SingleThreadTaskRunner> io_runner);
53
54 ~GpuServiceInternal() override;
55
56 void InitializeWithHost(mojom::GpuServiceHostPtr gpu_host);
57 void Bind(mojom::GpuServiceInternalRequest request);
58
59 private:
60 friend class GpuMain;
61
62 gfx::GpuMemoryBufferHandle CreateGpuMemoryBufferFromeHandle(
63 gfx::GpuMemoryBufferHandle buffer_handle,
64 gfx::GpuMemoryBufferId id,
65 const gfx::Size& size,
66 gfx::BufferFormat format,
67 int client_id);
68
69 gpu::SyncPointManager* sync_point_manager() {
70 return owned_sync_point_manager_.get();
71 }
72
73 gpu::gles2::MailboxManager* mailbox_manager() {
74 return gpu_channel_manager_->mailbox_manager();
75 }
76
77 gl::GLShareGroup* share_group() {
78 return gpu_channel_manager_->share_group();
79 }
80
81 const gpu::GPUInfo& gpu_info() const { return gpu_info_; }
82
83 // gpu::GpuChannelManagerDelegate:
84 void DidCreateOffscreenContext(const GURL& active_url) override;
85 void DidDestroyChannel(int client_id) override;
86 void DidDestroyOffscreenContext(const GURL& active_url) override;
87 void DidLoseContext(bool offscreen,
88 gpu::error::ContextLostReason reason,
89 const GURL& active_url) override;
90 void StoreShaderToDisk(int client_id,
91 const std::string& key,
92 const std::string& shader) override;
93 #if defined(OS_WIN)
94 void SendAcceleratedSurfaceCreatedChildWindow(
95 gpu::SurfaceHandle parent_window,
96 gpu::SurfaceHandle child_window) override;
97 #endif
98 void SetActiveURL(const GURL& url) override;
99
100 // mojom::GpuServiceInternal:
101 void EstablishGpuChannel(
102 int32_t client_id,
103 uint64_t client_tracing_id,
104 bool is_gpu_host,
105 const EstablishGpuChannelCallback& callback) override;
106 void CreateGpuMemoryBuffer(
107 gfx::GpuMemoryBufferId id,
108 const gfx::Size& size,
109 gfx::BufferFormat format,
110 gfx::BufferUsage usage,
111 int client_id,
112 gpu::SurfaceHandle surface_handle,
113 const CreateGpuMemoryBufferCallback& callback) override;
114 void DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id,
115 int client_id,
116 const gpu::SyncToken& sync_token) override;
117
118 scoped_refptr<base::SingleThreadTaskRunner> io_runner_;
119
120 // An event that will be signalled when we shutdown.
121 base::WaitableEvent shutdown_event_;
122
123 std::unique_ptr<gpu::GpuWatchdogThread> watchdog_thread_;
124
125 gpu::GpuMemoryBufferFactory* gpu_memory_buffer_factory_;
126
127 gpu::GpuPreferences gpu_preferences_;
128
129 // Information about the GPU, such as device and vendor ID.
130 gpu::GPUInfo gpu_info_;
131
132 mojom::GpuServiceHostPtr gpu_host_;
133 std::unique_ptr<gpu::SyncPointManager> owned_sync_point_manager_;
134 std::unique_ptr<gpu::GpuChannelManager> gpu_channel_manager_;
135 std::unique_ptr<media::MediaGpuChannelManager> media_gpu_channel_manager_;
136 mojo::BindingSet<mojom::GpuServiceInternal> bindings_;
137
138 DISALLOW_COPY_AND_ASSIGN(GpuServiceInternal);
139 };
140
141 } // namespace ui
142
143 #endif // SERVICES_UI_GPU_GPU_SERVICE_INTERNAL_H_
OLDNEW
« no previous file with comments | « services/ui/gpu/gpu_service.cc ('k') | services/ui/gpu/gpu_service_internal.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698