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

Side by Side Diff: content/child/background_sync/background_sync_provider_thread_proxy.cc

Issue 1316743002: Reland of [Background Sync] Allow sync manager access from uncontrolled clients (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 3 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/child/background_sync/background_sync_provider_thread_proxy.h" 5 #include "content/child/background_sync/background_sync_provider_thread_proxy.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 BackgroundSyncProviderThreadProxy* instance = 94 BackgroundSyncProviderThreadProxy* instance =
95 new BackgroundSyncProviderThreadProxy(main_thread_task_runner, 95 new BackgroundSyncProviderThreadProxy(main_thread_task_runner,
96 sync_provider); 96 sync_provider);
97 WorkerTaskRunner::Instance()->AddStopObserver(instance); 97 WorkerTaskRunner::Instance()->AddStopObserver(instance);
98 return instance; 98 return instance;
99 } 99 }
100 100
101 void BackgroundSyncProviderThreadProxy::registerBackgroundSync( 101 void BackgroundSyncProviderThreadProxy::registerBackgroundSync(
102 const blink::WebSyncRegistration* options, 102 const blink::WebSyncRegistration* options,
103 blink::WebServiceWorkerRegistration* service_worker_registration, 103 blink::WebServiceWorkerRegistration* service_worker_registration,
104 bool requested_from_service_worker,
104 blink::WebSyncRegistrationCallbacks* callbacks) { 105 blink::WebSyncRegistrationCallbacks* callbacks) {
105 DCHECK(options); 106 DCHECK(options);
106 DCHECK(service_worker_registration); 107 DCHECK(service_worker_registration);
107 DCHECK(callbacks); 108 DCHECK(callbacks);
108 main_thread_task_runner_->PostTask( 109 main_thread_task_runner_->PostTask(
109 FROM_HERE, 110 FROM_HERE,
110 base::Bind(&BackgroundSyncProvider::registerBackgroundSync, 111 base::Bind(&BackgroundSyncProvider::registerBackgroundSync,
111 base::Unretained(sync_provider_), options, 112 base::Unretained(sync_provider_), options,
112 service_worker_registration, 113 service_worker_registration, requested_from_service_worker,
113 new CallbackThreadAdapter<blink::WebSyncRegistrationCallbacks>( 114 new CallbackThreadAdapter<blink::WebSyncRegistrationCallbacks>(
114 make_scoped_ptr(callbacks), 115 make_scoped_ptr(callbacks),
115 WorkerTaskRunner::Instance()->CurrentWorkerId()))); 116 WorkerTaskRunner::Instance()->CurrentWorkerId())));
116 } 117 }
117 118
118 void BackgroundSyncProviderThreadProxy::unregisterBackgroundSync( 119 void BackgroundSyncProviderThreadProxy::unregisterBackgroundSync(
119 blink::WebSyncRegistration::Periodicity periodicity, 120 blink::WebSyncRegistration::Periodicity periodicity,
120 int64_t id, 121 int64_t id,
121 const blink::WebString& tag, 122 const blink::WebString& tag,
122 blink::WebServiceWorkerRegistration* service_worker_registration, 123 blink::WebServiceWorkerRegistration* service_worker_registration,
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 : main_thread_task_runner_(main_thread_task_runner), 200 : main_thread_task_runner_(main_thread_task_runner),
200 sync_provider_(sync_provider) { 201 sync_provider_(sync_provider) {
201 g_sync_provider_tls.Pointer()->Set(this); 202 g_sync_provider_tls.Pointer()->Set(this);
202 } 203 }
203 204
204 BackgroundSyncProviderThreadProxy::~BackgroundSyncProviderThreadProxy() { 205 BackgroundSyncProviderThreadProxy::~BackgroundSyncProviderThreadProxy() {
205 g_sync_provider_tls.Pointer()->Set(nullptr); 206 g_sync_provider_tls.Pointer()->Set(nullptr);
206 } 207 }
207 208
208 } // namespace content 209 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698