This source file includes following definitions.
- provider_id_
- setClient
- registerServiceWorker
- unregisterServiceWorker
- GetDispatcher
#include "content/child/service_worker/web_service_worker_provider_impl.h"
#include "base/atomic_sequence_num.h"
#include "base/logging.h"
#include "content/child/child_thread.h"
#include "content/child/service_worker/service_worker_dispatcher.h"
#include "content/child/thread_safe_sender.h"
#include "third_party/WebKit/public/platform/WebURL.h"
using blink::WebURL;
namespace content {
WebServiceWorkerProviderImpl::WebServiceWorkerProviderImpl(
ThreadSafeSender* thread_safe_sender,
int provider_id)
: thread_safe_sender_(thread_safe_sender),
provider_id_(provider_id) {
}
WebServiceWorkerProviderImpl::~WebServiceWorkerProviderImpl() {
GetDispatcher()->RemoveScriptClient(provider_id_);
}
void WebServiceWorkerProviderImpl::setClient(
blink::WebServiceWorkerProviderClient* client) {
if (client)
GetDispatcher()->AddScriptClient(provider_id_, client);
else
GetDispatcher()->RemoveScriptClient(provider_id_);
}
void WebServiceWorkerProviderImpl::registerServiceWorker(
const WebURL& pattern,
const WebURL& script_url,
WebServiceWorkerCallbacks* callbacks) {
GetDispatcher()->RegisterServiceWorker(pattern, script_url, callbacks);
}
void WebServiceWorkerProviderImpl::unregisterServiceWorker(
const WebURL& pattern,
WebServiceWorkerCallbacks* callbacks) {
GetDispatcher()->UnregisterServiceWorker(pattern, callbacks);
}
ServiceWorkerDispatcher* WebServiceWorkerProviderImpl::GetDispatcher() {
return ServiceWorkerDispatcher::ThreadSpecificInstance(thread_safe_sender_);
}
}