| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/syncable/syncable_base_transaction.h" | 5 #include "sync/syncable/syncable_base_transaction.h" |
| 6 | 6 |
| 7 #include "base/trace_event/trace_event.h" | 7 #include "base/trace_event/trace_event.h" |
| 8 #include "sync/syncable/directory.h" | 8 #include "sync/syncable/directory.h" |
| 9 | 9 |
| 10 namespace syncer { | 10 namespace syncer { |
| 11 namespace syncable { | 11 namespace syncable { |
| 12 | 12 |
| 13 // static | 13 // static |
| 14 Id BaseTransaction::root_id() { | 14 Id BaseTransaction::root_id() { |
| 15 return Id::GetRoot(); | 15 return Id::GetRoot(); |
| 16 } | 16 } |
| 17 | 17 |
| 18 Directory* BaseTransaction::directory() const { | 18 Directory* BaseTransaction::directory() const { |
| 19 return directory_; | 19 return directory_; |
| 20 } | 20 } |
| 21 | 21 |
| 22 void BaseTransaction::Lock() { | 22 void BaseTransaction::Lock() { |
| 23 TRACE_EVENT2("sync_lock_contention", "AcquireLock", | 23 TRACE_EVENT2("sync_lock_contention", "AcquireLock", |
| 24 "src_file", from_here_.file_name(), | 24 "src_file", from_here_.file_name(), |
| 25 "src_func", from_here_.function_name()); | 25 "src_func", from_here_.function_name()); |
| 26 | 26 |
| 27 directory_->kernel_->transaction_mutex.Acquire(); | 27 directory_->kernel()->transaction_mutex.Acquire(); |
| 28 } | 28 } |
| 29 | 29 |
| 30 void BaseTransaction::Unlock() { | 30 void BaseTransaction::Unlock() { |
| 31 directory_->kernel_->transaction_mutex.Release(); | 31 directory_->kernel()->transaction_mutex.Release(); |
| 32 } | 32 } |
| 33 | 33 |
| 34 void BaseTransaction::OnUnrecoverableError( | 34 void BaseTransaction::OnUnrecoverableError( |
| 35 const tracked_objects::Location& location, | 35 const tracked_objects::Location& location, |
| 36 const std::string& message) { | 36 const std::string& message) { |
| 37 unrecoverable_error_set_ = true; | 37 unrecoverable_error_set_ = true; |
| 38 unrecoverable_error_location_ = location; | 38 unrecoverable_error_location_ = location; |
| 39 unrecoverable_error_msg_ = message; | 39 unrecoverable_error_msg_ = message; |
| 40 | 40 |
| 41 // Note: We dont call the Directory's OnUnrecoverableError method right | 41 // Note: We dont call the Directory's OnUnrecoverableError method right |
| (...skipping 28 matching lines...) Expand all Loading... |
| 70 "src_file", from_here_.file_name(), | 70 "src_file", from_here_.file_name(), |
| 71 "src_func", from_here_.function_name()); | 71 "src_func", from_here_.function_name()); |
| 72 } | 72 } |
| 73 | 73 |
| 74 BaseTransaction::~BaseTransaction() { | 74 BaseTransaction::~BaseTransaction() { |
| 75 TRACE_EVENT_END0("sync", name_); | 75 TRACE_EVENT_END0("sync", name_); |
| 76 } | 76 } |
| 77 | 77 |
| 78 } // namespace syncable | 78 } // namespace syncable |
| 79 } // namespace syncer | 79 } // namespace syncer |
| OLD | NEW |