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

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

Issue 446223002: Remove WeakHandle from components/invalidation (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review fixes Created 6 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « components/invalidation/DEPS ('k') | components/invalidation/invalidation.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #ifndef COMPONENTS_INVALIDATION_INVALIDATION_H_ 5 #ifndef COMPONENTS_INVALIDATION_INVALIDATION_H_
6 #define COMPONENTS_INVALIDATION_INVALIDATION_H_ 6 #define COMPONENTS_INVALIDATION_INVALIDATION_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/memory/weak_ptr.h"
13 #include "base/sequenced_task_runner.h"
12 #include "base/values.h" 14 #include "base/values.h"
13 #include "components/invalidation/ack_handle.h" 15 #include "components/invalidation/ack_handle.h"
14 #include "components/invalidation/invalidation_export.h" 16 #include "components/invalidation/invalidation_export.h"
15 #include "google/cacheinvalidation/include/types.h" 17 #include "google/cacheinvalidation/include/types.h"
16 #include "sync/internal_api/public/util/weak_handle.h"
17 18
18 namespace syncer { 19 namespace syncer {
19 20
20 class DroppedInvalidationTracker; 21 class DroppedInvalidationTracker;
21 class AckHandler; 22 class AckHandler;
22 23
23 // Represents a local invalidation, and is roughly analogous to 24 // Represents a local invalidation, and is roughly analogous to
24 // invalidation::Invalidation. Unlike invalidation::Invalidation, this class 25 // invalidation::Invalidation. Unlike invalidation::Invalidation, this class
25 // supports "local" ack-tracking and simple serialization to pref values. 26 // supports "local" ack-tracking and simple serialization to pref values.
26 class INVALIDATION_EXPORT Invalidation { 27 class INVALIDATION_EXPORT Invalidation {
(...skipping 23 matching lines...) Expand all
50 51
51 const AckHandle& ack_handle() const; 52 const AckHandle& ack_handle() const;
52 53
53 // Sets the AckHandler to be used to track this Invalidation. 54 // Sets the AckHandler to be used to track this Invalidation.
54 // 55 //
55 // This should be set by the class that generates the invalidation. Clients 56 // This should be set by the class that generates the invalidation. Clients
56 // of the Invalidations API should not need to call this. 57 // of the Invalidations API should not need to call this.
57 // 58 //
58 // Note that some sources of invalidations do not support ack tracking, and do 59 // Note that some sources of invalidations do not support ack tracking, and do
59 // not set the ack_handler. This will be hidden from users of this class. 60 // not set the ack_handler. This will be hidden from users of this class.
60 void set_ack_handler(syncer::WeakHandle<AckHandler> ack_handler); 61 void SetAckHandler(
62 base::WeakPtr<AckHandler> handler,
63 scoped_refptr<base::SequencedTaskRunner> handler_task_runner);
61 64
62 // Returns whether or not this instance supports ack tracking. This will 65 // Returns whether or not this instance supports ack tracking. This will
63 // depend on whether or not the source of invaliadations supports 66 // depend on whether or not the source of invaliadations supports
64 // invalidations. 67 // invalidations.
65 // 68 //
66 // Clients can safely ignore this flag. They can assume that all 69 // Clients can safely ignore this flag. They can assume that all
67 // invalidations support ack tracking. If they're wrong, then invalidations 70 // invalidations support ack tracking. If they're wrong, then invalidations
68 // will be less reliable, but their behavior will be no less correct. 71 // will be less reliable, but their behavior will be no less correct.
69 bool SupportsAcknowledgement() const; 72 bool SupportsAcknowledgement() const;
70 73
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 // The version number of this invalidation. Should not be accessed if this is 109 // The version number of this invalidation. Should not be accessed if this is
107 // an unkown version invalidation. 110 // an unkown version invalidation.
108 int64 version_; 111 int64 version_;
109 112
110 // The payaload associated with this invalidation. Should not be accessed if 113 // The payaload associated with this invalidation. Should not be accessed if
111 // this is an unknown version invalidation. 114 // this is an unknown version invalidation.
112 std::string payload_; 115 std::string payload_;
113 116
114 // A locally generated unique ID used to manage local acknowledgements. 117 // A locally generated unique ID used to manage local acknowledgements.
115 AckHandle ack_handle_; 118 AckHandle ack_handle_;
116 syncer::WeakHandle<AckHandler> ack_handler_; 119
120 // The acknowledgement tracking handler and its thread.
121 base::WeakPtr<AckHandler> ack_handler_;
122 scoped_refptr<base::SequencedTaskRunner> ack_handler_task_runner_;
117 }; 123 };
118 124
119 } // namespace syncer 125 } // namespace syncer
120 126
121 #endif // COMPONENTS_INVALIDATION_INVALIDATION_H_ 127 #endif // COMPONENTS_INVALIDATION_INVALIDATION_H_
OLDNEW
« no previous file with comments | « components/invalidation/DEPS ('k') | components/invalidation/invalidation.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698