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

Unified Diff: content/renderer/background_sync/background_sync_client_impl.cc

Issue 1220943003: [Background Sync] Use Mojo IPC to fire background sync events (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mek
Patch Set: Add connection error handler; make type converter safer. Created 5 years, 5 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/renderer/background_sync/background_sync_client_impl.cc
diff --git a/content/renderer/background_sync/background_sync_client_impl.cc b/content/renderer/background_sync/background_sync_client_impl.cc
new file mode 100644
index 0000000000000000000000000000000000000000..997b47650adfab276f505bedbbfbc03a8fc7dc6b
--- /dev/null
+++ b/content/renderer/background_sync/background_sync_client_impl.cc
@@ -0,0 +1,34 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/renderer/background_sync/background_sync_client_impl.h"
+
+#include "content/renderer/service_worker/service_worker_context_client.h"
+
+namespace content {
+
+// static
+void BackgroundSyncClientImpl::Create(
+ mojo::InterfaceRequest<BackgroundSyncServiceClient> request) {
+ new BackgroundSyncClientImpl(request.Pass());
+}
+
+BackgroundSyncClientImpl::~BackgroundSyncClientImpl() {}
+
+BackgroundSyncClientImpl::BackgroundSyncClientImpl(
+ mojo::InterfaceRequest<BackgroundSyncServiceClient> request)
+ : binding_(this, request.Pass()) {}
+
+void BackgroundSyncClientImpl::Sync(content::SyncRegistrationPtr registration,
+ const SyncCallback& callback) {
+ ServiceWorkerContextClient* client =
+ ServiceWorkerContextClient::ThreadSpecificInstance();
+ if (!client) {
+ callback.Run(SERVICE_WORKER_EVENT_STATUS_ABORTED);
+ return;
+ }
+ client->DispatchSyncEvent(callback);
+}
+
+} // namespace content

Powered by Google App Engine
This is Rietveld 408576698