OLD | NEW |
1 // Copyright (c) 2011 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/syncable/syncable.h" | 5 #include "chrome/browser/sync/syncable/syncable.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cstring> | 8 #include <cstring> |
9 #include <functional> | 9 #include <functional> |
10 #include <iomanip> | 10 #include <iomanip> |
(...skipping 1177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1188 | 1188 |
1189 BaseTransaction::BaseTransaction(const tracked_objects::Location& from_here, | 1189 BaseTransaction::BaseTransaction(const tracked_objects::Location& from_here, |
1190 const char* name, | 1190 const char* name, |
1191 WriterTag writer, | 1191 WriterTag writer, |
1192 Directory* directory) | 1192 Directory* directory) |
1193 : from_here_(from_here), name_(name), writer_(writer), | 1193 : from_here_(from_here), name_(name), writer_(writer), |
1194 directory_(directory), dirkernel_(directory->kernel_) { | 1194 directory_(directory), dirkernel_(directory->kernel_) { |
1195 TRACE_EVENT_BEGIN2("sync", name_, | 1195 TRACE_EVENT_BEGIN2("sync", name_, |
1196 "src_file", from_here_.file_name(), | 1196 "src_file", from_here_.file_name(), |
1197 "src_func", from_here_.function_name()); | 1197 "src_func", from_here_.function_name()); |
1198 dirkernel_->transaction_observer.Call(FROM_HERE, | |
1199 &TransactionObserver::OnTransactionStart, from_here_, writer_); | |
1200 } | 1198 } |
1201 | 1199 |
1202 BaseTransaction::~BaseTransaction() { | 1200 BaseTransaction::~BaseTransaction() { |
1203 if (writer_ != INVALID) { | |
1204 dirkernel_->transaction_observer.Call(FROM_HERE, | |
1205 &TransactionObserver::OnTransactionEnd, from_here_, writer_); | |
1206 } | |
1207 TRACE_EVENT_END0("sync", name_); | 1201 TRACE_EVENT_END0("sync", name_); |
1208 } | 1202 } |
1209 | 1203 |
1210 ReadTransaction::ReadTransaction(const tracked_objects::Location& location, | 1204 ReadTransaction::ReadTransaction(const tracked_objects::Location& location, |
1211 Directory* directory) | 1205 Directory* directory) |
1212 : BaseTransaction(location, "ReadTransaction", INVALID, directory) { | 1206 : BaseTransaction(location, "ReadTransaction", INVALID, directory) { |
1213 Lock(); | 1207 Lock(); |
1214 } | 1208 } |
1215 | 1209 |
1216 ReadTransaction::ReadTransaction(const tracked_objects::Location& location, | 1210 ReadTransaction::ReadTransaction(const tracked_objects::Location& location, |
(...skipping 849 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2066 if (entry->ref(NEXT_ID).IsRoot() || | 2060 if (entry->ref(NEXT_ID).IsRoot() || |
2067 entry->ref(NEXT_ID) != entry->ref(PREV_ID)) { | 2061 entry->ref(NEXT_ID) != entry->ref(PREV_ID)) { |
2068 return entry; | 2062 return entry; |
2069 } | 2063 } |
2070 } | 2064 } |
2071 // There were no children in the linked list. | 2065 // There were no children in the linked list. |
2072 return NULL; | 2066 return NULL; |
2073 } | 2067 } |
2074 | 2068 |
2075 } // namespace syncable | 2069 } // namespace syncable |
OLD | NEW |