Chromium Code Reviews| 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 // Task runner we were constructed on, and that |media_gpu_channel_manager_| | |
| 32 // must be accessed from (the GPU main thread task runner). We expect | |
| 33 // RegisterServices() to be called on this task runner as well, but the | |
| 34 // implementation doesn't care. | |
| 35 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | |
| 36 base::WeakPtr<media::MediaGpuChannelManager> media_gpu_channel_manager_; | |
|
xhwang
2016/11/24 07:02:11
You can probably guard these two with #if defined(
| |
| 23 DISALLOW_COPY_AND_ASSIGN(GpuServiceFactory); | 37 DISALLOW_COPY_AND_ASSIGN(GpuServiceFactory); |
| 24 }; | 38 }; |
| 25 | 39 |
| 26 } // namespace content | 40 } // namespace content |
| 27 | 41 |
| 28 #endif // CONTENT_GPU_GPU_SERVICE_FACTORY_H_ | 42 #endif // CONTENT_GPU_GPU_SERVICE_FACTORY_H_ |
| OLD | NEW |