diff options
author | satorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-08 00:15:11 +0000 |
---|---|---|
committer | satorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-08 00:15:11 +0000 |
commit | 72384daa1b268e8132e323a1cf01c05b5e57c96b (patch) | |
tree | 3c58580661fe78e8b60f71e527a864664e724a73 | |
parent | a352869a59d48c3bd3a4a453d73c3392255275ef (diff) | |
download | chromium_src-72384daa1b268e8132e323a1cf01c05b5e57c96b.zip chromium_src-72384daa1b268e8132e323a1cf01c05b5e57c96b.tar.gz chromium_src-72384daa1b268e8132e323a1cf01c05b5e57c96b.tar.bz2 |
gdata: Stop saving GCache/v1/meta/account_metadata.json
The file is saved but not used at all.
Remove LoadProtoOnIOThreadPool() which is no longer used,
and SaveFeed() which is no longer needed.
BUG=131674
TEST=confirm that account_metadata.json is no longer saved, but DEBUG_feed_0.json is still saved on Debug build.
Review URL: https://chromiumcodereview.appspot.com/10533052
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@141126 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/chromeos/gdata/gdata_file_system.cc | 72 | ||||
-rw-r--r-- | chrome/browser/chromeos/gdata/gdata_file_system.h | 5 | ||||
-rw-r--r-- | chrome/browser/chromeos/gdata/gdata_file_system_unittest.cc | 7 |
3 files changed, 8 insertions, 76 deletions
diff --git a/chrome/browser/chromeos/gdata/gdata_file_system.cc b/chrome/browser/chromeos/gdata/gdata_file_system.cc index 6bcab23..4bb652f 100644 --- a/chrome/browser/chromeos/gdata/gdata_file_system.cc +++ b/chrome/browser/chromeos/gdata/gdata_file_system.cc @@ -603,62 +603,15 @@ void LoadProtoOnBlockingPool(const FilePath& path, params->load_error = base::PLATFORM_FILE_OK; } -// Loads json file content content from |file_path| on blocking pool. -void LoadJsonFileOnBlockingPool( - const FilePath& file_path, - base::PlatformFileError* error, - base::Value* result) { - scoped_ptr<base::Value> root_value; - std::string contents; - if (!file_util::ReadFileToString(file_path, &contents)) { - *error = base::PLATFORM_FILE_ERROR_NOT_FOUND; - return; - } - - int unused_error_code = -1; - std::string unused_error_message; - root_value.reset(base::JSONReader::ReadAndReturnError( - contents, base::JSON_PARSE_RFC, &unused_error_code, - &unused_error_message)); - - bool has_root = root_value.get(); - if (!has_root) - LOG(WARNING) << "Cached content read failed for file " << file_path.value(); - - if (!has_root) { - *error = base::PLATFORM_FILE_ERROR_FAILED; - return; - } - - base::ListValue* result_list = NULL; - base::DictionaryValue* result_dict = NULL; - if (result->GetAsList(&result_list) && - root_value->GetType() == Value::TYPE_LIST) { - *error = base::PLATFORM_FILE_OK; - result_list->Swap(reinterpret_cast<base::ListValue*>(root_value.get())); - } else if (result->GetAsDictionary(&result_dict) && - root_value->GetType() == Value::TYPE_DICTIONARY) { - *error = base::PLATFORM_FILE_OK; - result_dict->Swap( - reinterpret_cast<base::DictionaryValue*>(root_value.get())); - } else { - *error = base::PLATFORM_FILE_ERROR_FAILED; - } -} - // Saves json file content content in |feed| to |file_pathname| on blocking -// pool. -void SaveFeedOnBlockingPool( +// pool. Used for debugging. +void SaveFeedOnBlockingPoolForDebugging( const FilePath& file_path, scoped_ptr<base::Value> feed) { std::string json; -#ifndef NDEBUG base::JSONWriter::WriteWithOptions(feed.get(), base::JSONWriter::OPTIONS_PRETTY_PRINT, &json); -#else - base::JSONWriter::Write(feed.get(), &json); -#endif int file_size = static_cast<int>(json.length()); if (file_util::WriteFile(file_path, json.data(), file_size) != file_size) { @@ -1259,8 +1212,6 @@ void GDataFileSystem::OnGetAccountMetadata( return; } - SaveFeed(feed_data.Pass(), FilePath(kAccountMetadataFile)); - // Load changes from the server. LoadFeedFromServer(initial_origin, local_changestamp > 0 ? local_changestamp + 1 : 0, @@ -2838,8 +2789,6 @@ void GDataFileSystem::OnGetAvailableSpace( return; } - SaveFeed(data.Pass(), FilePath(kAccountMetadataFile)); - callback.Run(base::PLATFORM_FILE_OK, feed->quota_bytes_total(), feed->quota_bytes_used()); @@ -3023,7 +2972,12 @@ void GDataFileSystem::OnGetDocuments(ContentOrigin initial_origin, std::string file_name = base::StringPrintf("DEBUG_feed_%d.json", params->start_changestamp); - SaveFeed(data.Pass(), FilePath(file_name)); + PostBlockingPoolSequencedTask( + FROM_HERE, + base::Bind(&SaveFeedOnBlockingPoolForDebugging, + GetCacheDirectoryPath( + GDataCache::CACHE_TYPE_META).Append(file_name), + base::Passed(&data))); #endif // Add the current feed to the list of collected feeds for this directory. @@ -3264,16 +3218,6 @@ void GDataFileSystem::OnRemoveEntryFromDirectoryCompleted( callback.Run(error, updated_file_path); } -void GDataFileSystem::SaveFeed(scoped_ptr<base::Value> feed, - const FilePath& name) { - PostBlockingPoolSequencedTask( - FROM_HERE, - base::Bind(&SaveFeedOnBlockingPool, - GetCacheDirectoryPath( - GDataCache::CACHE_TYPE_META).Append(name), - base::Passed(&feed))); -} - void GDataFileSystem::OnRemovedDocument( const FileOperationCallback& callback, const FilePath& file_path, diff --git a/chrome/browser/chromeos/gdata/gdata_file_system.h b/chrome/browser/chromeos/gdata/gdata_file_system.h index e55e2e8..a8f73b0 100644 --- a/chrome/browser/chromeos/gdata/gdata_file_system.h +++ b/chrome/browser/chromeos/gdata/gdata_file_system.h @@ -1046,11 +1046,6 @@ class GDataFileSystem : public GDataFileSystemInterface, // Save filesystem as proto file. void SaveFileSystemAsProto(); - // Saves a collected feed in GCache directory under - // <user_profile_dir>/GCache/v1/meta/|name| for later reloading when offline. - void SaveFeed(scoped_ptr<base::Value> feed_vector, - const FilePath& name); - // Notifies events to observers on UI thread. void NotifyCacheInitialized(); void NotifyFilePinned(const std::string& resource_id, diff --git a/chrome/browser/chromeos/gdata/gdata_file_system_unittest.cc b/chrome/browser/chromeos/gdata/gdata_file_system_unittest.cc index d3b498e..577493d 100644 --- a/chrome/browser/chromeos/gdata/gdata_file_system_unittest.cc +++ b/chrome/browser/chromeos/gdata/gdata_file_system_unittest.cc @@ -3688,13 +3688,6 @@ TEST_F(GDataFileSystemTest, GetAvailableSpace) { message_loop_.RunAllPending(); EXPECT_EQ(GG_LONGLONG(6789012345), callback_helper_->quota_bytes_used_); EXPECT_EQ(GG_LONGLONG(9876543210), callback_helper_->quota_bytes_total_); - - // Verify account meta feed is saved to cache. - RunAllPendingForIO(); - FilePath path = file_system_->cache_paths_[ - GDataCache::CACHE_TYPE_META].Append( - FILE_PATH_LITERAL("account_metadata.json")); - EXPECT_TRUE(file_util::PathExists(path)); } TEST_F(GDataFileSystemTest, MountUnmount) { |