Explicitly filter assigments to sources variable

set_sources_assignment_filter() is considered as a mis-feature
of gn (as it makes it difficult to reason about the BUILD.gn
files individually).

Change BUILD.gn in pdfium to check the platform before adding
plaform-specific source files to "sources" variable. This will
allow removing the global sources assignment filter from the
Chromium codebase.

Bug: chromium:1018739
Change-Id: I3f241ce9e8fabe2b6d4aa69ae9c74e51ce0ee8db
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/74010
Auto-Submit: Sylvain Defresne <sdefresne@chromium.org>
Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
Reviewed-by: Nicolás Peña Moreno <npm@chromium.org>
diff --git a/third_party/BUILD.gn b/third_party/BUILD.gn
index 8e1532c..5982217 100644
--- a/third_party/BUILD.gn
+++ b/third_party/BUILD.gn
@@ -570,8 +570,6 @@
     "base/allocator/partition_allocator/page_allocator.h",
     "base/allocator/partition_allocator/page_allocator_constants.h",
     "base/allocator/partition_allocator/page_allocator_internal.h",
-    "base/allocator/partition_allocator/page_allocator_internals_posix.h",
-    "base/allocator/partition_allocator/page_allocator_internals_win.h",
     "base/allocator/partition_allocator/partition_alloc.cc",
     "base/allocator/partition_allocator/partition_alloc.h",
     "base/allocator/partition_allocator/partition_alloc_constants.h",
@@ -621,10 +619,17 @@
 
   if (is_win) {
     sources += [
+      "base/allocator/partition_allocator/page_allocator_internals_win.h",
       "base/win/win_util.cc",
       "base/win/win_util.h",
     ]
   }
+
+  if (is_posix) {
+    sources += [
+      "base/allocator/partition_allocator/page_allocator_internals_posix.h",
+    ]
+  }
 }
 
 source_set("pdfium_base_test_support") {