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

Side by Side Diff: content/renderer/media/media_interface_provider.h

Issue 2684103005: Allow media track switching. (Closed)
Patch Set: Fixed comments Created 3 years, 8 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 | « no previous file | content/renderer/media/media_interface_provider.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 CONTENT_RENDERER_MEDIA_MEDIA_INTERFACE_PROVIDER_H_ 5 #ifndef CONTENT_RENDERER_MEDIA_MEDIA_INTERFACE_PROVIDER_H_
6 #define CONTENT_RENDERER_MEDIA_MEDIA_INTERFACE_PROVIDER_H_ 6 #define CONTENT_RENDERER_MEDIA_MEDIA_INTERFACE_PROVIDER_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/threading/thread_checker.h" 10 #include "base/memory/weak_ptr.h"
11 #include "base/single_thread_task_runner.h"
11 #include "content/common/content_export.h" 12 #include "content/common/content_export.h"
12 #include "media/mojo/interfaces/interface_factory.mojom.h" 13 #include "media/mojo/interfaces/interface_factory.mojom.h"
13 #include "services/service_manager/public/interfaces/interface_provider.mojom.h" 14 #include "services/service_manager/public/interfaces/interface_provider.mojom.h"
14 #include "url/gurl.h" 15 #include "url/gurl.h"
15 16
16 namespace service_manager { 17 namespace service_manager {
17 class InterfaceProvider; 18 class InterfaceProvider;
18 } 19 }
19 20
20 namespace content { 21 namespace content {
21 22
22 // MediaInterfaceProvider is an implementation of mojo InterfaceProvider that 23 // MediaInterfaceProvider is an implementation of mojo InterfaceProvider that
23 // provides media related services and handles disconnection automatically. 24 // provides media related services and handles disconnection automatically.
24 // This class is single threaded. 25 // The GetInterface can be called on any thread.
25 class CONTENT_EXPORT MediaInterfaceProvider 26 class CONTENT_EXPORT MediaInterfaceProvider
26 : public service_manager::mojom::InterfaceProvider { 27 : public service_manager::mojom::InterfaceProvider {
27 public: 28 public:
28 explicit MediaInterfaceProvider( 29 explicit MediaInterfaceProvider(
29 service_manager::InterfaceProvider* remote_interfaces); 30 service_manager::InterfaceProvider* remote_interfaces);
30 ~MediaInterfaceProvider() final; 31 ~MediaInterfaceProvider() final;
31 32
32 // InterfaceProvider implementation. 33 // InterfaceProvider implementation.
33 void GetInterface(const std::string& interface_name, 34 void GetInterface(const std::string& interface_name,
34 mojo::ScopedMessagePipeHandle pipe) final; 35 mojo::ScopedMessagePipeHandle pipe) final;
35 36
36 private: 37 private:
37 media::mojom::InterfaceFactory* GetMediaInterfaceFactory(); 38 media::mojom::InterfaceFactory* GetMediaInterfaceFactory();
38 void OnConnectionError(); 39 void OnConnectionError();
39 40
40 base::ThreadChecker thread_checker_;
41 service_manager::InterfaceProvider* remote_interfaces_; 41 service_manager::InterfaceProvider* remote_interfaces_;
42 media::mojom::InterfaceFactoryPtr media_interface_factory_; 42 media::mojom::InterfaceFactoryPtr media_interface_factory_;
43 43
44 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
45 base::WeakPtr<MediaInterfaceProvider> weak_this_;
46 base::WeakPtrFactory<MediaInterfaceProvider> weak_factory_;
47
44 DISALLOW_COPY_AND_ASSIGN(MediaInterfaceProvider); 48 DISALLOW_COPY_AND_ASSIGN(MediaInterfaceProvider);
45 }; 49 };
46 50
47 } // namespace content 51 } // namespace content
48 52
49 #endif // CONTENT_RENDERER_MEDIA_MEDIA_INTERFACE_PROVIDER_H_ 53 #endif // CONTENT_RENDERER_MEDIA_MEDIA_INTERFACE_PROVIDER_H_
OLDNEW
« no previous file with comments | « no previous file | content/renderer/media/media_interface_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698