OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "build/build_config.h" | 7 #include "build/build_config.h" |
8 | 8 |
9 #include <sys/stat.h> | 9 #include <sys/stat.h> |
10 #if defined(OS_POSIX) | 10 #if defined(OS_POSIX) |
(...skipping 13 matching lines...) Expand all Loading... |
24 #include <iterator> | 24 #include <iterator> |
25 #include <limits> | 25 #include <limits> |
26 #include <set> | 26 #include <set> |
27 #include <string> | 27 #include <string> |
28 | 28 |
29 #include "base/hash_tables.h" | 29 #include "base/hash_tables.h" |
30 #include "base/file_util.h" | 30 #include "base/file_util.h" |
31 #include "base/logging.h" | 31 #include "base/logging.h" |
32 #include "base/perftimer.h" | 32 #include "base/perftimer.h" |
33 #include "base/scoped_ptr.h" | 33 #include "base/scoped_ptr.h" |
34 #include "base/string_util.h" | 34 #include "base/string_number_conversions.h" |
35 #include "base/stl_util-inl.h" | 35 #include "base/stl_util-inl.h" |
36 #include "base/time.h" | 36 #include "base/time.h" |
37 #include "chrome/browser/sync/engine/syncer.h" | 37 #include "chrome/browser/sync/engine/syncer.h" |
38 #include "chrome/browser/sync/engine/syncer_util.h" | 38 #include "chrome/browser/sync/engine/syncer_util.h" |
39 #include "chrome/browser/sync/protocol/autofill_specifics.pb.h" | 39 #include "chrome/browser/sync/protocol/autofill_specifics.pb.h" |
40 #include "chrome/browser/sync/protocol/bookmark_specifics.pb.h" | 40 #include "chrome/browser/sync/protocol/bookmark_specifics.pb.h" |
41 #include "chrome/browser/sync/protocol/password_specifics.pb.h" | 41 #include "chrome/browser/sync/protocol/password_specifics.pb.h" |
42 #include "chrome/browser/sync/protocol/preference_specifics.pb.h" | 42 #include "chrome/browser/sync/protocol/preference_specifics.pb.h" |
43 #include "chrome/browser/sync/protocol/service_constants.h" | 43 #include "chrome/browser/sync/protocol/service_constants.h" |
44 #include "chrome/browser/sync/protocol/theme_specifics.pb.h" | 44 #include "chrome/browser/sync/protocol/theme_specifics.pb.h" |
(...skipping 1389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1434 // Always returns a client ID that is the string representation of a negative | 1434 // Always returns a client ID that is the string representation of a negative |
1435 // number. | 1435 // number. |
1436 Id Directory::NextId() { | 1436 Id Directory::NextId() { |
1437 int64 result; | 1437 int64 result; |
1438 { | 1438 { |
1439 ScopedKernelLock lock(this); | 1439 ScopedKernelLock lock(this); |
1440 result = (kernel_->persisted_info.next_id)--; | 1440 result = (kernel_->persisted_info.next_id)--; |
1441 kernel_->info_status = KERNEL_SHARE_INFO_DIRTY; | 1441 kernel_->info_status = KERNEL_SHARE_INFO_DIRTY; |
1442 } | 1442 } |
1443 DCHECK_LT(result, 0); | 1443 DCHECK_LT(result, 0); |
1444 return Id::CreateFromClientString(Int64ToString(result)); | 1444 return Id::CreateFromClientString(base::Int64ToString(result)); |
1445 } | 1445 } |
1446 | 1446 |
1447 Id Directory::GetChildWithNullIdField(IdField field, | 1447 Id Directory::GetChildWithNullIdField(IdField field, |
1448 BaseTransaction* trans, | 1448 BaseTransaction* trans, |
1449 const Id& parent_id) { | 1449 const Id& parent_id) { |
1450 // This query is O(number of children), which should be acceptable | 1450 // This query is O(number of children), which should be acceptable |
1451 // when this method is used as the first step in enumerating the children of | 1451 // when this method is used as the first step in enumerating the children of |
1452 // a node. But careless use otherwise could potentially result in | 1452 // a node. But careless use otherwise could potentially result in |
1453 // O((number of children)^2) performance. | 1453 // O((number of children)^2) performance. |
1454 ChildHandles child_handles; | 1454 ChildHandles child_handles; |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1578 return s << std::dec; | 1578 return s << std::dec; |
1579 } | 1579 } |
1580 | 1580 |
1581 FastDump& operator<<(FastDump& dump, const syncable::Blob& blob) { | 1581 FastDump& operator<<(FastDump& dump, const syncable::Blob& blob) { |
1582 if (blob.empty()) | 1582 if (blob.empty()) |
1583 return dump; | 1583 return dump; |
1584 string buffer(HexEncode(&blob[0], blob.size())); | 1584 string buffer(HexEncode(&blob[0], blob.size())); |
1585 dump.out_->sputn(buffer.c_str(), buffer.size()); | 1585 dump.out_->sputn(buffer.c_str(), buffer.size()); |
1586 return dump; | 1586 return dump; |
1587 } | 1587 } |
OLD | NEW |