Remove unused method, SetAffinity, from the ThreadWrapper class.
The method was also not consistently implemented across all platforms.

R=pbos@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#8212}
git-svn-id: http://webrtc.googlecode.com/svn/trunk@8212 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/webrtc/system_wrappers/interface/thread_wrapper.h b/webrtc/system_wrappers/interface/thread_wrapper.h
index 7fbf58c..c2c3431 100644
--- a/webrtc/system_wrappers/interface/thread_wrapper.h
+++ b/webrtc/system_wrappers/interface/thread_wrapper.h
@@ -72,14 +72,6 @@
   //                not.
   virtual bool Start(unsigned int& id) = 0;
 
-  // Sets the threads CPU affinity. CPUs are listed 0 - (number of CPUs - 1).
-  // The numbers in processor_numbers specify which CPUs are allowed to run the
-  // thread. processor_numbers should not contain any duplicates and elements
-  // should be lower than (number of CPUs - 1). amount_of_processors should be
-  // equal to the number of processors listed in processor_numbers.
-  virtual bool SetAffinity(const int* processor_numbers,
-                           const unsigned int amount_of_processors);
-
   // Stops the spawned thread and waits for it to be reclaimed with a timeout
   // of two seconds. Will return false if the thread was not reclaimed.
   // Multiple tries to Stop are allowed (e.g. to wait longer than 2 seconds).
diff --git a/webrtc/system_wrappers/source/thread.cc b/webrtc/system_wrappers/source/thread.cc
index b5ee7a5..6f023f8 100644
--- a/webrtc/system_wrappers/source/thread.cc
+++ b/webrtc/system_wrappers/source/thread.cc
@@ -28,9 +28,4 @@
 #endif
 }
 
-bool ThreadWrapper::SetAffinity(const int* processor_numbers,
-                                const unsigned int amount_of_processors) {
-  return false;
-}
-
 }  // namespace webrtc
diff --git a/webrtc/system_wrappers/source/thread_posix.cc b/webrtc/system_wrappers/source/thread_posix.cc
index f45c6e0..e7fe2fe 100644
--- a/webrtc/system_wrappers/source/thread_posix.cc
+++ b/webrtc/system_wrappers/source/thread_posix.cc
@@ -208,49 +208,6 @@
   return true;
 }
 
-// CPU_ZERO and CPU_SET are not available in NDK r7, so disable
-// SetAffinity on Android for now.
-#if (defined(WEBRTC_LINUX) && (!defined(WEBRTC_ANDROID)))
-bool ThreadPosix::SetAffinity(const int* processor_numbers,
-                              const unsigned int amount_of_processors) {
-  if (!processor_numbers || (amount_of_processors == 0)) {
-    return false;
-  }
-  cpu_set_t mask;
-  CPU_ZERO(&mask);
-
-  for (unsigned int processor = 0;
-       processor < amount_of_processors;
-       ++processor) {
-    CPU_SET(processor_numbers[processor], &mask);
-  }
-#if defined(WEBRTC_ANDROID)
-  // Android.
-  const int result = syscall(__NR_sched_setaffinity,
-                             pid_,
-                             sizeof(mask),
-                             &mask);
-#else
-  // "Normal" Linux.
-  const int result = sched_setaffinity(pid_,
-                                       sizeof(mask),
-                                       &mask);
-#endif
-  if (result != 0) {
-    return false;
-  }
-  return true;
-}
-
-#else
-// NOTE: On Mac OS X, use the Thread affinity API in
-// /usr/include/mach/thread_policy.h: thread_policy_set and mach_thread_self()
-// instead of Linux gettid() syscall.
-bool ThreadPosix::SetAffinity(const int* , const unsigned int) {
-  return false;
-}
-#endif
-
 void ThreadPosix::SetNotAlive() {
   CriticalSectionScoped cs(crit_state_);
   alive_ = false;
diff --git a/webrtc/system_wrappers/source/thread_posix.h b/webrtc/system_wrappers/source/thread_posix.h
index c2025fd..65e6da8 100644
--- a/webrtc/system_wrappers/source/thread_posix.h
+++ b/webrtc/system_wrappers/source/thread_posix.h
@@ -35,9 +35,6 @@
   // From ThreadWrapper.
   virtual void SetNotAlive() OVERRIDE;
   virtual bool Start(unsigned int& id) OVERRIDE;
-  // Not implemented on Mac.
-  virtual bool SetAffinity(const int* processor_numbers,
-                           unsigned int amount_of_processors) OVERRIDE;
   virtual bool Stop() OVERRIDE;
 
   void Run();
diff --git a/webrtc/system_wrappers/source/thread_win.cc b/webrtc/system_wrappers/source/thread_win.cc
index bcb95e7..2037a6f 100644
--- a/webrtc/system_wrappers/source/thread_win.cc
+++ b/webrtc/system_wrappers/source/thread_win.cc
@@ -102,21 +102,6 @@
   return true;
 }
 
-bool ThreadWindows::SetAffinity(const int* processor_numbers,
-                                const unsigned int amount_of_processors) {
-  DWORD_PTR processor_bit_mask = 0;
-  for (unsigned int processor_index = 0;
-       processor_index < amount_of_processors;
-       ++processor_index) {
-    // Convert from an array with processor numbers to a bitmask
-    // Processor numbers start at zero.
-    // TODO(hellner): this looks like a bug. Shouldn't the '=' be a '+='?
-    // Or even better |=
-    processor_bit_mask = 1 << processor_numbers[processor_index];
-  }
-  return SetThreadAffinityMask(thread_, processor_bit_mask) != 0;
-}
-
 void ThreadWindows::SetNotAlive() {
   alive_ = false;
 }
diff --git a/webrtc/system_wrappers/source/thread_win.h b/webrtc/system_wrappers/source/thread_win.h
index 1122676..6fb7d31 100644
--- a/webrtc/system_wrappers/source/thread_win.h
+++ b/webrtc/system_wrappers/source/thread_win.h
@@ -27,8 +27,6 @@
   virtual ~ThreadWindows();
 
   virtual bool Start(unsigned int& id);
-  bool SetAffinity(const int* processor_numbers,
-                   const unsigned int amount_of_processors);
   virtual bool Stop();
   virtual void SetNotAlive();