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

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: Clean up 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..9b4c3b2230be9de49b92074759c6931b88ddea65 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* web_sync_provider =
+ blink::Platform::current()->backgroundSyncProvider();
+ DCHECK(web_sync_provider);
+
+ // trackRegistration takes ownership of web_registration.
+ web_sync_provider->trackRegistration(web_registration.release());
michaeln 2015/08/21 02:39:25 track is an odd verb? take adopt acquire grab?
jkarlin 2015/08/25 17:32:59 went with DuplicateRegistrationHandle
+
+ client->DispatchSyncEvent(registration_copy, callback);
}
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698