Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_EVENT_DISPATCHER_H_ | |
| 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_EVENT_DISPATCHER_H_ | |
| 7 | |
| 8 #include "base/memory/ref_counted.h" | |
| 9 #include "content/browser/service_worker/service_worker_version.h" | |
| 10 #include "content/common/background_sync_service.mojom.h" | |
| 11 #include "content/common/service_worker/service_worker_status_code.h" | |
| 12 #include "content/public/browser/browser_thread.h" | |
| 13 | |
| 14 namespace content { | |
| 15 | |
| 16 // This class is used by ServiceWorkerVersion to fire events in the service | |
| 17 // worker using mojo IPC. It owns an InterfacePtr to each service, which it will | |
| 18 // construct as necessary. | |
| 19 // | |
| 20 // All public methods must be called on UI thread. Can be constructed, owned, | |
|
jkarlin
2015/06/12 21:08:14
s/Can be constructed/This class can be constructed
| |
| 21 // and destructed on a separate thread. | |
| 22 class ServiceWorkerEventDispatcher | |
| 23 : public base::RefCountedThreadSafe<ServiceWorkerEventDispatcher, | |
| 24 BrowserThread::DeleteOnUIThread> { | |
| 25 public: | |
| 26 ServiceWorkerEventDispatcher(); | |
| 27 | |
| 28 // Dispatches the event and then runs |callback| on |task_runner| with the | |
| 29 // result. | |
| 30 void DispatchSyncEvent(int render_process_id, | |
| 31 int thread_id, | |
| 32 const ServiceWorkerVersion::StatusCallback& callback, | |
| 33 const scoped_refptr<base::TaskRunner>& task_runner); | |
| 34 | |
| 35 private: | |
| 36 friend class base::RefCountedThreadSafe<ServiceWorkerEventDispatcher, | |
| 37 BrowserThread::DeleteOnUIThread>; | |
| 38 friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>; | |
| 39 friend class base::DeleteHelper<ServiceWorkerEventDispatcher>; | |
| 40 | |
| 41 ~ServiceWorkerEventDispatcher(); | |
| 42 | |
| 43 void OnEventFinished(const ServiceWorkerVersion::StatusCallback& callback, | |
| 44 const scoped_refptr<base::TaskRunner>& task_runner, | |
| 45 ServiceWorkerEventStatus result); | |
| 46 | |
| 47 BackgroundSyncServiceClientPtr background_sync_client_; | |
| 48 }; | |
| 49 | |
| 50 } // namespace content | |
| 51 | |
| 52 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_EVENT_DISPATCHER_H_ | |
| OLD | NEW |