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

Unified Diff: chrome/browser/chromeos/file_system_provider/registry.cc

Issue 829553002: [fsp] Add throttling for number of opened files. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/file_system_provider/registry.cc
diff --git a/chrome/browser/chromeos/file_system_provider/registry.cc b/chrome/browser/chromeos/file_system_provider/registry.cc
index a6272d182ee7cd63948a8d940bde7d65bdac8657..c0bf95d30f7af5fb9f4d4503476064269aa826fd 100644
--- a/chrome/browser/chromeos/file_system_provider/registry.cc
+++ b/chrome/browser/chromeos/file_system_provider/registry.cc
@@ -32,6 +32,7 @@ const char kPrefKeyWatcherEntryPath[] = "entry-path";
const char kPrefKeyWatcherRecursive[] = "recursive";
const char kPrefKeyWatcherLastTag[] = "last-tag";
const char kPrefKeyWatcherPersistentOrigins[] = "persistent-origins";
+const char kPrefKeyOpenedFilesLimit[] = "opened-files-limit";
void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) {
registry->RegisterDictionaryPref(
@@ -57,6 +58,8 @@ void Registry::RememberFileSystem(
file_system_info.writable());
file_system->SetBooleanWithoutPathExpansion(
kPrefKeySupportsNotifyTag, file_system_info.supports_notify_tag());
+ file_system->SetIntegerWithoutPathExpansion(
+ kPrefKeyOpenedFilesLimit, file_system_info.opened_files_limit());
base::DictionaryValue* const watchers_value = new base::DictionaryValue();
file_system->SetWithoutPathExpansion(kPrefKeyWatchers, watchers_value);
@@ -149,17 +152,23 @@ scoped_ptr<Registry::RestoredFileSystems> Registry::RestoreFileSystems(
std::string display_name;
bool writable = false;
bool supports_notify_tag = false;
-
- if (!file_system_value->GetAsDictionary(&file_system) ||
- !file_system->GetStringWithoutPathExpansion(kPrefKeyFileSystemId,
- &file_system_id) ||
- !file_system->GetStringWithoutPathExpansion(kPrefKeyDisplayName,
- &display_name) ||
- !file_system->GetBooleanWithoutPathExpansion(kPrefKeyWritable,
- &writable) ||
- !file_system->GetBooleanWithoutPathExpansion(kPrefKeySupportsNotifyTag,
- &supports_notify_tag) ||
- file_system_id.empty() || display_name.empty()) {
+ int opened_files_limit = 0;
+
+ // TODO(mtomasz): Move opened files limit to the mandatory list above in
+ // M42.
+ if ((!file_system_value->GetAsDictionary(&file_system) ||
+ !file_system->GetStringWithoutPathExpansion(kPrefKeyFileSystemId,
+ &file_system_id) ||
+ !file_system->GetStringWithoutPathExpansion(kPrefKeyDisplayName,
+ &display_name) ||
+ !file_system->GetBooleanWithoutPathExpansion(kPrefKeyWritable,
+ &writable) ||
+ !file_system->GetBooleanWithoutPathExpansion(kPrefKeySupportsNotifyTag,
+ &supports_notify_tag) ||
+ file_system_id.empty() || display_name.empty()) ||
+ (file_system->GetIntegerWithoutPathExpansion(kPrefKeyOpenedFilesLimit,
+ &opened_files_limit) &&
+ opened_files_limit < 0)) {
LOG(ERROR)
<< "Malformed provided file system information in preferences.";
continue;
@@ -170,6 +179,7 @@ scoped_ptr<Registry::RestoredFileSystems> Registry::RestoreFileSystems(
options.display_name = display_name;
options.writable = writable;
options.supports_notify_tag = supports_notify_tag;
+ options.opened_files_limit = opened_files_limit;
RestoredFileSystem restored_file_system;
restored_file_system.extension_id = extension_id;

Powered by Google App Engine
This is Rietveld 408576698