Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(164)

Side by Side Diff: components/invalidation/impl/p2p_invalidation_service.h

Issue 2909113002: Deprecate NonThreadSafe in components/invalidation in favor of SequenceChecker. (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #include <memory> 5 #include <memory>
6 6
7 #include "base/callback_forward.h" 7 #include "base/callback_forward.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/threading/non_thread_safe.h" 10 #include "base/sequence_checker.h"
11 #include "components/invalidation/impl/p2p_invalidator.h" 11 #include "components/invalidation/impl/p2p_invalidator.h"
12 #include "components/invalidation/public/invalidation_service.h" 12 #include "components/invalidation/public/invalidation_service.h"
13 #include "components/keyed_service/core/keyed_service.h" 13 #include "components/keyed_service/core/keyed_service.h"
14 14
15 #ifndef COMPONENTS_INVALIDATION_IMPL_P2P_INVALIDATION_SERVICE_H_ 15 #ifndef COMPONENTS_INVALIDATION_IMPL_P2P_INVALIDATION_SERVICE_H_
16 #define COMPONENTS_INVALIDATION_IMPL_P2P_INVALIDATION_SERVICE_H_ 16 #define COMPONENTS_INVALIDATION_IMPL_P2P_INVALIDATION_SERVICE_H_
17 17
18 namespace net { 18 namespace net {
19 class URLRequestContextGetter; 19 class URLRequestContextGetter;
20 } 20 }
21 21
22 namespace syncer { 22 namespace syncer {
23 class P2PInvalidator; 23 class P2PInvalidator;
24 } 24 }
25 25
26 namespace invalidation { 26 namespace invalidation {
27 27
28 class InvalidationLogger; 28 class InvalidationLogger;
29 29
30 // This service is a wrapper around P2PInvalidator. Unlike other 30 // This service is a wrapper around P2PInvalidator. Unlike other
31 // InvalidationServices, it can both send and receive invalidations. It is used 31 // InvalidationServices, it can both send and receive invalidations. It is used
32 // only in tests, where we're unable to connect to a real invalidations server. 32 // only in tests, where we're unable to connect to a real invalidations server.
33 class P2PInvalidationService : public base::NonThreadSafe, 33 class P2PInvalidationService : public InvalidationService {
34 public InvalidationService {
35 public: 34 public:
36 P2PInvalidationService( 35 P2PInvalidationService(
37 std::unique_ptr<IdentityProvider> identity_provider, 36 std::unique_ptr<IdentityProvider> identity_provider,
38 const scoped_refptr<net::URLRequestContextGetter>& request_context, 37 const scoped_refptr<net::URLRequestContextGetter>& request_context,
39 syncer::P2PNotificationTarget notification_target); 38 syncer::P2PNotificationTarget notification_target);
40 ~P2PInvalidationService() override; 39 ~P2PInvalidationService() override;
41 40
42 // InvalidationService implementation. 41 // InvalidationService implementation.
43 // It is an error to have registered handlers when the service is destroyed. 42 // It is an error to have registered handlers when the service is destroyed.
44 void RegisterInvalidationHandler( 43 void RegisterInvalidationHandler(
(...skipping 12 matching lines...) Expand all
57 void UpdateCredentials(const std::string& username, 56 void UpdateCredentials(const std::string& username,
58 const std::string& password); 57 const std::string& password);
59 58
60 void SendInvalidation(const syncer::ObjectIdSet& ids); 59 void SendInvalidation(const syncer::ObjectIdSet& ids);
61 60
62 private: 61 private:
63 std::unique_ptr<IdentityProvider> identity_provider_; 62 std::unique_ptr<IdentityProvider> identity_provider_;
64 std::unique_ptr<syncer::P2PInvalidator> invalidator_; 63 std::unique_ptr<syncer::P2PInvalidator> invalidator_;
65 std::string invalidator_id_; 64 std::string invalidator_id_;
66 65
66 SEQUENCE_CHECKER(sequence_checker_);
67
67 DISALLOW_COPY_AND_ASSIGN(P2PInvalidationService); 68 DISALLOW_COPY_AND_ASSIGN(P2PInvalidationService);
68 }; 69 };
69 70
70 } // namespace invalidation 71 } // namespace invalidation
71 72
72 #endif // COMPONENTS_INVALIDATION_IMPL_P2P_INVALIDATION_SERVICE_H_ 73 #endif // COMPONENTS_INVALIDATION_IMPL_P2P_INVALIDATION_SERVICE_H_
OLDNEW
« no previous file with comments | « components/invalidation/impl/invalidation_service_android.cc ('k') | components/invalidation/impl/p2p_invalidation_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698