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

Side by Side Diff: content/browser/service_worker/service_worker_event_dispatcher.h

Issue 1171173002: [Background Sync] Use Mojo IPC to fire background sync events (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make mojo event return path generic Created 5 years, 6 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
(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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698