diff options
author | akalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-09 22:47:14 +0000 |
---|---|---|
committer | akalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-09 22:47:14 +0000 |
commit | c6e7f04cdec7b8a4348e6ff9310c67236deca6d0 (patch) | |
tree | d751086cebf6bddf594a5a484a58accae253153a /jingle/notifier/base | |
parent | 35d68277efb4134dd098cfffe3478598dd095da5 (diff) | |
download | chromium_src-c6e7f04cdec7b8a4348e6ff9310c67236deca6d0.zip chromium_src-c6e7f04cdec7b8a4348e6ff9310c67236deca6d0.tar.gz chromium_src-c6e7f04cdec7b8a4348e6ff9310c67236deca6d0.tar.bz2 |
Removed use of XmppSocketAdapter by sync.
Moved XmppSocketAdapter and friends to remoting directory.
Removed some dead code in jingle/.
BUG=54146
TEST=none
Review URL: http://codereview.chromium.org/3298021
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@59012 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'jingle/notifier/base')
-rw-r--r-- | jingle/notifier/base/notifier_options.h | 13 | ||||
-rw-r--r-- | jingle/notifier/base/signal_thread_task.h | 96 | ||||
-rw-r--r-- | jingle/notifier/base/ssl_adapter.cc | 27 | ||||
-rw-r--r-- | jingle/notifier/base/ssl_adapter.h | 33 | ||||
-rw-r--r-- | jingle/notifier/base/static_assert.h | 21 |
5 files changed, 3 insertions, 187 deletions
diff --git a/jingle/notifier/base/notifier_options.h b/jingle/notifier/base/notifier_options.h index 32374cf..289b7d8 100644 --- a/jingle/notifier/base/notifier_options.h +++ b/jingle/notifier/base/notifier_options.h @@ -12,23 +12,16 @@ namespace notifier { struct NotifierOptions { NotifierOptions() - : use_chrome_async_socket(true), - try_ssltcp_first(false), + : try_ssltcp_first(false), notification_method(kDefaultNotificationMethod) {} - NotifierOptions(const bool use_chrome_async_socket, - const bool try_ssltcp_first, + NotifierOptions(const bool try_ssltcp_first, const net::HostPortPair& xmpp_host_port, NotificationMethod notification_method) - : use_chrome_async_socket(use_chrome_async_socket), - try_ssltcp_first(try_ssltcp_first), + : try_ssltcp_first(try_ssltcp_first), xmpp_host_port(xmpp_host_port), notification_method(notification_method) {} - // Indicates whether to use the chrome-socket-based buzz::AsyncSocket - // implementation for notifications. - bool use_chrome_async_socket; - // Indicates that the SSLTCP port (443) is to be tried before the the XMPP // port (5222) during login. bool try_ssltcp_first; diff --git a/jingle/notifier/base/signal_thread_task.h b/jingle/notifier/base/signal_thread_task.h deleted file mode 100644 index 8a6ff27..0000000 --- a/jingle/notifier/base/signal_thread_task.h +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef JINGLE_NOTIFIER_BASE_SIGNAL_THREAD_TASK_H_ -#define JINGLE_NOTIFIER_BASE_SIGNAL_THREAD_TASK_H_ - -#include "base/logging.h" -#include "talk/base/common.h" -#include "talk/base/signalthread.h" -#include "talk/base/sigslot.h" -#include "talk/base/task.h" - -namespace notifier { - -template<class T> -class SignalThreadTask : public talk_base::Task, - public sigslot::has_slots<> { - public: - // Takes ownership of signal_thread. - SignalThreadTask(talk_base::Task* task_parent, T** signal_thread) - : talk_base::Task(task_parent), - signal_thread_(NULL), - finished_(false) { - SetSignalThread(signal_thread); - } - - virtual ~SignalThreadTask() { - ClearSignalThread(); - } - - virtual void Stop() { - Task::Stop(); - ClearSignalThread(); - } - - virtual int ProcessStart() { - DCHECK_EQ(GetState(), talk_base::Task::STATE_START); - signal_thread_->SignalWorkDone.connect( - this, - &SignalThreadTask<T>::OnWorkDone); - signal_thread_->Start(); - return talk_base::Task::STATE_RESPONSE; - } - - int ProcessResponse() { - if (!finished_) { - return talk_base::Task::STATE_BLOCKED; - } - SignalWorkDone(signal_thread_); - ClearSignalThread(); - return talk_base::Task::STATE_DONE; - } - - sigslot::signal1<T*> SignalWorkDone; - - private: - // Takes ownership of signal_thread. - void SetSignalThread(T** signal_thread) { - DCHECK(!signal_thread_); - DCHECK(signal_thread); - DCHECK(*signal_thread); - // No one should be listening to the signal thread for work done. - // They should be using this class instead. Unfortunately, we - // can't verify this. - - signal_thread_ = *signal_thread; - - // Helps callers not to use signal thread after this point since this class - // has taken ownership (and avoid the error of doing - // signal_thread->Start()). - *signal_thread = NULL; - } - - void OnWorkDone(talk_base::SignalThread* signal_thread) { - DCHECK_EQ(signal_thread, signal_thread_); - finished_ = true; - Wake(); - } - - void ClearSignalThread() { - if (signal_thread_) { - // Don't wait on the thread destruction, or we may deadlock. - signal_thread_->Destroy(false); - signal_thread_ = NULL; - } - } - - T* signal_thread_; - bool finished_; - DISALLOW_COPY_AND_ASSIGN(SignalThreadTask); -}; - -} // namespace notifier - -#endif // JINGLE_NOTIFIER_BASE_SIGNAL_THREAD_TASK_H_ diff --git a/jingle/notifier/base/ssl_adapter.cc b/jingle/notifier/base/ssl_adapter.cc deleted file mode 100644 index 2111244..0000000 --- a/jingle/notifier/base/ssl_adapter.cc +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "jingle/notifier/base/ssl_adapter.h" - -#if defined(OS_WIN) -#include "talk/base/ssladapter.h" -#else -#include "jingle/notifier/communicator/ssl_socket_adapter.h" -#endif - -namespace notifier { - -talk_base::SSLAdapter* CreateSSLAdapter(talk_base::AsyncSocket* socket) { - talk_base::SSLAdapter* ssl_adapter = -#if defined(OS_WIN) - talk_base::SSLAdapter::Create(socket); -#else - notifier::SSLSocketAdapter::Create(socket); -#endif - DCHECK(ssl_adapter); - return ssl_adapter; -} - -} // namespace notifier - diff --git a/jingle/notifier/base/ssl_adapter.h b/jingle/notifier/base/ssl_adapter.h deleted file mode 100644 index 32517cd..0000000 --- a/jingle/notifier/base/ssl_adapter.h +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef JINGLE_NOTIFIER_BASE_SSL_ADAPTER_H_ -#define JINGLE_NOTIFIER_BASE_SSL_ADAPTER_H_ - -namespace talk_base { -class AsyncSocket; -class SSLAdapter; -} // namespace talk_base - -namespace notifier { - -// Wraps the given socket in a platform-dependent SSLAdapter -// implementation. -talk_base::SSLAdapter* CreateSSLAdapter(talk_base::AsyncSocket* socket); - -// Utility template class that overrides CreateSSLAdapter() to use the -// above function. -template <class SocketFactory> -class SSLAdapterSocketFactory : public SocketFactory { - public: - virtual talk_base::SSLAdapter* CreateSSLAdapter( - talk_base::AsyncSocket* socket) { - return ::notifier::CreateSSLAdapter(socket); - } -}; - -} // namespace notifier - -#endif // JINGLE_NOTIFIER_BASE_SSL_ADAPTER_H_ - diff --git a/jingle/notifier/base/static_assert.h b/jingle/notifier/base/static_assert.h deleted file mode 100644 index 58a8fe4..0000000 --- a/jingle/notifier/base/static_assert.h +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef JINGLE_NOTIFIER_BASE_STATIC_ASSERT_H_ -#define JINGLE_NOTIFIER_BASE_STATIC_ASSERT_H_ - -template<bool> struct STATIC_ASSERTION_FAILURE; - -template<> struct STATIC_ASSERTION_FAILURE<true> { - enum { value = 1 }; -}; - -template<int> struct static_assert_test{}; - -#define STATIC_ASSERT(B) \ -typedef static_assert_test<\ - sizeof(STATIC_ASSERTION_FAILURE< (bool)( B ) >)>\ - static_assert_typedef_ ## __LINE__ - -#endif // JINGLE_NOTIFIER_BASE_STATIC_ASSERT_H_ |