Add long running gmail memory benchmark for background tab.
[chromium-blink-merge.git] / content / browser / background_sync / background_sync_context_impl.h
blob861b6d2a3fdff982d94bb572d404cd6794eabfcc
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"
11 #include "content/public/browser/background_sync_context.h"
13 namespace content {
15 class BackgroundSyncManager;
16 class ServiceWorkerContextWrapper;
18 // Implements the BackgroundSyncContext. One instance of this exists per
19 // StoragePartition, and services multiple child processes/origins. Most logic
20 // is delegated to the owned BackgroundSyncManager instance, which is only
21 // accessed on the IO thread.
22 class CONTENT_EXPORT BackgroundSyncContextImpl : public BackgroundSyncContext {
23 public:
24 BackgroundSyncContextImpl();
26 // Init and Shutdown are for use on the UI thread when the
27 // StoragePartition is being setup and torn down.
28 void Init(const scoped_refptr<ServiceWorkerContextWrapper>& context);
29 void Shutdown();
31 // Only callable on the IO thread.
32 BackgroundSyncManager* background_sync_manager() const override;
34 protected:
35 ~BackgroundSyncContextImpl() override;
37 private:
38 void CreateBackgroundSyncManager(
39 const scoped_refptr<ServiceWorkerContextWrapper>& context);
41 void ShutdownOnIO();
43 // Only accessed on the IO thread.
44 scoped_ptr<BackgroundSyncManager> background_sync_manager_;
46 DISALLOW_COPY_AND_ASSIGN(BackgroundSyncContextImpl);
49 } // namespace content
51 #endif // CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_CONTEXT_IMPL_H_