OLD | NEW |
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 #ifndef CONTENT_RENDERER_BACKGROUND_SYNC_BACKGROUND_SYNC_CLIENT_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_BACKGROUND_SYNC_BACKGROUND_SYNC_CLIENT_IMPL_H_ |
6 #define CONTENT_RENDERER_BACKGROUND_SYNC_BACKGROUND_SYNC_CLIENT_IMPL_H_ | 6 #define CONTENT_RENDERER_BACKGROUND_SYNC_BACKGROUND_SYNC_CLIENT_IMPL_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
11 | 11 |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "content/common/background_sync_service.mojom.h" | 14 #include "content/common/background_sync_service.mojom.h" |
15 #include "content/common/content_export.h" | 15 #include "content/common/content_export.h" |
16 #include "mojo/public/cpp/bindings/strong_binding.h" | 16 #include "mojo/public/cpp/bindings/strong_binding.h" |
17 | 17 |
18 namespace content { | 18 namespace content { |
19 | 19 |
20 class CONTENT_EXPORT BackgroundSyncClientImpl | 20 class CONTENT_EXPORT BackgroundSyncClientImpl |
21 : public NON_EXPORTED_BASE(BackgroundSyncServiceClient) { | 21 : public NON_EXPORTED_BASE(BackgroundSyncServiceClient) { |
22 public: | 22 public: |
23 static void Create( | 23 static void Create( |
24 int64_t service_worker_registration_id, | |
25 mojo::InterfaceRequest<BackgroundSyncServiceClient> request); | 24 mojo::InterfaceRequest<BackgroundSyncServiceClient> request); |
26 | 25 |
27 ~BackgroundSyncClientImpl() override; | 26 ~BackgroundSyncClientImpl() override; |
28 | 27 |
29 private: | 28 private: |
30 using SyncCallback = mojo::Callback<void(ServiceWorkerEventStatus)>; | 29 using SyncCallback = mojo::Callback<void(ServiceWorkerEventStatus)>; |
31 BackgroundSyncClientImpl( | 30 explicit BackgroundSyncClientImpl( |
32 int64_t service_worker_registration_id, | |
33 mojo::InterfaceRequest<BackgroundSyncServiceClient> request); | 31 mojo::InterfaceRequest<BackgroundSyncServiceClient> request); |
34 | 32 |
35 // BackgroundSyncServiceClient methods: | 33 // BackgroundSyncServiceClient methods: |
36 void Sync(int64_t handle_id, | 34 void Sync(int64_t handle_id, |
37 content::BackgroundSyncEventLastChance last_chance, | 35 content::BackgroundSyncEventLastChance last_chance, |
38 const SyncCallback& callback) override; | 36 const SyncCallback& callback) override; |
39 void SyncDidGetRegistration( | 37 void SyncDidGetRegistration( |
40 int64_t callback_id, | 38 int64_t callback_id, |
41 content::BackgroundSyncEventLastChance last_chance, | 39 content::BackgroundSyncEventLastChance last_chance, |
42 BackgroundSyncError error, | 40 BackgroundSyncError error, |
43 SyncRegistrationPtr registration); | 41 SyncRegistrationPtr registration); |
44 | 42 |
45 int64_t service_worker_registration_id_; | |
46 mojo::StrongBinding<BackgroundSyncServiceClient> binding_; | 43 mojo::StrongBinding<BackgroundSyncServiceClient> binding_; |
47 | 44 |
48 int64_t callback_seq_num_; | 45 int64_t callback_seq_num_; |
49 std::map<int64_t, SyncCallback> sync_callbacks_; | 46 std::map<int64_t, SyncCallback> sync_callbacks_; |
50 | 47 |
51 DISALLOW_COPY_AND_ASSIGN(BackgroundSyncClientImpl); | 48 DISALLOW_COPY_AND_ASSIGN(BackgroundSyncClientImpl); |
52 }; | 49 }; |
53 | 50 |
54 } // namespace content | 51 } // namespace content |
55 | 52 |
56 #endif // CONTENT_RENDERER_BACKGROUND_SYNC_BACKGROUND_SYNC_CLIENT_IMPL_H_ | 53 #endif // CONTENT_RENDERER_BACKGROUND_SYNC_BACKGROUND_SYNC_CLIENT_IMPL_H_ |
OLD | NEW |