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

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

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

Powered by Google App Engine
This is Rietveld 408576698