Chromium Code Reviews| Index: content/browser/service_worker/service_worker_dispatcher_host.cc |
| diff --git a/content/browser/service_worker/service_worker_dispatcher_host.cc b/content/browser/service_worker/service_worker_dispatcher_host.cc |
| index 2c19cabaf95d343fb674a4d76c1941bdd3ac7b8a..e2e28c13e928d6118544478acc4cc67e0fc4cfd7 100644 |
| --- a/content/browser/service_worker/service_worker_dispatcher_host.cc |
| +++ b/content/browser/service_worker/service_worker_dispatcher_host.cc |
| @@ -101,7 +101,11 @@ ServiceWorkerDispatcherHost::ServiceWorkerDispatcherHost( |
| render_process_id_(render_process_id), |
| message_port_message_filter_(message_port_message_filter), |
| resource_context_(resource_context), |
| - channel_ready_(false) { |
| + channel_ready_(false), |
| + weak_factory_(this) { |
| + AddAssociatedInterface( |
| + mojom::ServiceWorkerDispatcherHost::Name_, |
| + base::Bind(&ServiceWorkerDispatcherHost::AddMojoBinding, GetWeakPtr())); |
|
horo
2016/10/07 07:39:29
I think we don't need to use weak pointer.
base::U
shimazu
2016/10/14 08:15:03
Done.
|
| } |
| ServiceWorkerDispatcherHost::~ServiceWorkerDispatcherHost() { |
| @@ -219,6 +223,13 @@ bool ServiceWorkerDispatcherHost::OnMessageReceived( |
| return handled; |
| } |
| +void ServiceWorkerDispatcherHost::AddMojoBinding( |
| + mojo::ScopedInterfaceEndpointHandle handle) { |
| + bindings_.AddBinding( |
| + this, mojo::MakeAssociatedRequest<mojom::ServiceWorkerDispatcherHost>( |
| + std::move(handle))); |
| +} |
| + |
| bool ServiceWorkerDispatcherHost::Send(IPC::Message* message) { |
| if (channel_ready_) { |
| BrowserMessageFilter::Send(message); |