OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 CHROMECAST_BROWSER_CAST_BROWSER_MAIN_PARTS_H_ | 5 #ifndef CHROMECAST_BROWSER_CAST_BROWSER_MAIN_PARTS_H_ |
6 #define CHROMECAST_BROWSER_CAST_BROWSER_MAIN_PARTS_H_ | 6 #define CHROMECAST_BROWSER_CAST_BROWSER_MAIN_PARTS_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "content/public/browser/browser_main_parts.h" | 12 #include "content/public/browser/browser_main_parts.h" |
13 #include "content/public/common/main_function_params.h" | 13 #include "content/public/common/main_function_params.h" |
14 | 14 |
15 namespace base { | 15 namespace base { |
16 class SingleThreadTaskRunner; | 16 class SingleThreadTaskRunner; |
| 17 class Thread; |
17 } // namespace base | 18 } // namespace base |
18 | 19 |
19 namespace net { | 20 namespace net { |
20 class NetLog; | 21 class NetLog; |
21 } | 22 } |
22 | 23 |
23 namespace chromecast { | 24 namespace chromecast { |
24 class CastMemoryPressureMonitor; | 25 class CastMemoryPressureMonitor; |
25 | 26 |
26 namespace media { | 27 namespace media { |
27 class MediaPipelineBackendManager; | 28 class MediaPipelineBackendManager; |
28 class MediaResourceTracker; | 29 class MediaResourceTracker; |
29 class VideoPlaneController; | 30 class VideoPlaneController; |
30 } // namespace media | 31 } // namespace media |
31 | 32 |
32 namespace shell { | 33 namespace shell { |
33 class CastBrowserProcess; | 34 class CastBrowserProcess; |
34 class URLRequestContextFactory; | 35 class URLRequestContextFactory; |
35 | 36 |
36 class CastBrowserMainParts : public content::BrowserMainParts { | 37 class CastBrowserMainParts : public content::BrowserMainParts { |
37 public: | 38 public: |
38 // This class does not take ownership of |url_request_content_factory|. | 39 // This class does not take ownership of |url_request_content_factory|. |
39 CastBrowserMainParts(const content::MainFunctionParams& parameters, | 40 CastBrowserMainParts(const content::MainFunctionParams& parameters, |
40 URLRequestContextFactory* url_request_context_factory); | 41 URLRequestContextFactory* url_request_context_factory); |
41 ~CastBrowserMainParts() override; | 42 ~CastBrowserMainParts() override; |
42 | 43 |
43 scoped_refptr<base::SingleThreadTaskRunner> GetMediaTaskRunner() const; | 44 scoped_refptr<base::SingleThreadTaskRunner> GetMediaTaskRunner(); |
44 | 45 |
45 #if !defined(OS_ANDROID) | 46 #if !defined(OS_ANDROID) |
46 media::MediaResourceTracker* media_resource_tracker(); | 47 media::MediaResourceTracker* media_resource_tracker(); |
47 media::MediaPipelineBackendManager* media_pipeline_backend_manager(); | 48 media::MediaPipelineBackendManager* media_pipeline_backend_manager(); |
48 #endif | 49 #endif |
49 | 50 |
50 // content::BrowserMainParts implementation: | 51 // content::BrowserMainParts implementation: |
51 void PreMainMessageLoopStart() override; | 52 void PreMainMessageLoopStart() override; |
52 void PostMainMessageLoopStart() override; | 53 void PostMainMessageLoopStart() override; |
53 void ToolkitInitialized() override; | 54 void ToolkitInitialized() override; |
54 int PreCreateThreads() override; | 55 int PreCreateThreads() override; |
55 void PreMainMessageLoopRun() override; | 56 void PreMainMessageLoopRun() override; |
56 bool MainMessageLoopRun(int* result_code) override; | 57 bool MainMessageLoopRun(int* result_code) override; |
57 void PostMainMessageLoopRun() override; | 58 void PostMainMessageLoopRun() override; |
58 void PostDestroyThreads() override; | 59 void PostDestroyThreads() override; |
59 | 60 |
60 private: | 61 private: |
61 std::unique_ptr<CastBrowserProcess> cast_browser_process_; | 62 std::unique_ptr<CastBrowserProcess> cast_browser_process_; |
62 const content::MainFunctionParams parameters_; // For running browser tests. | 63 const content::MainFunctionParams parameters_; // For running browser tests. |
63 URLRequestContextFactory* const url_request_context_factory_; | 64 URLRequestContextFactory* const url_request_context_factory_; |
64 std::unique_ptr<net::NetLog> net_log_; | 65 std::unique_ptr<net::NetLog> net_log_; |
65 std::unique_ptr<media::VideoPlaneController> video_plane_controller_; | 66 std::unique_ptr<media::VideoPlaneController> video_plane_controller_; |
66 | 67 |
67 #if !defined(OS_ANDROID) | 68 #if !defined(OS_ANDROID) |
| 69 // CMA thread used by AudioManager, MojoRenderer, and MediaPipelineBackend. |
| 70 std::unique_ptr<base::Thread> media_thread_; |
| 71 |
68 // Tracks usage of media resource by e.g. CMA pipeline, CDM. | 72 // Tracks usage of media resource by e.g. CMA pipeline, CDM. |
69 media::MediaResourceTracker* media_resource_tracker_; | 73 media::MediaResourceTracker* media_resource_tracker_; |
70 | 74 |
71 // Tracks all media pipeline backends. | 75 // Tracks all media pipeline backends. |
72 std::unique_ptr<media::MediaPipelineBackendManager> | 76 std::unique_ptr<media::MediaPipelineBackendManager> |
73 media_pipeline_backend_manager_; | 77 media_pipeline_backend_manager_; |
74 | 78 |
75 std::unique_ptr<CastMemoryPressureMonitor> memory_pressure_monitor_; | 79 std::unique_ptr<CastMemoryPressureMonitor> memory_pressure_monitor_; |
76 #endif | 80 #endif |
77 | 81 |
78 DISALLOW_COPY_AND_ASSIGN(CastBrowserMainParts); | 82 DISALLOW_COPY_AND_ASSIGN(CastBrowserMainParts); |
79 }; | 83 }; |
80 | 84 |
81 } // namespace shell | 85 } // namespace shell |
82 } // namespace chromecast | 86 } // namespace chromecast |
83 | 87 |
84 #endif // CHROMECAST_BROWSER_CAST_BROWSER_MAIN_PARTS_H_ | 88 #endif // CHROMECAST_BROWSER_CAST_BROWSER_MAIN_PARTS_H_ |
OLD | NEW |