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

Side by Side Diff: services/ui/public/cpp/gpu/gpu_service.h

Issue 2559343003: mus: Rename GpuService to Gpu. (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/public/cpp/gpu/gpu.cc ('k') | services/ui/public/cpp/gpu/gpu_service.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_PUBLIC_CPP_GPU_GPU_SERVICE_H_
6 #define SERVICES_UI_PUBLIC_CPP_GPU_GPU_SERVICE_H_
7
8 #include <stdint.h>
9 #include <vector>
10
11 #include "base/macros.h"
12 #include "base/memory/ref_counted.h"
13 #include "base/single_thread_task_runner.h"
14 #include "base/synchronization/waitable_event.h"
15 #include "base/threading/thread.h"
16 #include "gpu/ipc/client/gpu_channel_host.h"
17 #include "services/ui/public/cpp/gpu/client_gpu_memory_buffer_manager.h"
18 #include "services/ui/public/interfaces/gpu_service.mojom.h"
19
20 namespace service_manager {
21 class Connector;
22 }
23
24 namespace ui {
25
26 class GpuService : public gpu::GpuChannelHostFactory,
27 public gpu::GpuChannelEstablishFactory {
28 public:
29 ~GpuService() override;
30
31 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager() const {
32 return gpu_memory_buffer_manager_.get();
33 }
34
35 // The GpuService has to be initialized in the main thread before establishing
36 // the gpu channel. If no |task_runner| is provided, then a new thread is
37 // created and used.
38 static std::unique_ptr<GpuService> Create(
39 service_manager::Connector* connector,
40 scoped_refptr<base::SingleThreadTaskRunner> task_runner = nullptr);
41
42 // gpu::GpuChannelEstablishFactory:
43 void EstablishGpuChannel(
44 const gpu::GpuChannelEstablishedCallback& callback) override;
45 scoped_refptr<gpu::GpuChannelHost> EstablishGpuChannelSync() override;
46 gpu::GpuMemoryBufferManager* GetGpuMemoryBufferManager() override;
47
48 private:
49 friend struct base::DefaultSingletonTraits<GpuService>;
50
51 GpuService(service_manager::Connector* connector,
52 scoped_refptr<base::SingleThreadTaskRunner> task_runner);
53
54 scoped_refptr<gpu::GpuChannelHost> GetGpuChannel();
55 void EstablishGpuChannelOnMainThreadSyncLocked();
56 void OnEstablishedGpuChannel(int client_id,
57 mojo::ScopedMessagePipeHandle channel_handle,
58 const gpu::GPUInfo& gpu_info);
59
60 // gpu::GpuChannelHostFactory overrides:
61 bool IsMainThread() override;
62 scoped_refptr<base::SingleThreadTaskRunner> GetIOThreadTaskRunner() override;
63 std::unique_ptr<base::SharedMemory> AllocateSharedMemory(
64 size_t size) override;
65
66 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_;
67 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_;
68 service_manager::Connector* connector_;
69 base::WaitableEvent shutdown_event_;
70 std::unique_ptr<base::Thread> io_thread_;
71 std::unique_ptr<ClientGpuMemoryBufferManager> gpu_memory_buffer_manager_;
72
73 ui::mojom::GpuServicePtr gpu_service_;
74 scoped_refptr<gpu::GpuChannelHost> gpu_channel_;
75 std::vector<gpu::GpuChannelEstablishedCallback> establish_callbacks_;
76
77 DISALLOW_COPY_AND_ASSIGN(GpuService);
78 };
79
80 } // namespace ui
81
82 #endif // SERVICES_UI_PUBLIC_CPP_GPU_GPU_SERVICE_H_
OLDNEW
« no previous file with comments | « services/ui/public/cpp/gpu/gpu.cc ('k') | services/ui/public/cpp/gpu/gpu_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698