Index: content/gpu/gpu_child_thread.cc |
diff --git a/content/gpu/gpu_child_thread.cc b/content/gpu/gpu_child_thread.cc |
index 2dec918da27a80a69e43d0e90400f99686d7e22e..8ad8301f3dba46397062e1fcc877db4628f80517 100644 |
--- a/content/gpu/gpu_child_thread.cc |
+++ b/content/gpu/gpu_child_thread.cc |
@@ -21,6 +21,7 @@ |
#include "content/common/gpu/media/gpu_video_encode_accelerator.h" |
#include "content/common/gpu/media/media_service.h" |
#include "content/common/gpu_host_messages.h" |
+#include "content/common/media/media_permission_dispatcher.h" |
#include "content/gpu/gpu_process_control_impl.h" |
#include "content/gpu/gpu_watchdog_thread.h" |
#include "content/public/common/content_client.h" |
@@ -221,7 +222,7 @@ void GpuChildThread::Shutdown() { |
void GpuChildThread::Init(const base::Time& process_start_time) { |
process_start_time_ = process_start_time; |
- process_control_.reset(new GpuProcessControlImpl()); |
+ process_control_.reset(new GpuProcessControlImpl(GetMediaPermission())); |
// Use of base::Unretained(this) is safe here because |service_registry()| |
// will be destroyed before GpuChildThread is destructed. |
service_registry()->AddService(base::Bind( |
@@ -577,6 +578,23 @@ void GpuChildThread::OnLoseAllContexts() { |
} |
} |
+template <typename Interface> |
+void GpuChildThread::GetInterface(mojo::InterfaceRequest<Interface> request) { |
+ service_registry()->ConnectToRemoteService(std::move(request)); |
+} |
+ |
+media::MediaPermission* GpuChildThread::GetMediaPermission() { |
+ if (!media_permission_dispatcher_) { |
+ // Use of base::Unretained(this) is safe here because |
+ // |media_permission_dispatcher_| will be destroyed before GpuChildThread |
+ // is destructed. |
+ media_permission_dispatcher_.reset(new MediaPermissionDispatcher(base::Bind( |
+ &GpuChildThread::GetInterface<blink::mojom::PermissionService>, |
+ base::Unretained(this)))); |
+ } |
+ return media_permission_dispatcher_.get(); |
+} |
+ |
void GpuChildThread::BindProcessControlRequest( |
mojo::InterfaceRequest<mojom::ProcessControl> request) { |
DVLOG(1) << "GPU: Binding ProcessControl request"; |