Roll DEPS for PDFium to 19ae17578f99621100a26dac3e2c7c3dbf7c7cd1
[chromium-blink-merge.git] / content / browser / background_sync / background_sync_context_impl.h
blob4cf34902698969a1480d77d5e2089c77a02396c9
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.
5 #ifndef CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_CONTEXT_IMPL_H_
6 #define CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_CONTEXT_IMPL_H_
8 #include "base/memory/ref_counted.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "content/common/content_export.h"
12 namespace content {
14 class BackgroundSyncManager;
15 class ServiceWorkerContextWrapper;
17 // One instance of this exists per StoragePartition, and services multiple
18 // child processes/origins. Most logic is delegated to the owned
19 // BackgroundSyncManager instance, which is only accessed on the IO
20 // thread.
21 // TODO(jkarlin): Make a public/ BackgroundSyncContext.
22 class CONTENT_EXPORT BackgroundSyncContextImpl
23 : public base::RefCountedThreadSafe<BackgroundSyncContextImpl> {
24 public:
25 BackgroundSyncContextImpl();
27 // Init and Shutdown are for use on the UI thread when the profile,
28 // storagepartition is being setup and torn down.
29 void Init(const scoped_refptr<ServiceWorkerContextWrapper>& context);
30 void Shutdown();
32 // Only callable on the IO thread.
33 BackgroundSyncManager* background_sync_manager() const;
35 private:
36 friend class base::RefCountedThreadSafe<BackgroundSyncContextImpl>;
38 ~BackgroundSyncContextImpl();
40 void CreateBackgroundSyncManager(
41 const scoped_refptr<ServiceWorkerContextWrapper>& context);
43 void ShutdownOnIO();
45 // Only accessed on the IO thread.
46 scoped_ptr<BackgroundSyncManager> background_sync_manager_;
48 DISALLOW_COPY_AND_ASSIGN(BackgroundSyncContextImpl);
51 } // namespace content
53 #endif // CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_CONTEXT_IMPL_H_