OLD | NEW |
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 CONTENT_GPU_GPU_SERVICE_FACTORY_H_ | 5 #ifndef CONTENT_GPU_GPU_SERVICE_FACTORY_H_ |
6 #define CONTENT_GPU_GPU_SERVICE_FACTORY_H_ | 6 #define CONTENT_GPU_GPU_SERVICE_FACTORY_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
11 #include "base/single_thread_task_runner.h" | 11 #include "base/single_thread_task_runner.h" |
12 #include "content/child/service_factory.h" | 12 #include "content/child/service_factory.h" |
| 13 #include "media/mojo/features.h" |
13 | 14 |
14 namespace media { | 15 namespace media { |
15 class MediaGpuChannelManager; | 16 class MediaGpuChannelManager; |
16 } | 17 } |
17 | 18 |
18 namespace content { | 19 namespace content { |
19 | 20 |
20 // Customization of ServiceFactory for the GPU process. | 21 // Customization of ServiceFactory for the GPU process. |
21 class GpuServiceFactory : public ServiceFactory { | 22 class GpuServiceFactory : public ServiceFactory { |
22 public: | 23 public: |
23 explicit GpuServiceFactory( | 24 explicit GpuServiceFactory( |
24 base::WeakPtr<media::MediaGpuChannelManager> media_gpu_channel_manager); | 25 base::WeakPtr<media::MediaGpuChannelManager> media_gpu_channel_manager); |
25 ~GpuServiceFactory() override; | 26 ~GpuServiceFactory() override; |
26 | 27 |
27 // ServiceFactory overrides: | 28 // ServiceFactory overrides: |
28 void RegisterServices(ServiceMap* services) override; | 29 void RegisterServices(ServiceMap* services) override; |
29 | 30 |
30 private: | 31 private: |
31 #if defined(ENABLE_MOJO_MEDIA_IN_GPU_PROCESS) | 32 #if BUILDFLAG(ENABLE_MOJO_MEDIA_IN_GPU_PROCESS) |
32 // Task runner we were constructed on, and that |media_gpu_channel_manager_| | 33 // Task runner we were constructed on, and that |media_gpu_channel_manager_| |
33 // must be accessed from (the GPU main thread task runner). We expect | 34 // must be accessed from (the GPU main thread task runner). We expect |
34 // RegisterServices() to be called on this task runner as well, but the | 35 // RegisterServices() to be called on this task runner as well, but the |
35 // implementation doesn't care. | 36 // implementation doesn't care. |
36 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 37 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
37 base::WeakPtr<media::MediaGpuChannelManager> media_gpu_channel_manager_; | 38 base::WeakPtr<media::MediaGpuChannelManager> media_gpu_channel_manager_; |
38 #endif | 39 #endif |
39 | 40 |
40 DISALLOW_COPY_AND_ASSIGN(GpuServiceFactory); | 41 DISALLOW_COPY_AND_ASSIGN(GpuServiceFactory); |
41 }; | 42 }; |
42 | 43 |
43 } // namespace content | 44 } // namespace content |
44 | 45 |
45 #endif // CONTENT_GPU_GPU_SERVICE_FACTORY_H_ | 46 #endif // CONTENT_GPU_GPU_SERVICE_FACTORY_H_ |
OLD | NEW |