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

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

Issue 1282013004: BackgroundSyncManager tracks client registrations (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments from PS12 Created 5 years, 4 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
index 2eb1c40019da279279e19a5813eef0786524426b..14ac20c95d5948c608df2c1a34adc8fd14fb5a7f 100644
--- a/content/renderer/background_sync/background_sync_client_impl.cc
+++ b/content/renderer/background_sync/background_sync_client_impl.cc
@@ -6,6 +6,8 @@
#include "content/child/background_sync/background_sync_type_converters.h"
#include "content/renderer/service_worker/service_worker_context_client.h"
+#include "third_party/WebKit/public/platform/Platform.h"
+#include "third_party/WebKit/public/platform/modules/background_sync/WebSyncProvider.h"
#include "third_party/WebKit/public/platform/modules/background_sync/WebSyncRegistration.h"
namespace content {
@@ -30,9 +32,22 @@ void BackgroundSyncClientImpl::Sync(content::SyncRegistrationPtr registration,
callback.Run(SERVICE_WORKER_EVENT_STATUS_ABORTED);
return;
}
- scoped_ptr<blink::WebSyncRegistration> reg =
+
+ scoped_ptr<blink::WebSyncRegistration> web_registration =
mojo::ConvertTo<scoped_ptr<blink::WebSyncRegistration>>(registration);
- client->DispatchSyncEvent(*reg, callback);
+
+ blink::WebSyncRegistration registration_copy = *web_registration;
+
+ // The BackgroundSyncServiceImpl doesn't know about this registration yet,
+ // inform it via trackRegistration.
+ blink::WebSyncProvider* webSyncProvider =
michaeln 2015/08/19 01:56:01 style nit: !camel_case
jkarlin 2015/08/19 12:47:06 Done.
+ blink::Platform::current()->backgroundSyncProvider();
+ DCHECK(webSyncProvider);
+
+ // trackRegistration takes ownership of web_registration.
+ webSyncProvider->trackRegistration(web_registration.release());
+
+ client->DispatchSyncEvent(registration_copy, callback);
}
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698