Add long running gmail memory benchmark for background tab.
[chromium-blink-merge.git] / content / browser / background_sync / background_sync_registration.h
blob94d764811eb6fc2136fa96e1e71f78894af5067d
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_REGISTRATION_H_
6 #define CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_REGISTRATION_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "content/browser/background_sync/background_sync.pb.h"
10 #include "content/browser/background_sync/background_sync_registration_options.h"
11 #include "content/common/background_sync_service.mojom.h"
12 #include "content/common/content_export.h"
13 #include "third_party/mojo/src/mojo/public/cpp/bindings/type_converter.h"
15 namespace content {
17 class CONTENT_EXPORT BackgroundSyncRegistration {
18 public:
19 using RegistrationId = int64_t;
20 static const RegistrationId kInitialId;
22 BackgroundSyncRegistration();
23 bool Equals(const BackgroundSyncRegistration& other) const;
24 bool IsValid() const;
26 const BackgroundSyncRegistrationOptions* options() const { return &options_; }
27 BackgroundSyncRegistrationOptions* options() { return &options_; }
29 RegistrationId id() const { return id_; }
30 void set_id(RegistrationId id) { id_ = id; }
32 SyncState sync_state() const { return sync_state_; }
33 void set_sync_state(SyncState state) { sync_state_ = state; }
35 private:
36 static const RegistrationId kInvalidRegistrationId;
38 BackgroundSyncRegistrationOptions options_;
39 RegistrationId id_ = kInvalidRegistrationId;
40 SyncState sync_state_ = SYNC_STATE_PENDING;
43 } // namespace content
45 namespace mojo {
47 template <>
48 struct CONTENT_EXPORT
49 TypeConverter<scoped_ptr<content::BackgroundSyncRegistration>,
50 content::SyncRegistrationPtr> {
51 static scoped_ptr<content::BackgroundSyncRegistration> Convert(
52 const content::SyncRegistrationPtr& input);
55 template <>
56 struct CONTENT_EXPORT TypeConverter<content::SyncRegistrationPtr,
57 content::BackgroundSyncRegistration> {
58 static content::SyncRegistrationPtr Convert(
59 const content::BackgroundSyncRegistration& input);
62 } // namespace
64 #endif // CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_REGISTRATION_H_