Commit 9df3e69a authored by satorux@chromium.org's avatar satorux@chromium.org

gdata: Make RemoveEntry/TakeEntry/TakeOverEntries private

We'll need to get rid of them, but for now, just make them private.

BUG=137725
TEST=none

Review URL: https://chromiumcodereview.appspot.com/10834093

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@149277 0039d316-1c4b-4281-b951-d872f2087c98
parent 3895dfe2
...@@ -404,20 +404,6 @@ void RunTaskOnThread(scoped_refptr<base::MessageLoopProxy> relay_proxy, ...@@ -404,20 +404,6 @@ void RunTaskOnThread(scoped_refptr<base::MessageLoopProxy> relay_proxy,
} }
} }
// Callback for GetEntryByResourceIdAsync.
// Removes stale entry upon upload of file.
void RemoveStaleEntryOnUpload(const std::string& resource_id,
GDataDirectory* parent_dir,
GDataEntry* existing_entry) {
if (existing_entry &&
// This should always match, but just in case.
existing_entry->parent() == parent_dir) {
parent_dir->RemoveEntry(existing_entry);
} else {
LOG(ERROR) << "Entry for the existing file not found: " << resource_id;
}
}
// Callback for GetEntryByResourceIdAsync. // Callback for GetEntryByResourceIdAsync.
// Adds |entry| to |results|. Runs |callback| with |results| when // Adds |entry| to |results|. Runs |callback| with |results| when
// |run_callback| is true. // |run_callback| is true.
...@@ -3451,11 +3437,6 @@ void GDataFileSystem::ApplyFeedFromFileUrlMap( ...@@ -3451,11 +3437,6 @@ void GDataFileSystem::ApplyFeedFromFileUrlMap(
} }
} }
// Helper function for adding new |file| from the feed into |directory|. It
// checks the type of file and updates |changed_dirs| if this file adding
// operation needs to raise directory notification update. If file is being
// added to |orphaned_dir_service| such notifications are not raised since
// we ignore such files and don't add them to the file system now.
// static // static
void GDataFileSystem::AddEntryToDirectoryAndCollectChangedDirectories( void GDataFileSystem::AddEntryToDirectoryAndCollectChangedDirectories(
GDataEntry* entry, GDataEntry* entry,
...@@ -3467,9 +3448,6 @@ void GDataFileSystem::AddEntryToDirectoryAndCollectChangedDirectories( ...@@ -3467,9 +3448,6 @@ void GDataFileSystem::AddEntryToDirectoryAndCollectChangedDirectories(
changed_dirs->insert(entry->GetFilePath()); changed_dirs->insert(entry->GetFilePath());
} }
// Helper function for removing |entry| from |directory|. If |entry| is a
// directory too, it will collect all its children file paths into
// |changed_dirs| as well.
// static // static
void GDataFileSystem::RemoveEntryFromDirectoryAndCollectChangedDirectories( void GDataFileSystem::RemoveEntryFromDirectoryAndCollectChangedDirectories(
GDataDirectory* directory, GDataDirectory* directory,
...@@ -3481,6 +3459,19 @@ void GDataFileSystem::RemoveEntryFromDirectoryAndCollectChangedDirectories( ...@@ -3481,6 +3459,19 @@ void GDataFileSystem::RemoveEntryFromDirectoryAndCollectChangedDirectories(
directory->RemoveEntry(entry); directory->RemoveEntry(entry);
} }
// static
void GDataFileSystem::RemoveStaleEntryOnUpload(const std::string& resource_id,
GDataDirectory* parent_dir,
GDataEntry* existing_entry) {
if (existing_entry &&
// This should always match, but just in case.
existing_entry->parent() == parent_dir) {
parent_dir->RemoveEntry(existing_entry);
} else {
LOG(ERROR) << "Entry for the existing file not found: " << resource_id;
}
}
GDataDirectory* GDataFileSystem::FindDirectoryForNewEntry( GDataDirectory* GDataFileSystem::FindDirectoryForNewEntry(
GDataEntry* new_entry, GDataEntry* new_entry,
const FileResourceIdMap& file_map, const FileResourceIdMap& file_map,
......
...@@ -557,6 +557,12 @@ class GDataFileSystem : public GDataFileSystemInterface, ...@@ -557,6 +557,12 @@ class GDataFileSystem : public GDataFileSystemInterface,
GDataEntry* entry, GDataEntry* entry,
std::set<FilePath>* changed_dirs); std::set<FilePath>* changed_dirs);
// Callback for GetEntryByResourceIdAsync.
// Removes stale entry upon upload of file.
static void RemoveStaleEntryOnUpload(const std::string& resource_id,
GDataDirectory* parent_dir,
GDataEntry* existing_entry);
// Finds directory where new |file| should be added to during feed processing. // Finds directory where new |file| should be added to during feed processing.
// |orphaned_entries_dir| collects files/dirs that don't have a parent in // |orphaned_entries_dir| collects files/dirs that don't have a parent in
// either locally cached file system or in this new feed. // either locally cached file system or in this new feed.
......
...@@ -279,18 +279,6 @@ class GDataDirectory : public GDataEntry { ...@@ -279,18 +279,6 @@ class GDataDirectory : public GDataEntry {
bool FromProto(const GDataDirectoryProto& proto) WARN_UNUSED_RESULT; bool FromProto(const GDataDirectoryProto& proto) WARN_UNUSED_RESULT;
void ToProto(GDataDirectoryProto* proto) const; void ToProto(GDataDirectoryProto* proto) const;
// Takes the ownership of |entry| from its current parent. If this directory
// is already the current parent of |file|, this method effectively goes
// through the name de-duplication for |file| based on the current state of
// the file system.
bool TakeEntry(GDataEntry* entry);
// Takes over all entries from |dir|.
bool TakeOverEntries(GDataDirectory* dir);
// Removes the entry from its children list and destroys the entry instance.
bool RemoveEntry(GDataEntry* entry);
// Removes child elements. // Removes child elements.
void RemoveChildren(); void RemoveChildren();
void RemoveChildFiles(); void RemoveChildFiles();
...@@ -314,6 +302,21 @@ class GDataDirectory : public GDataEntry { ...@@ -314,6 +302,21 @@ class GDataDirectory : public GDataEntry {
// TODO(satorux): Remove this. crbug.com/139649 // TODO(satorux): Remove this. crbug.com/139649
void AddEntry(GDataEntry* entry); void AddEntry(GDataEntry* entry);
// Removes the entry from its children list and destroys the entry instance.
// TODO(satorux): Remove this. crbug.com/139649
bool RemoveEntry(GDataEntry* entry);
// Takes the ownership of |entry| from its current parent. If this directory
// is already the current parent of |file|, this method effectively goes
// through the name de-duplication for |file| based on the current state of
// the file system.
// TODO(satorux): Remove this. crbug.com/139649
bool TakeEntry(GDataEntry* entry);
// Takes over all entries from |dir|.
// TODO(satorux): Remove this. crbug.com/139649
bool TakeOverEntries(GDataDirectory* dir);
// Find a child by its name. // Find a child by its name.
// TODO(satorux): Remove this. crbug.com/139649 // TODO(satorux): Remove this. crbug.com/139649
GDataEntry* FindChild(const FilePath::StringType& file_name) const; GDataEntry* FindChild(const FilePath::StringType& file_name) const;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment