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

Side by Side Diff: media/mojo/services/mojo_media_application.cc

Issue 2295403002: Destroy MojoMediaClient in MojoMediaApplication::OnStop(). (Closed)
Patch Set: ignore request if stopped 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 unified diff | Download patch
« no previous file with comments | « no previous file | media/mojo/services/mojo_media_client.h » ('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 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 #include "media/mojo/services/mojo_media_application.h" 5 #include "media/mojo/services/mojo_media_application.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "media/base/media_log.h" 9 #include "media/base/media_log.h"
10 #include "media/mojo/services/mojo_media_client.h" 10 #include "media/mojo/services/mojo_media_client.h"
(...skipping 19 matching lines...) Expand all
30 mojo_media_client_->Initialize(); 30 mojo_media_client_->Initialize();
31 } 31 }
32 32
33 bool MojoMediaApplication::OnConnect(const shell::Identity& remote_identity, 33 bool MojoMediaApplication::OnConnect(const shell::Identity& remote_identity,
34 shell::InterfaceRegistry* registry) { 34 shell::InterfaceRegistry* registry) {
35 registry->AddInterface<mojom::MediaService>(this); 35 registry->AddInterface<mojom::MediaService>(this);
36 return true; 36 return true;
37 } 37 }
38 38
39 bool MojoMediaApplication::OnStop() { 39 bool MojoMediaApplication::OnStop() {
40 mojo_media_client_->WillQuit(); 40 mojo_media_client_.reset();
41 return true; 41 return true;
42 } 42 }
43 43
44 void MojoMediaApplication::Create(const shell::Identity& remote_identity, 44 void MojoMediaApplication::Create(const shell::Identity& remote_identity,
45 mojom::MediaServiceRequest request) { 45 mojom::MediaServiceRequest request) {
46 bindings_.AddBinding(this, std::move(request)); 46 bindings_.AddBinding(this, std::move(request));
47 } 47 }
48 48
49 void MojoMediaApplication::CreateServiceFactory( 49 void MojoMediaApplication::CreateServiceFactory(
50 mojom::ServiceFactoryRequest request, 50 mojom::ServiceFactoryRequest request,
51 shell::mojom::InterfaceProviderPtr remote_interfaces) { 51 shell::mojom::InterfaceProviderPtr remote_interfaces) {
52 // Ignore request if service has already stopped.
53 if (!mojo_media_client_)
54 return;
55
52 // The created object is owned by the pipe. 56 // The created object is owned by the pipe.
53 new ServiceFactoryImpl(std::move(request), std::move(remote_interfaces), 57 new ServiceFactoryImpl(std::move(request), std::move(remote_interfaces),
54 media_log_, ref_factory_.CreateRef(), 58 media_log_, ref_factory_.CreateRef(),
55 mojo_media_client_.get()); 59 mojo_media_client_.get());
56 } 60 }
57 61
58 } // namespace media 62 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | media/mojo/services/mojo_media_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698