Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(72)

Side by Side Diff: chrome/browser/sync_file_system/drive_backend/metadata_database.cc

Issue 2695883003: Change uses of base::JoinString to pass StringPieces where possible. (Closed)
Patch Set: Remove dependency CL. Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_file_system/drive_backend/metadata_database.h" 5 #include "chrome/browser/sync_file_system/drive_backend/metadata_database.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <stack> 8 #include <stack>
9 #include <utility> 9 #include <utility>
10 10
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/command_line.h" 12 #include "base/command_line.h"
13 #include "base/files/file_path.h" 13 #include "base/files/file_path.h"
14 #include "base/files/file_util.h" 14 #include "base/files/file_util.h"
15 #include "base/location.h" 15 #include "base/location.h"
16 #include "base/macros.h" 16 #include "base/macros.h"
17 #include "base/memory/ptr_util.h" 17 #include "base/memory/ptr_util.h"
18 #include "base/memory/scoped_vector.h" 18 #include "base/memory/scoped_vector.h"
19 #include "base/metrics/histogram_macros.h" 19 #include "base/metrics/histogram_macros.h"
20 #include "base/single_thread_task_runner.h" 20 #include "base/single_thread_task_runner.h"
21 #include "base/stl_util.h" 21 #include "base/stl_util.h"
22 #include "base/strings/string_number_conversions.h" 22 #include "base/strings/string_number_conversions.h"
23 #include "base/strings/string_piece.h"
23 #include "base/strings/string_util.h" 24 #include "base/strings/string_util.h"
24 #include "base/task_runner_util.h" 25 #include "base/task_runner_util.h"
25 #include "base/threading/thread_restrictions.h" 26 #include "base/threading/thread_restrictions.h"
26 #include "base/threading/thread_task_runner_handle.h" 27 #include "base/threading/thread_task_runner_handle.h"
27 #include "chrome/browser/sync_file_system/drive_backend/drive_backend_constants. h" 28 #include "chrome/browser/sync_file_system/drive_backend/drive_backend_constants. h"
28 #include "chrome/browser/sync_file_system/drive_backend/drive_backend_util.h" 29 #include "chrome/browser/sync_file_system/drive_backend/drive_backend_util.h"
29 #include "chrome/browser/sync_file_system/drive_backend/leveldb_wrapper.h" 30 #include "chrome/browser/sync_file_system/drive_backend/leveldb_wrapper.h"
30 #include "chrome/browser/sync_file_system/drive_backend/metadata_database.pb.h" 31 #include "chrome/browser/sync_file_system/drive_backend/metadata_database.pb.h"
31 #include "chrome/browser/sync_file_system/drive_backend/metadata_database_index. h" 32 #include "chrome/browser/sync_file_system/drive_backend/metadata_database_index. h"
32 #include "chrome/browser/sync_file_system/drive_backend/metadata_database_index_ interface.h" 33 #include "chrome/browser/sync_file_system/drive_backend/metadata_database_index_ interface.h"
(...skipping 1706 matching lines...) Expand 10 before | Expand all | Expand 10 after
1739 dict->SetString("file_id", file_id); 1740 dict->SetString("file_id", file_id);
1740 if (file.has_details()) { 1741 if (file.has_details()) {
1741 const FileDetails& details = file.details(); 1742 const FileDetails& details = file.details();
1742 dict->SetString("title", details.title()); 1743 dict->SetString("title", details.title());
1743 dict->SetString("type", FileKindToString(details.file_kind())); 1744 dict->SetString("type", FileKindToString(details.file_kind()));
1744 dict->SetString("md5", details.md5()); 1745 dict->SetString("md5", details.md5());
1745 dict->SetString("etag", details.etag()); 1746 dict->SetString("etag", details.etag());
1746 dict->SetString("missing", details.missing() ? "true" : "false"); 1747 dict->SetString("missing", details.missing() ? "true" : "false");
1747 dict->SetString("change_id", base::Int64ToString(details.change_id())); 1748 dict->SetString("change_id", base::Int64ToString(details.change_id()));
1748 1749
1749 std::vector<std::string> parents; 1750 std::vector<base::StringPiece> parents;
1750 for (int i = 0; i < details.parent_folder_ids_size(); ++i) 1751 for (int i = 0; i < details.parent_folder_ids_size(); ++i)
1751 parents.push_back(details.parent_folder_ids(i)); 1752 parents.push_back(details.parent_folder_ids(i));
1752 dict->SetString("parents", base::JoinString(parents, ",")); 1753 dict->SetString("parents", base::JoinString(parents, ","));
1753 } 1754 }
1754 files->Append(std::move(dict)); 1755 files->Append(std::move(dict));
1755 } 1756 }
1756 return files; 1757 return files;
1757 } 1758 }
1758 1759
1759 void MetadataDatabase::AttachSyncRoot( 1760 void MetadataDatabase::AttachSyncRoot(
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
1805 return false; 1806 return false;
1806 1807
1807 if (!parents.empty()) 1808 if (!parents.empty())
1808 return false; 1809 return false;
1809 1810
1810 return true; 1811 return true;
1811 } 1812 }
1812 1813
1813 } // namespace drive_backend 1814 } // namespace drive_backend
1814 } // namespace sync_file_system 1815 } // namespace sync_file_system
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698