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

Side by Side Diff: chrome/browser/sync_file_system/local/local_file_sync_status.cc

Issue 442383002: Move storage-related files from webkit/ to new top-level directory storage/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 4 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 | Annotate | Revision Log
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/local/local_file_sync_status.h" 5 #include "chrome/browser/sync_file_system/local/local_file_sync_status.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "webkit/common/fileapi/file_system_util.h" 9 #include "storage/common/fileapi/file_system_util.h"
10 10
11 using fileapi::FileSystemURL; 11 using storage::FileSystemURL;
12 using fileapi::FileSystemURLSet; 12 using storage::FileSystemURLSet;
13 13
14 namespace sync_file_system { 14 namespace sync_file_system {
15 15
16 namespace { 16 namespace {
17 17
18 typedef LocalFileSyncStatus::OriginAndType OriginAndType; 18 typedef LocalFileSyncStatus::OriginAndType OriginAndType;
19 19
20 OriginAndType GetOriginAndType(const fileapi::FileSystemURL& url) { 20 OriginAndType GetOriginAndType(const storage::FileSystemURL& url) {
21 return std::make_pair(url.origin(), url.type()); 21 return std::make_pair(url.origin(), url.type());
22 } 22 }
23 23
24 base::FilePath NormalizePath(const base::FilePath& path) { 24 base::FilePath NormalizePath(const base::FilePath& path) {
25 // Ensure |path| has single trailing path-separator, so that we can use 25 // Ensure |path| has single trailing path-separator, so that we can use
26 // prefix-match to find descendants of |path| in an ordered container. 26 // prefix-match to find descendants of |path| in an ordered container.
27 return base::FilePath(path.StripTrailingSeparators().value() + 27 return base::FilePath(path.StripTrailingSeparators().value() +
28 fileapi::VirtualPath::kSeparator); 28 storage::VirtualPath::kSeparator);
29 } 29 }
30 30
31 struct SetKeyHelper { 31 struct SetKeyHelper {
32 template <typename Iterator> 32 template <typename Iterator>
33 static const base::FilePath& GetKey(Iterator itr) { 33 static const base::FilePath& GetKey(Iterator itr) {
34 return *itr; 34 return *itr;
35 } 35 }
36 }; 36 };
37 37
38 struct MapKeyHelper { 38 struct MapKeyHelper {
(...skipping 17 matching lines...) Expand all
56 56
57 if (upper != paths.end() && 57 if (upper != paths.end() &&
58 normalized_path.IsParent(get_key_helper.GetKey(upper))) 58 normalized_path.IsParent(get_key_helper.GetKey(upper)))
59 return true; 59 return true;
60 60
61 // Check if any ancestor of |normalized_path| is in |writing_|. 61 // Check if any ancestor of |normalized_path| is in |writing_|.
62 while (true) { 62 while (true) {
63 if (ContainsKey(paths, normalized_path)) 63 if (ContainsKey(paths, normalized_path))
64 return true; 64 return true;
65 65
66 if (fileapi::VirtualPath::IsRootPath(normalized_path)) 66 if (storage::VirtualPath::IsRootPath(normalized_path))
67 return false; 67 return false;
68 68
69 normalized_path = 69 normalized_path =
70 NormalizePath(fileapi::VirtualPath::DirName(normalized_path)); 70 NormalizePath(storage::VirtualPath::DirName(normalized_path));
71 } 71 }
72 } 72 }
73 73
74 } // namespace 74 } // namespace
75 75
76 LocalFileSyncStatus::LocalFileSyncStatus() {} 76 LocalFileSyncStatus::LocalFileSyncStatus() {}
77 77
78 LocalFileSyncStatus::~LocalFileSyncStatus() {} 78 LocalFileSyncStatus::~LocalFileSyncStatus() {}
79 79
80 void LocalFileSyncStatus::StartWriting(const FileSystemURL& url) { 80 void LocalFileSyncStatus::StartWriting(const FileSystemURL& url) {
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 const FileSystemURL& url) const { 156 const FileSystemURL& url) const {
157 DCHECK(CalledOnValidThread()); 157 DCHECK(CalledOnValidThread());
158 URLSet::const_iterator found = syncing_.find(GetOriginAndType(url)); 158 URLSet::const_iterator found = syncing_.find(GetOriginAndType(url));
159 if (found == syncing_.end()) 159 if (found == syncing_.end())
160 return false; 160 return false;
161 return ContainsChildOrParent(found->second, url.path(), 161 return ContainsChildOrParent(found->second, url.path(),
162 SetKeyHelper()); 162 SetKeyHelper());
163 } 163 }
164 164
165 } // namespace sync_file_system 165 } // namespace sync_file_system
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698