Update libperfetto to directly dep on the ipc target on posix systems.

see http://crbug/1007310, some changes are needed to make libperfetto
the single source set for all perfetto code.

Also some functions were not properly exported which didn't matter on
Android, but does on other systems.

Change-Id: I65e0a0b583da218b811bfe37e4273b241c5f435c
diff --git a/BUILD.gn b/BUILD.gn
index c603a03..69bbd54 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -242,6 +242,10 @@
       "protos/perfetto/trace/profiling:zero",
       "protos/perfetto/trace/track_event:zero",
     ]
+    if (enable_perfetto_ipc) {
+      deps += [ "src/tracing:ipc" ]
+      public_deps += [ "include/perfetto/ext/tracing/ipc:ipc" ]
+    }
   }
   component("libtrace_processor") {
     public_configs = [ "gn:public_config" ]
diff --git a/gn/perfetto.gni b/gn/perfetto.gni
index 57c27aa..3d756d0 100644
--- a/gn/perfetto.gni
+++ b/gn/perfetto.gni
@@ -135,7 +135,7 @@
   # system backend in the client library.
   # This includes building things that rely on POSIX sockets, this places
   # limitations on the supported operating systems.
-  enable_perfetto_ipc = (is_android || is_linux || is_mac) &&
+  enable_perfetto_ipc = !is_win && !is_fuchsia &&
                         (perfetto_build_standalone ||
                          perfetto_build_with_android || build_with_chromium)
 
diff --git a/include/perfetto/ext/tracing/ipc/default_socket.h b/include/perfetto/ext/tracing/ipc/default_socket.h
index 85a1de0..6f1fafb 100644
--- a/include/perfetto/ext/tracing/ipc/default_socket.h
+++ b/include/perfetto/ext/tracing/ipc/default_socket.h
@@ -17,10 +17,12 @@
 #ifndef INCLUDE_PERFETTO_EXT_TRACING_IPC_DEFAULT_SOCKET_H_
 #define INCLUDE_PERFETTO_EXT_TRACING_IPC_DEFAULT_SOCKET_H_
 
+#include "perfetto/base/export.h"
+
 namespace perfetto {
 
-const char* GetConsumerSocket();
-const char* GetProducerSocket();
+PERFETTO_EXPORT const char* GetConsumerSocket();
+PERFETTO_EXPORT const char* GetProducerSocket();
 
 }  // namespace perfetto
 
diff --git a/include/perfetto/ext/tracing/ipc/producer_ipc_client.h b/include/perfetto/ext/tracing/ipc/producer_ipc_client.h
index e6092e8..71b2431 100644
--- a/include/perfetto/ext/tracing/ipc/producer_ipc_client.h
+++ b/include/perfetto/ext/tracing/ipc/producer_ipc_client.h
@@ -20,6 +20,7 @@
 #include <memory>
 #include <string>
 
+#include "perfetto/base/export.h"
 #include "perfetto/ext/tracing/core/tracing_service.h"
 
 namespace perfetto {
@@ -41,15 +42,15 @@
   // callbacks invoked on the Producer interface: no more Producer callbacks are
   // invoked immediately after its destruction and any pending callback will be
   // dropped.
-  static std::unique_ptr<TracingService::ProducerEndpoint> Connect(
-      const char* service_sock_name,
-      Producer*,
-      const std::string& producer_name,
-      base::TaskRunner*,
-      TracingService::ProducerSMBScrapingMode smb_scraping_mode =
-          TracingService::ProducerSMBScrapingMode::kDefault,
-      size_t shared_memory_size_hint_bytes = 0,
-      size_t shared_memory_page_size_hint_bytes = 0);
+  PERFETTO_EXPORT static std::unique_ptr<TracingService::ProducerEndpoint>
+  Connect(const char* service_sock_name,
+          Producer*,
+          const std::string& producer_name,
+          base::TaskRunner*,
+          TracingService::ProducerSMBScrapingMode smb_scraping_mode =
+              TracingService::ProducerSMBScrapingMode::kDefault,
+          size_t shared_memory_size_hint_bytes = 0,
+          size_t shared_memory_page_size_hint_bytes = 0);
 
  protected:
   ProducerIPCClient() = delete;