GN: Update webrtc/base to recent GYP changes.

Update the webrtc/base/BUILD.gn file to reflect
webrtc/base/base.gyp changes between r6438 and r7011.

BUG=3441
TESTED= Trybots + compilation with a standalone WebRTC checkout:
gn gen out/Default --args="build_with_chromium=false" && ninja -C out/Default
gn gen out/Default --args="build_with_chromium=false is_debug=true" && ninja -C out/Default
gn gen out/Default --args="build_with_chromium=false os=\"android\" cpu_arch=\"arm\" is_clang=false" && ninja -C out/Default
gn gen out/Default --args="build_with_chromium=false os=\"android\" cpu_arch=\"arm\" arm_version=7 is_clang=false" && ninja -C out/Default

Compilation of Chromium's 'all' target with src/third_party/webrtc
symlinked to the WebRTC checkout with this CL applied, both
with the default GN settings and using
--args="is_debug=false os=\"android\" cpu_arch=\"arm\""

R=brettw@chromium.org

Review URL: https://webrtc-codereview.appspot.com/13359004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@7022 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/webrtc/base/BUILD.gn b/webrtc/base/BUILD.gn
index fbf29e8..b0da45a 100644
--- a/webrtc/base/BUILD.gn
+++ b/webrtc/base/BUILD.gn
@@ -6,8 +6,6 @@
 # in the file PATENTS.  All contributing project authors may
 # be found in the AUTHORS file in the root of the source tree.
 
-# TODO(kjellander): Rebase this to base.gyp changes after r6438.
-
 import("//build/config/crypto.gni")
 import("//build/config/ui.gni")
 import("../build/webrtc.gni")
@@ -20,7 +18,8 @@
 
   defines = [
     "FEATURE_ENABLE_SSL",
-    "GTEST_RELATIVE_PATH",
+    "LOGGING=1",
+    "USE_WEBRTC_DEV_BRANCH",
   ]
 
   # TODO(henrike): issue 3307, make webrtc_base build without disabling
@@ -103,10 +102,18 @@
   }
 }
 
+if (build_ssl == 0) {
+  config("external_ssl_library") {
+    assert(webrtc_ssl_root != "",
+           "You must specify webrtc_ssl_root when build_ssl==0.")
+    include_dirs = [ webrtc_ssl_root ]
+  }
+}
 
 static_library("webrtc_base") {
   cflags = []
   cflags_cc = []
+  libs = []
   deps= []
 
   configs += [
@@ -264,6 +271,9 @@
     "taskrunner.h",
     "thread.cc",
     "thread.h",
+    "thread_checker.h",
+    "thread_checker_impl.cc",
+    "thread_checker_impl.h",
     "timeutils.cc",
     "timeutils.h",
     "timing.cc",
@@ -315,6 +325,8 @@
       "callback.h",
       "callback.h.pump",
       "constructormagic.h",
+      "exp_filter.cc",
+      "exp_filter.h",
       "filelock.cc",
       "filelock.h",
       "fileutils_mock.h",
@@ -388,13 +400,6 @@
       ]
     }
 
-    if (use_x11) {
-      sources += [
-        "x11windowpicker.cc",
-        "x11windowpicker.h",
-      ]
-    }
-
     if (is_mac) {
       sources += [
         "macasyncsocket.cc",
@@ -420,12 +425,19 @@
         "win32socketserver.h",
       ]
     }
+    if (build_json) {
+      deps += [ "//third_party/jsoncpp" ]
+    } else {
+      include_dirs += [ webrtc_jsoncpp_root ]
 
-    deps += [ "//third_party/jsoncpp" ]
+      # When defined changes the include path for json.h to where it is
+      # expected to be when building json outside of the standalone build.
+      defines += [ "WEBRTC_EXTERNAL_JSON" ]
+    }
   }  # !build_with_chromium
 
   if (is_clang) {
-    # Suppress warnings from Chrome's Clang plugins.
+    # Suppress warnings from the Chrome Clang plugins.
     # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
     configs -= [ "//build/config/clang:find_bad_constructs" ]
   }
@@ -439,8 +451,11 @@
 
   if (use_openssl) {
     direct_dependent_configs += [ ":openssl_config" ]
-
-    deps += [ "//third_party/boringssl" ]
+    if (build_ssl) {
+      deps += [ "//third_party/boringssl" ]
+    } else {
+      configs += [ "external_ssl_library" ]
+    }
   } else {
     direct_dependent_configs += [ ":no_openssl_config" ]
   }
