Chromium Code Reviews| Index: content/renderer/background_sync/background_sync_client_impl.h |
| diff --git a/content/renderer/background_sync/background_sync_client_impl.h b/content/renderer/background_sync/background_sync_client_impl.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..9e34321726c675c84c1d8699887dd9cb9cd2cc1d |
| --- /dev/null |
| +++ b/content/renderer/background_sync/background_sync_client_impl.h |
| @@ -0,0 +1,55 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CONTENT_RENDERER_BACKGROUND_SYNC_BACKGROUND_SYNC_CLIENT_IMPL_H_ |
| +#define CONTENT_RENDERER_BACKGROUND_SYNC_BACKGROUND_SYNC_CLIENT_IMPL_H_ |
| + |
| +#include "base/memory/ref_counted.h" |
| +#include "base/memory/weak_ptr.h" |
| +#include "content/common/background_sync_service.mojom.h" |
| +#include "content/common/content_export.h" |
| +#include "third_party/mojo/src/mojo/public/cpp/bindings/strong_binding.h" |
| + |
| +namespace content { |
| + |
| +using SyncCallback = mojo::Callback<void(ServiceWorkerEventStatus)>; |
| + |
|
jkarlin
2015/06/12 21:08:15
Document the class. Especially, what thread does i
iclelland
2015/06/16 15:59:16
Done.
|
| +class CONTENT_EXPORT BackgroundSyncClientImpl |
| + : public NON_EXPORTED_BASE(BackgroundSyncServiceClient) { |
| + public: |
| + static void Create( |
| + const scoped_refptr<base::SingleThreadTaskRunner>& |
| + main_thread_task_runner, |
| + mojo::InterfaceRequest<BackgroundSyncServiceClient> request); |
| + |
| + ~BackgroundSyncClientImpl() override; |
| + |
| + private: |
| + explicit BackgroundSyncClientImpl( |
| + const scoped_refptr<base::SingleThreadTaskRunner>& |
| + main_thread_task_runner, |
| + mojo::InterfaceRequest<BackgroundSyncServiceClient> request); |
| + |
| + // BackgroundSyncClient methods: |
| + void Sync(content::SyncRegistrationPtr registration, |
| + int thread_id, |
| + const SyncCallback& callback) override; |
| + |
| + void DispatchSyncForWorker(content::SyncRegistrationPtr event, |
| + const SyncCallback& callback); |
| + void OnSyncComplete(const SyncCallback& callback, |
| + ServiceWorkerEventStatus status); |
| + |
| + mojo::StrongBinding<BackgroundSyncServiceClient> binding_; |
| + |
| + scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; |
| + |
| + base::WeakPtrFactory<BackgroundSyncClientImpl> weak_ptr_factory_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(BackgroundSyncClientImpl); |
| +}; |
| + |
| +} // namespace content |
| + |
| +#endif // CONTENT_RENDERER_BACKGROUND_SYNC_BACKGROUND_SYNC_CLIENT_IMPL_H_ |