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

Side by Side Diff: chrome/browser/sync/glue/shared_change_processor.cc

Issue 263903004: Add AttachmentUploader interface and fake implementation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. Created 6 years, 7 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 | « no previous file | components/sync_driver/generic_change_processor_unittest.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 (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 "chrome/browser/sync/glue/shared_change_processor.h" 5 #include "chrome/browser/sync/glue/shared_change_processor.h"
6 6
7 #include "base/message_loop/message_loop_proxy.h" 7 #include "base/message_loop/message_loop_proxy.h"
8 #include "chrome/browser/sync/profile_sync_service.h" 8 #include "chrome/browser/sync/profile_sync_service.h"
9 #include "components/sync_driver/generic_change_processor.h" 9 #include "components/sync_driver/generic_change_processor.h"
10 #include "components/sync_driver/generic_change_processor_factory.h" 10 #include "components/sync_driver/generic_change_processor_factory.h"
11 #include "components/sync_driver/sync_api_component_factory.h" 11 #include "components/sync_driver/sync_api_component_factory.h"
12 #include "sync/api/attachments/attachment_service.h" 12 #include "sync/api/attachments/attachment_service.h"
13 #include "sync/api/attachments/fake_attachment_service.h" 13 #include "sync/api/attachments/fake_attachment_service.h"
14 #include "sync/api/attachments/fake_attachment_uploader.h"
14 #include "sync/api/sync_change.h" 15 #include "sync/api/sync_change.h"
15 16
16 using base::AutoLock; 17 using base::AutoLock;
17 18
18 namespace browser_sync { 19 namespace browser_sync {
19 20
20 SharedChangeProcessor::SharedChangeProcessor() 21 SharedChangeProcessor::SharedChangeProcessor()
21 : disconnected_(false), 22 : disconnected_(false),
22 type_(syncer::UNSPECIFIED), 23 type_(syncer::UNSPECIFIED),
23 sync_service_(NULL), 24 sync_service_(NULL),
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 sync_service_ = sync_service; 66 sync_service_ = sync_service;
66 error_handler_ = error_handler; 67 error_handler_ = error_handler;
67 base::WeakPtr<syncer::SyncableService> local_service = 68 base::WeakPtr<syncer::SyncableService> local_service =
68 sync_factory->GetSyncableServiceForType(type); 69 sync_factory->GetSyncableServiceForType(type);
69 if (!local_service.get()) { 70 if (!local_service.get()) {
70 LOG(WARNING) << "SyncableService destroyed before DTC was stopped."; 71 LOG(WARNING) << "SyncableService destroyed before DTC was stopped.";
71 disconnected_ = true; 72 disconnected_ = true;
72 return base::WeakPtr<syncer::SyncableService>(); 73 return base::WeakPtr<syncer::SyncableService>();
73 } 74 }
74 75
76 // TODO(maniscalco): Use a shared (one per profile) thread-safe instance of
77 // AttachmentUpload instead of creating a new one per AttachmentService (bug
78 // 369536).
79 scoped_ptr<syncer::AttachmentUploader> attachment_uploader(
80 new syncer::FakeAttachmentUploader);
75 // TODO(maniscalco): Replace FakeAttachmentService with a real 81 // TODO(maniscalco): Replace FakeAttachmentService with a real
76 // AttachmentService implementation once implemented (bug 356359). 82 // AttachmentService implementation once implemented (bug 356359).
77 scoped_ptr<syncer::AttachmentService> attachment_service( 83 scoped_ptr<syncer::AttachmentService> attachment_service(
78 new syncer::FakeAttachmentService( 84 new syncer::FakeAttachmentService(
79 sync_factory->CreateCustomAttachmentStoreForType(type))); 85 sync_factory->CreateCustomAttachmentStoreForType(type),
86 attachment_uploader.Pass()));
80 87
81 generic_change_processor_ = processor_factory->CreateGenericChangeProcessor( 88 generic_change_processor_ = processor_factory->CreateGenericChangeProcessor(
82 sync_service_->GetUserShare(), 89 sync_service_->GetUserShare(),
83 error_handler, 90 error_handler,
84 local_service, 91 local_service,
85 merge_result, 92 merge_result,
86 attachment_service.Pass()).release(); 93 attachment_service.Pass()).release();
87 return local_service; 94 return local_service;
88 } 95 }
89 96
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 return error_handler_->CreateAndUploadError(location, message, type_); 231 return error_handler_->CreateAndUploadError(location, message, type_);
225 } else { 232 } else {
226 return syncer::SyncError(location, 233 return syncer::SyncError(location,
227 syncer::SyncError::DATATYPE_ERROR, 234 syncer::SyncError::DATATYPE_ERROR,
228 message, 235 message,
229 type_); 236 type_);
230 } 237 }
231 } 238 }
232 239
233 } // namespace browser_sync 240 } // namespace browser_sync
OLDNEW
« no previous file with comments | « no previous file | components/sync_driver/generic_change_processor_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698