| 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/debug/trace_event.h" | 7 #include "base/debug/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 Directory* BaseTransaction::directory() const { | 13 Directory* BaseTransaction::directory() const { |
| 14 return directory_; | 14 return directory_; |
| 15 } | 15 } |
| 16 | 16 |
| 17 Id BaseTransaction::root_id() const { | 17 Id BaseTransaction::root_id() const { |
| 18 return Id(); | 18 return Id(); |
| 19 } | 19 } |
| 20 | 20 |
| 21 void BaseTransaction::Lock() { | 21 void BaseTransaction::Lock() { |
| 22 TRACE_EVENT2("sync_lock_contention", "AcquireLock", | 22 TRACE_EVENT1("sync_lock_contention", "AcquireLock", |
| 23 "src_file", from_here_.file_name(), | 23 "src", from_here_.ToTraceFormat()); |
| 24 "src_func", from_here_.function_name()); | |
| 25 | 24 |
| 26 directory_->kernel_->transaction_mutex.Acquire(); | 25 directory_->kernel_->transaction_mutex.Acquire(); |
| 27 } | 26 } |
| 28 | 27 |
| 29 void BaseTransaction::Unlock() { | 28 void BaseTransaction::Unlock() { |
| 30 directory_->kernel_->transaction_mutex.Release(); | 29 directory_->kernel_->transaction_mutex.Release(); |
| 31 } | 30 } |
| 32 | 31 |
| 33 void BaseTransaction::OnUnrecoverableError( | 32 void BaseTransaction::OnUnrecoverableError( |
| 34 const tracked_objects::Location& location, | 33 const tracked_objects::Location& location, |
| (...skipping 23 matching lines...) Expand all Loading... |
| 58 | 57 |
| 59 BaseTransaction::BaseTransaction(const tracked_objects::Location& from_here, | 58 BaseTransaction::BaseTransaction(const tracked_objects::Location& from_here, |
| 60 const char* name, | 59 const char* name, |
| 61 WriterTag writer, | 60 WriterTag writer, |
| 62 Directory* directory) | 61 Directory* directory) |
| 63 : from_here_(from_here), name_(name), writer_(writer), | 62 : from_here_(from_here), name_(name), writer_(writer), |
| 64 directory_(directory), unrecoverable_error_set_(false) { | 63 directory_(directory), unrecoverable_error_set_(false) { |
| 65 // TODO(lipalani): Don't issue a good transaction if the directory has | 64 // TODO(lipalani): Don't issue a good transaction if the directory has |
| 66 // unrecoverable error set. And the callers have to check trans.good before | 65 // unrecoverable error set. And the callers have to check trans.good before |
| 67 // proceeding. | 66 // proceeding. |
| 68 TRACE_EVENT_BEGIN2("sync", name_, | 67 TRACE_EVENT_BEGIN1("sync", name_, |
| 69 "src_file", from_here_.file_name(), | 68 "src", from_here_.ToTraceFormat()); |
| 70 "src_func", from_here_.function_name()); | |
| 71 } | 69 } |
| 72 | 70 |
| 73 BaseTransaction::~BaseTransaction() { | 71 BaseTransaction::~BaseTransaction() { |
| 74 TRACE_EVENT_END0("sync", name_); | 72 TRACE_EVENT_END0("sync", name_); |
| 75 } | 73 } |
| 76 | 74 |
| 77 } // namespace syncable | 75 } // namespace syncable |
| 78 } // namespace syncer | 76 } // namespace syncer |
| OLD | NEW |