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

Unified Diff: content/browser/service_worker/service_worker_dispatcher_host.cc

Issue 2396273002: ServiceWorker: Mojofication of ServiceWorkerDispatcherHost (Closed)
Patch Set: Removed GetWeakPtr and moved a method to private Created 4 years, 2 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
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..54cd17d581f40696af551657fc935cf21cdf8c1f 100644
--- a/content/browser/service_worker/service_worker_dispatcher_host.cc
+++ b/content/browser/service_worker/service_worker_dispatcher_host.cc
@@ -101,7 +101,12 @@ 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,
+ base::Unretained(this)));
}
ServiceWorkerDispatcherHost::~ServiceWorkerDispatcherHost() {
@@ -219,6 +224,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);

Powered by Google App Engine
This is Rietveld 408576698