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

Unified Diff: media/mojo/services/service_factory_impl.cc

Issue 2326913003: Privatize StrongBinding lifetime management (Closed)
Patch Set: rebase Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/mojo/services/service_factory_impl.h ('k') | mojo/public/cpp/bindings/strong_binding.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/mojo/services/service_factory_impl.cc
diff --git a/media/mojo/services/service_factory_impl.cc b/media/mojo/services/service_factory_impl.cc
index 4bdf49055ca016762a9e476f3839dc01d44028dc..b93b17dd8d36d4e22e9fd276caad235cac012ffe 100644
--- a/media/mojo/services/service_factory_impl.cc
+++ b/media/mojo/services/service_factory_impl.cc
@@ -8,6 +8,7 @@
#include "base/threading/thread_task_runner_handle.h"
#include "media/base/media_log.h"
#include "media/mojo/services/mojo_media_client.h"
+#include "mojo/public/cpp/bindings/strong_binding.h"
#include "services/shell/public/interfaces/interface_provider.mojom.h"
#if defined(ENABLE_MOJO_AUDIO_DECODER)
@@ -33,12 +34,11 @@
namespace media {
ServiceFactoryImpl::ServiceFactoryImpl(
- mojo::InterfaceRequest<mojom::ServiceFactory> request,
shell::mojom::InterfaceProviderPtr interfaces,
scoped_refptr<MediaLog> media_log,
std::unique_ptr<shell::ServiceContextRef> connection_ref,
MojoMediaClient* mojo_media_client)
- : binding_(this, std::move(request)),
+ :
#if defined(ENABLE_MOJO_CDM)
interfaces_(std::move(interfaces)),
#endif
@@ -68,15 +68,19 @@ void ServiceFactoryImpl::CreateAudioDecoder(
return;
}
- new MojoAudioDecoderService(cdm_service_context_.GetWeakPtr(),
- std::move(audio_decoder), std::move(request));
+ mojo::MakeStrongBinding(
+ base::MakeUnique<MojoAudioDecoderService>(
+ cdm_service_context_.GetWeakPtr(), std::move(audio_decoder)),
+ std::move(request));
#endif // defined(ENABLE_MOJO_AUDIO_DECODER)
}
void ServiceFactoryImpl::CreateVideoDecoder(
mojom::VideoDecoderRequest request) {
#if defined(ENABLE_MOJO_VIDEO_DECODER)
- new MojoVideoDecoderService(std::move(request), mojo_media_client_);
+ mojo::MakeStrongBinding(
+ base::MakeUnique<MojoVideoDecoderService>(mojo_media_client_),
+ std::move(request));
#endif // defined(ENABLE_MOJO_VIDEO_DECODER)
}
@@ -101,10 +105,11 @@ void ServiceFactoryImpl::CreateRenderer(
return;
}
- // The created object is owned by the pipe.
- new MojoRendererService(cdm_service_context_.GetWeakPtr(),
- std::move(audio_sink), std::move(video_sink),
- std::move(renderer), std::move(request));
+ mojo::MakeStrongBinding(
+ base::MakeUnique<MojoRendererService>(
+ cdm_service_context_.GetWeakPtr(), std::move(audio_sink),
+ std::move(video_sink), std::move(renderer)),
+ std::move(request));
#endif // defined(ENABLE_MOJO_RENDERER)
}
@@ -115,9 +120,9 @@ void ServiceFactoryImpl::CreateCdm(
if (!cdm_factory)
return;
- // The created object is owned by the pipe.
- new MojoCdmService(cdm_service_context_.GetWeakPtr(), cdm_factory,
- std::move(request));
+ mojo::MakeStrongBinding(base::MakeUnique<MojoCdmService>(
+ cdm_service_context_.GetWeakPtr(), cdm_factory),
+ std::move(request));
#endif // defined(ENABLE_MOJO_CDM)
}
« no previous file with comments | « media/mojo/services/service_factory_impl.h ('k') | mojo/public/cpp/bindings/strong_binding.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698