OLD | NEW |
---|---|
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 "sync/internal_api/public/attachments/attachment_service_impl.h" | 5 #include "sync/internal_api/public/attachments/attachment_service_impl.h" |
6 | 6 |
7 #include <iterator> | 7 #include <iterator> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
266 void AttachmentServiceImpl::BeginUpload(const AttachmentId& attachment_id) { | 266 void AttachmentServiceImpl::BeginUpload(const AttachmentId& attachment_id) { |
267 DCHECK(CalledOnValidThread()); | 267 DCHECK(CalledOnValidThread()); |
268 AttachmentIdList attachment_ids; | 268 AttachmentIdList attachment_ids; |
269 attachment_ids.push_back(attachment_id); | 269 attachment_ids.push_back(attachment_id); |
270 attachment_store_->Read(attachment_ids, | 270 attachment_store_->Read(attachment_ids, |
271 base::Bind(&AttachmentServiceImpl::ReadDoneNowUpload, | 271 base::Bind(&AttachmentServiceImpl::ReadDoneNowUpload, |
272 weak_ptr_factory_.GetWeakPtr())); | 272 weak_ptr_factory_.GetWeakPtr())); |
273 } | 273 } |
274 | 274 |
275 void AttachmentServiceImpl::UploadAttachments( | 275 void AttachmentServiceImpl::UploadAttachments( |
276 const AttachmentIdSet& attachment_ids) { | 276 const AttachmentIdList& attachment_ids) { |
277 DCHECK(CalledOnValidThread()); | 277 DCHECK(CalledOnValidThread()); |
278 if (!attachment_uploader_.get()) { | 278 if (!attachment_uploader_.get()) { |
279 return; | 279 return; |
280 } | 280 } |
281 AttachmentIdSet::const_iterator iter = attachment_ids.begin(); | 281 for (auto iter = attachment_ids.begin(); iter != attachment_ids.end(); |
maniscalco
2015/03/25 00:42:39
Oooh, fancy.
| |
282 AttachmentIdSet::const_iterator end = attachment_ids.end(); | 282 ++iter) { |
283 for (; iter != end; ++iter) { | |
284 upload_task_queue_->AddToQueue(*iter); | 283 upload_task_queue_->AddToQueue(*iter); |
285 } | 284 } |
286 } | 285 } |
287 | 286 |
288 void AttachmentServiceImpl::OnNetworkChanged( | 287 void AttachmentServiceImpl::OnNetworkChanged( |
289 net::NetworkChangeNotifier::ConnectionType type) { | 288 net::NetworkChangeNotifier::ConnectionType type) { |
290 if (type != net::NetworkChangeNotifier::CONNECTION_NONE) { | 289 if (type != net::NetworkChangeNotifier::CONNECTION_NONE) { |
291 upload_task_queue_->ResetBackoff(); | 290 upload_task_queue_->ResetBackoff(); |
292 } | 291 } |
293 } | 292 } |
(...skipping 21 matching lines...) Expand all Loading... | |
315 base::Bind(&AttachmentServiceImpl::UploadDone, | 314 base::Bind(&AttachmentServiceImpl::UploadDone, |
316 weak_ptr_factory_.GetWeakPtr())); | 315 weak_ptr_factory_.GetWeakPtr())); |
317 } | 316 } |
318 } | 317 } |
319 | 318 |
320 void AttachmentServiceImpl::SetTimerForTest(scoped_ptr<base::Timer> timer) { | 319 void AttachmentServiceImpl::SetTimerForTest(scoped_ptr<base::Timer> timer) { |
321 upload_task_queue_->SetTimerForTest(timer.Pass()); | 320 upload_task_queue_->SetTimerForTest(timer.Pass()); |
322 } | 321 } |
323 | 322 |
324 } // namespace syncer | 323 } // namespace syncer |
OLD | NEW |