Commit 481a6100 authored by Andrey Lushnikov's avatar Andrey Lushnikov Committed by Commit Bot

DevTools: dispatch 1000 files in a time for files changed event

This way we avoid the limitation on maximum IPC message size.

BUG=797817
R=dgozman

Change-Id: Ic4065d4b5b7b957effeb10f72b432320cd977be7
Reviewed-on: https://chromium-review.googlesource.com/1152240
Commit-Queue: Andrey Lushnikov <lushnikov@chromium.org>
Reviewed-by: default avatarDmitry Gozman <dgozman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#578485}
parent 67d115ae
......@@ -1255,13 +1255,32 @@ void DevToolsUIBindings::FilePathsChanged(
const std::vector<std::string>& changed_paths,
const std::vector<std::string>& added_paths,
const std::vector<std::string>& removed_paths) {
base::ListValue changed, added, removed;
changed.AppendStrings(changed_paths);
added.AppendStrings(added_paths);
removed.AppendStrings(removed_paths);
CallClientFunction("DevToolsAPI.fileSystemFilesChangedAddedRemoved", &changed,
&added, &removed);
const int kMaxPathsPerMessage = 1000;
size_t changed_index = 0;
size_t added_index = 0;
size_t removed_index = 0;
// Dispatch limited amount of file paths in a time to avoid
// IPC max message size limit. See https://crbug.com/797817.
while (changed_index < changed_paths.size() ||
added_index < added_paths.size() ||
removed_index < removed_paths.size()) {
int budget = kMaxPathsPerMessage;
base::ListValue changed, added, removed;
while (budget > 0 && changed_index < changed_paths.size()) {
changed.AppendString(changed_paths[changed_index++]);
--budget;
}
while (budget > 0 && added_index < added_paths.size()) {
added.AppendString(added_paths[added_index++]);
--budget;
}
while (budget > 0 && removed_index < removed_paths.size()) {
removed.AppendString(removed_paths[removed_index++]);
--budget;
}
CallClientFunction("DevToolsAPI.fileSystemFilesChangedAddedRemoved",
&changed, &added, &removed);
}
}
void DevToolsUIBindings::IndexingTotalWorkCalculated(
......
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