Use proxy macro for PeerConnectionFactory instead of sending messages internally in PeerConnectionFactory.
In order to do that, the signaling thread is also changed to wrap the current thread unless an external signaling thread thread is  specified in the call to CreatePeerConnectionFactory.

This cleans up the PeerConnectionFactory and makes sure a user of the API will always access the factory on the signaling thread.

Note that both Chrome and the Android implementation use an external signaling thread.

R=tommi@webrtc.org

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@8039 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/talk/app/webrtc/peerconnectionfactory.h b/talk/app/webrtc/peerconnectionfactory.h
index 119b7cd..1b734d6 100644
--- a/talk/app/webrtc/peerconnectionfactory.h
+++ b/talk/app/webrtc/peerconnectionfactory.h
@@ -37,8 +37,7 @@
 
 namespace webrtc {
 
-class PeerConnectionFactory : public PeerConnectionFactoryInterface,
-                              public rtc::MessageHandler {
+class PeerConnectionFactory : public PeerConnectionFactoryInterface {
  public:
   virtual void SetOptions(const Options& options) {
     options_ = options;
@@ -54,25 +53,25 @@
 
   bool Initialize();
 
-  virtual rtc::scoped_refptr<MediaStreamInterface>
-      CreateLocalMediaStream(const std::string& label);
+  rtc::scoped_refptr<MediaStreamInterface>
+      CreateLocalMediaStream(const std::string& label) override;
 
-  virtual rtc::scoped_refptr<AudioSourceInterface> CreateAudioSource(
-      const MediaConstraintsInterface* constraints);
+  rtc::scoped_refptr<AudioSourceInterface> CreateAudioSource(
+      const MediaConstraintsInterface* constraints) override;
 
-  virtual rtc::scoped_refptr<VideoSourceInterface> CreateVideoSource(
+  rtc::scoped_refptr<VideoSourceInterface> CreateVideoSource(
       cricket::VideoCapturer* capturer,
-      const MediaConstraintsInterface* constraints);
+      const MediaConstraintsInterface* constraints) override;
 
-  virtual rtc::scoped_refptr<VideoTrackInterface>
+  rtc::scoped_refptr<VideoTrackInterface>
       CreateVideoTrack(const std::string& id,
-                       VideoSourceInterface* video_source);
+                       VideoSourceInterface* video_source) override;
 
-  virtual rtc::scoped_refptr<AudioTrackInterface>
+  rtc::scoped_refptr<AudioTrackInterface>
       CreateAudioTrack(const std::string& id,
-                       AudioSourceInterface* audio_source);
+                       AudioSourceInterface* audio_source) override;
 
-  virtual bool StartAecDump(rtc::PlatformFile file);
+  bool StartAecDump(rtc::PlatformFile file) override;
 
   virtual cricket::ChannelManager* channel_manager();
   virtual rtc::Thread* signaling_thread();
@@ -90,27 +89,8 @@
   virtual ~PeerConnectionFactory();
 
  private:
-  bool Initialize_s();
-  void Terminate_s();
-  rtc::scoped_refptr<AudioSourceInterface> CreateAudioSource_s(
-      const MediaConstraintsInterface* constraints);
-  rtc::scoped_refptr<VideoSourceInterface> CreateVideoSource_s(
-      cricket::VideoCapturer* capturer,
-      const MediaConstraintsInterface* constraints);
-
-  rtc::scoped_refptr<PeerConnectionInterface> CreatePeerConnection_s(
-      const PeerConnectionInterface::RTCConfiguration& configuration,
-      const MediaConstraintsInterface* constraints,
-      PortAllocatorFactoryInterface* allocator_factory,
-      DTLSIdentityServiceInterface* dtls_identity_service,
-      PeerConnectionObserver* observer);
-
-  bool StartAecDump_s(rtc::PlatformFile file);
-
-  // Implements rtc::MessageHandler.
-  void OnMessage(rtc::Message* msg);
-
   bool owns_ptrs_;
+  bool wraps_current_thread_;
   rtc::Thread* signaling_thread_;
   rtc::Thread* worker_thread_;
   Options options_;