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