Re-sort GYP files with the latest version of tools/source_list.py

In crrev.com/316164, a bug was fixed to handle comments in
a source list correctly.

In this patch, a bug was fixed to handle comments at the
end of a source list.

Along the way, sort some GYP files in sub directories under
base and net, which I forgot to sort previously.

BUG=456014
TEST=everything should build as before

Review URL: https://codereview.chromium.org/924743002

Cr-Commit-Position: refs/heads/master@{#316418}
diff --git a/tools/sort_sources.py b/tools/sort_sources.py
index 60d38810..63f1afd 100755
--- a/tools/sort_sources.py
+++ b/tools/sort_sources.py
@@ -49,14 +49,16 @@
       sources.append([line, comments])
       comments = []
     else:
-      if comments:
-        output_lines.extend(comments)
-        comments = []
+      # |sources| should be flushed first, to handle comments at the end of a
+      # source list correctly.
       if sources:
         for source_line, source_comments in sorted(sources):
           output_lines.extend(source_comments)
           output_lines.append(source_line)
         sources = []
+      if comments:
+        output_lines.extend(comments)
+        comments = []
       output_lines.append(line)
   return output_lines