OLD | NEW |
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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "build/build_config.h" | 6 #include "build/build_config.h" |
7 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 7 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
8 #include "chrome/browser/bookmarks/enhanced_bookmarks_features.h" | 8 #include "chrome/browser/bookmarks/enhanced_bookmarks_features.h" |
9 #include "chrome/browser/dom_distiller/dom_distiller_service_factory.h" | 9 #include "chrome/browser/dom_distiller/dom_distiller_service_factory.h" |
10 #include "chrome/browser/history/history_service.h" | 10 #include "chrome/browser/history/history_service.h" |
(...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
629 content::BrowserThread::UI), | 629 content::BrowserThread::UI), |
630 token_service_); | 630 token_service_); |
631 attachment_downloader = syncer::AttachmentDownloader::Create( | 631 attachment_downloader = syncer::AttachmentDownloader::Create( |
632 sync_service_url_, | 632 sync_service_url_, |
633 url_request_context_getter_, | 633 url_request_context_getter_, |
634 user_share.sync_credentials.email, | 634 user_share.sync_credentials.email, |
635 user_share.sync_credentials.scope_set, | 635 user_share.sync_credentials.scope_set, |
636 token_service_provider); | 636 token_service_provider); |
637 } | 637 } |
638 | 638 |
| 639 // It is important that the initial backoff delay is relatively large. For |
| 640 // whatever reason, the server may fail all requests for a short period of |
| 641 // time. When this happens we don't want to overwhelm the server with |
| 642 // requests so we use a large initial backoff. |
| 643 const base::TimeDelta initial_backoff_delay = |
| 644 base::TimeDelta::FromMinutes(30); |
| 645 const base::TimeDelta max_backoff_delay = base::TimeDelta::FromHours(4); |
639 scoped_ptr<syncer::AttachmentService> attachment_service( | 646 scoped_ptr<syncer::AttachmentService> attachment_service( |
640 new syncer::AttachmentServiceImpl(attachment_store.Pass(), | 647 new syncer::AttachmentServiceImpl(attachment_store.Pass(), |
641 attachment_uploader.Pass(), | 648 attachment_uploader.Pass(), |
642 attachment_downloader.Pass(), | 649 attachment_downloader.Pass(), |
643 delegate)); | 650 delegate, |
644 | 651 initial_backoff_delay, |
| 652 max_backoff_delay)); |
645 return attachment_service.Pass(); | 653 return attachment_service.Pass(); |
646 } | 654 } |
647 | 655 |
648 ProfileSyncComponentsFactory::SyncComponents | 656 ProfileSyncComponentsFactory::SyncComponents |
649 ProfileSyncComponentsFactoryImpl::CreateBookmarkSyncComponents( | 657 ProfileSyncComponentsFactoryImpl::CreateBookmarkSyncComponents( |
650 ProfileSyncService* profile_sync_service, | 658 ProfileSyncService* profile_sync_service, |
651 sync_driver::DataTypeErrorHandler* error_handler) { | 659 sync_driver::DataTypeErrorHandler* error_handler) { |
652 BookmarkModel* bookmark_model = | 660 BookmarkModel* bookmark_model = |
653 BookmarkModelFactory::GetForProfile(profile_sync_service->profile()); | 661 BookmarkModelFactory::GetForProfile(profile_sync_service->profile()); |
654 syncer::UserShare* user_share = profile_sync_service->GetUserShare(); | 662 syncer::UserShare* user_share = profile_sync_service->GetUserShare(); |
(...skipping 25 matching lines...) Expand all Loading... |
680 new TypedUrlModelAssociator(profile_sync_service, | 688 new TypedUrlModelAssociator(profile_sync_service, |
681 history_backend, | 689 history_backend, |
682 error_handler); | 690 error_handler); |
683 TypedUrlChangeProcessor* change_processor = | 691 TypedUrlChangeProcessor* change_processor = |
684 new TypedUrlChangeProcessor(profile_, | 692 new TypedUrlChangeProcessor(profile_, |
685 model_associator, | 693 model_associator, |
686 history_backend, | 694 history_backend, |
687 error_handler); | 695 error_handler); |
688 return SyncComponents(model_associator, change_processor); | 696 return SyncComponents(model_associator, change_processor); |
689 } | 697 } |
OLD | NEW |