| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/change_processor.h" | 5 #include "chrome/browser/sync/glue/change_processor.h" |
| 6 #include "chrome/browser/profiles/profile.h" | 6 #include "chrome/browser/profiles/profile.h" |
| 7 | 7 |
| 8 namespace browser_sync { | 8 namespace browser_sync { |
| 9 | 9 |
| 10 ChangeProcessor::ChangeProcessor(UnrecoverableErrorHandler* error_handler) |
| 11 : running_(false), |
| 12 error_handler_(error_handler), |
| 13 share_handle_(NULL) {} |
| 14 |
| 10 ChangeProcessor::~ChangeProcessor() { | 15 ChangeProcessor::~ChangeProcessor() { |
| 11 DCHECK(!running_) << "ChangeProcessor dtor while running"; | 16 DCHECK(!running_) << "ChangeProcessor dtor while running"; |
| 12 } | 17 } |
| 13 | 18 |
| 14 void ChangeProcessor::Start(Profile* profile, | 19 void ChangeProcessor::Start(Profile* profile, |
| 15 sync_api::UserShare* share_handle) { | 20 sync_api::UserShare* share_handle) { |
| 16 DCHECK(error_handler_ && !share_handle_); | 21 DCHECK(error_handler_ && !share_handle_); |
| 17 share_handle_ = share_handle; | 22 share_handle_ = share_handle; |
| 18 StartImpl(profile); | 23 StartImpl(profile); |
| 19 running_ = true; | 24 running_ = true; |
| 20 } | 25 } |
| 21 | 26 |
| 22 void ChangeProcessor::Stop() { | 27 void ChangeProcessor::Stop() { |
| 23 if (!running_) | 28 if (!running_) |
| 24 return; | 29 return; |
| 25 StopImpl(); | 30 StopImpl(); |
| 26 share_handle_ = NULL; | 31 share_handle_ = NULL; |
| 27 running_ = false; | 32 running_ = false; |
| 28 } | 33 } |
| 29 | 34 |
| 30 bool ChangeProcessor::IsRunning() const { | 35 bool ChangeProcessor::IsRunning() const { |
| 31 return running_; | 36 return running_; |
| 32 } | 37 } |
| 33 | 38 |
| 39 // Not implemented by default. |
| 40 void ChangeProcessor::CommitChangesFromSyncModel() {} |
| 41 |
| 42 UnrecoverableErrorHandler* ChangeProcessor::error_handler() { |
| 43 return error_handler_; |
| 44 } |
| 45 |
| 46 sync_api::UserShare* ChangeProcessor::share_handle() { |
| 47 return share_handle_; |
| 48 } |
| 49 |
| 34 } // namespace browser_sync | 50 } // namespace browser_sync |
| OLD | NEW |