@@ -453,7 +468,7 @@
 
     direct_dependent_configs += [ ":android_config" ]
 
-    libs = [
+    libs += [
       "log",
       "GLESv2"
     ]
@@ -464,12 +479,19 @@
   if (is_ios) {
     all_dependent_configs += [ ":ios_config" ]
 
-    deps += [ "//net/third_party/nss/ssl:libssl" ]
+    if (build_ssl) {
+      deps += [ "//net/third_party/nss/ssl:libssl" ]
+    } else {
+      configs += [ "external_ssl_library" ]
+    }
   }
 
-  if (is_linux) {
-    libs = [
-      "crypto",
+  if (use_x11) {
+    sources += [
+      "x11windowpicker.cc",
+      "x11windowpicker.h",
+    ]
+    libs += [
       "dl",
       "rt",
       "Xext",
@@ -477,7 +499,17 @@
       "Xcomposite",
       "Xrender",
     ]
-    configs += [ "//third_party/nss:system_nss_no_ssl_config" ]
+  }
+
+  if (is_linux) {
+    libs += [
+      "crypto",
+      "dl",
+      "rt",
+    ]
+    if (build_ssl) {
+      configs += [ "//third_party/nss:system_nss_no_ssl_config" ]
+    }
   }
 
   if (is_mac) {
@@ -492,7 +524,7 @@
 
     all_dependent_configs = [ ":mac_config" ]
 
-    libs = [
+    libs += [
       "crypto",  # $(SDKROOT)/usr/lib/libcrypto.dylib
       "ssl",  # $(SDKROOT)/usr/lib/libssl.dylib
     ]
@@ -520,7 +552,7 @@
       "winping.h",
     ]
 
-    libs = [
+    libs += [
       "crypt32.lib",
       "iphlpapi.lib",
       "secur32.lib",
@@ -536,7 +568,7 @@
   }
 
   if (is_posix && is_debug) {
-    # Chromium's build/common.gypi defines this for all posix
+    # The Chromium build/common.gypi defines this for all posix
     # _except_ for ios & mac.  We want it there as well, e.g.
     # because ASSERT and friends trigger off of it.
     defines += [ "_DEBUG" ]
@@ -546,7 +578,7 @@
     defines += [ "CARBON_DEPRECATED=YES" ]
   }
 
-  if (!is_ios && is_posix) {
+  if (!is_ios) {
     sources += [
       "openssl.h",
       "openssladapter.cc",
@@ -568,18 +600,26 @@
   }
 
   if (is_mac || is_ios || is_win) {
-    deps += [
-      "//net/third_party/nss/ssl:libssl",
-      "//third_party/nss:nspr",
-      "//third_party/nss:nss",
-    ]
+    if (build_ssl) {
+      deps += [
+        "//net/third_party/nss/ssl:libssl",
+        "//third_party/nss:nspr",
+        "//third_party/nss:nss",
+      ]
+    } else {
+      configs += [ "external_ssl_library" ]
+    }
   }
 
   if (is_posix && !is_mac && !is_ios && !is_android) {
     if (build_with_chromium) {
       deps += [ "//crypto:platform" ]
     } else {
-      deps += [ ":linux_system_ssl" ]
+      if (build_ssl) {
+        deps += [ ":linux_system_ssl" ]
+      } else {
+        configs += [ "external_ssl_library" ]
+      }
     }
   }
 }
diff --git a/webrtc/build/webrtc.gni b/webrtc/build/webrtc.gni
index cae8166..346a062 100644
--- a/webrtc/build/webrtc.gni
+++ b/webrtc/build/webrtc.gni
@@ -17,6 +17,14 @@
   # Disable this to avoid building the Opus audio codec.
   include_opus = true
 
+  # Used to specify an external Jsoncpp include path when not compiling the
+  # library that comes with WebRTC (i.e. build_json == 0).
+  webrtc_jsoncpp_root = "//third_party/jsoncpp/source/include"
+
+  # Used to specify an external OpenSSL include path when not compiling the
+  # library that comes with WebRTC (i.e. build_ssl == 0).
+  webrtc_ssl_root = ""
+
   # Adds video support to dependencies shared by voice and video engine.
   # This should normally be enabled; the intended use is to disable only
   # when building voice engine exclusively.