[GN] Prefer explicit pool to automatic link_pool for link targets.

In preparation of refactoring the concurrent_links code to use
explicit pools, prefer to use an explicit pool if defined over
the automatic link_pool for link targets.

BUG=612786

Review-Url: https://codereview.chromium.org/2182093002
Cr-Original-Commit-Position: refs/heads/master@{#408077}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 1c27131e1bf77b059ef4c4f444bdccecdddeb0f6
diff --git a/tools/gn/ninja_toolchain_writer.cc b/tools/gn/ninja_toolchain_writer.cc
index 40653a8..27e2e0c 100644
--- a/tools/gn/ninja_toolchain_writer.cc
+++ b/tools/gn/ninja_toolchain_writer.cc
@@ -105,16 +105,17 @@
     out_ << kIndent << "deps = msvc" << std::endl;
   }
 
-  // The link pool applies to linker tools. Don't count TYPE_ALINK since
-  // static libraries are not generally intensive to write.
-  if (type == Toolchain::TYPE_SOLINK ||
-      type == Toolchain::TYPE_SOLINK_MODULE ||
-      type == Toolchain::TYPE_LINK) {
-    out_ << kIndent << "pool = link_pool\n";
-  } else if (tool->pool().ptr) {
+  // Use pool is specified.
+  if (tool->pool().ptr) {
     std::string pool_name =
         tool->pool().ptr->GetNinjaName(settings_->default_toolchain_label());
     out_ << kIndent << "pool = " << pool_name << std::endl;
+  } else if (type == Toolchain::TYPE_SOLINK ||
+      type == Toolchain::TYPE_SOLINK_MODULE ||
+      type == Toolchain::TYPE_LINK) {
+    // The link pool applies to linker tools. Don't count TYPE_ALINK since
+    // static libraries are not generally intensive to write.
+    out_ << kIndent << "pool = link_pool\n";
   }
 
   if (tool->restat())