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

Side by Side Diff: sync/engine/sync_session_job.cc

Issue 12317104: Remove canary member from SyncSessionJob (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 9 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "sync/engine/sync_session_job.h" 5 #include "sync/engine/sync_session_job.h"
6 #include "sync/internal_api/public/sessions/model_neutral_state.h" 6 #include "sync/internal_api/public/sessions/model_neutral_state.h"
7 7
8 namespace syncer { 8 namespace syncer {
9 9
10 SyncSessionJob::~SyncSessionJob() { 10 SyncSessionJob::~SyncSessionJob() {
11 if (destruction_observer_) 11 if (destruction_observer_)
12 destruction_observer_->OnJobDestroyed(this); 12 destruction_observer_->OnJobDestroyed(this);
13 } 13 }
14 14
15 SyncSessionJob::SyncSessionJob( 15 SyncSessionJob::SyncSessionJob(
16 Purpose purpose, 16 Purpose purpose,
17 base::TimeTicks start, 17 base::TimeTicks start,
18 scoped_ptr<sessions::SyncSession> session, 18 scoped_ptr<sessions::SyncSession> session,
19 const ConfigurationParams& config_params, 19 const ConfigurationParams& config_params,
20 const tracked_objects::Location& from_location) 20 const tracked_objects::Location& from_location)
21 : purpose_(purpose), 21 : purpose_(purpose),
22 scheduled_start_(start), 22 scheduled_start_(start),
23 session_(session.Pass()), 23 session_(session.Pass()),
24 is_canary_(false),
25 config_params_(config_params), 24 config_params_(config_params),
26 finished_(NOT_FINISHED), 25 finished_(NOT_FINISHED),
27 from_location_(from_location) { 26 from_location_(from_location) {
28 } 27 }
29 28
30 void SyncSessionJob::set_destruction_observer( 29 void SyncSessionJob::set_destruction_observer(
31 const base::WeakPtr<DestructionObserver>& destruction_observer) { 30 const base::WeakPtr<DestructionObserver>& destruction_observer) {
32 destruction_observer_ = destruction_observer; 31 destruction_observer_ = destruction_observer;
33 } 32 }
34 33
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 purpose_, scheduled_start_, CloneSession().Pass(), 106 purpose_, scheduled_start_, CloneSession().Pass(),
108 config_params_, from_here)); 107 config_params_, from_here));
109 } 108 }
110 109
111 scoped_ptr<sessions::SyncSession> SyncSessionJob::CloneSession() const { 110 scoped_ptr<sessions::SyncSession> SyncSessionJob::CloneSession() const {
112 return scoped_ptr<sessions::SyncSession>( 111 return scoped_ptr<sessions::SyncSession>(
113 new sessions::SyncSession(session_->context(), 112 new sessions::SyncSession(session_->context(),
114 session_->delegate(), session_->source())); 113 session_->delegate(), session_->source()));
115 } 114 }
116 115
117 bool SyncSessionJob::is_canary() const {
118 return is_canary_;
119 }
120
121 SyncSessionJob::Purpose SyncSessionJob::purpose() const { 116 SyncSessionJob::Purpose SyncSessionJob::purpose() const {
122 return purpose_; 117 return purpose_;
123 } 118 }
124 119
125 base::TimeTicks SyncSessionJob::scheduled_start() const { 120 base::TimeTicks SyncSessionJob::scheduled_start() const {
126 return scheduled_start_; 121 return scheduled_start_;
127 } 122 }
128 123
129 void SyncSessionJob::set_scheduled_start(base::TimeTicks start) { 124 void SyncSessionJob::set_scheduled_start(base::TimeTicks start) {
130 scheduled_start_ = start; 125 scheduled_start_ = start;
131 }; 126 };
132 127
133 const sessions::SyncSession* SyncSessionJob::session() const { 128 const sessions::SyncSession* SyncSessionJob::session() const {
134 return session_.get(); 129 return session_.get();
135 } 130 }
136 131
137 sessions::SyncSession* SyncSessionJob::mutable_session() { 132 sessions::SyncSession* SyncSessionJob::mutable_session() {
138 return session_.get(); 133 return session_.get();
139 } 134 }
140 135
141 const tracked_objects::Location& SyncSessionJob::from_location() const { 136 const tracked_objects::Location& SyncSessionJob::from_location() const {
142 return from_location_; 137 return from_location_;
143 } 138 }
144 139
145 ConfigurationParams SyncSessionJob::config_params() const { 140 ConfigurationParams SyncSessionJob::config_params() const {
146 return config_params_; 141 return config_params_;
147 } 142 }
148 143
149 void SyncSessionJob::GrantCanaryPrivilege() {
150 DCHECK_EQ(finished_, NOT_FINISHED);
151 DVLOG(2) << "Granting canary priviliege to " << session_.get();
152 is_canary_ = true;
153 }
154
155 SyncerStep SyncSessionJob::start_step() const { 144 SyncerStep SyncSessionJob::start_step() const {
156 SyncerStep start, end; 145 SyncerStep start, end;
157 GetSyncerStepsForPurpose(purpose_, &start, &end); 146 GetSyncerStepsForPurpose(purpose_, &start, &end);
158 return start; 147 return start;
159 } 148 }
160 149
161 SyncerStep SyncSessionJob::end_step() const { 150 SyncerStep SyncSessionJob::end_step() const {
162 SyncerStep start, end; 151 SyncerStep start, end;
163 GetSyncerStepsForPurpose(purpose_, &start, &end); 152 GetSyncerStepsForPurpose(purpose_, &start, &end);
164 return end; 153 return end;
(...skipping 15 matching lines...) Expand all
180 return; 169 return;
181 default: 170 default:
182 NOTREACHED(); 171 NOTREACHED();
183 *start = SYNCER_END; 172 *start = SYNCER_END;
184 *end = SYNCER_END; 173 *end = SYNCER_END;
185 return; 174 return;
186 } 175 }
187 } 176 }
188 177
189 } // namespace syncer 178 } // namespace syncer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698