diff options
author | sergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-24 18:08:46 +0000 |
---|---|---|
committer | sergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-24 18:08:46 +0000 |
commit | 40eb07fda546a23dcbd07e9e8a68d1d1d9c2ef9a (patch) | |
tree | 3a598ff7a461d42ba7cf6a3907ae3ad32bafbd12 /jingle | |
parent | 66e2c28c1f940c38f54fc042b625c11d63375b48 (diff) | |
download | chromium_src-40eb07fda546a23dcbd07e9e8a68d1d1d9c2ef9a.zip chromium_src-40eb07fda546a23dcbd07e9e8a68d1d1d9c2ef9a.tar.gz chromium_src-40eb07fda546a23dcbd07e9e8a68d1d1d9c2ef9a.tar.bz2 |
Move TaskPump class from jingle/notifier/base to jingle/glue
BUG=137140
Review URL: https://chromiumcodereview.appspot.com/10809066
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@148142 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'jingle')
-rw-r--r-- | jingle/glue/mock_task.cc (renamed from jingle/notifier/base/mock_task.cc) | 8 | ||||
-rw-r--r-- | jingle/glue/mock_task.h (renamed from jingle/notifier/base/mock_task.h) | 12 | ||||
-rw-r--r-- | jingle/glue/task_pump.cc (renamed from jingle/notifier/base/task_pump.cc) | 6 | ||||
-rw-r--r-- | jingle/glue/task_pump.h (renamed from jingle/notifier/base/task_pump.h) | 13 | ||||
-rw-r--r-- | jingle/glue/task_pump_unittest.cc (renamed from jingle/notifier/base/task_pump_unittest.cc) | 10 | ||||
-rw-r--r-- | jingle/jingle.gyp | 10 | ||||
-rw-r--r-- | jingle/notifier/base/fake_base_task.h | 4 | ||||
-rw-r--r-- | jingle/notifier/base/weak_xmpp_client_unittest.cc | 8 | ||||
-rw-r--r-- | jingle/notifier/base/xmpp_connection.cc | 4 | ||||
-rw-r--r-- | jingle/notifier/base/xmpp_connection.h | 7 | ||||
-rw-r--r-- | jingle/notifier/base/xmpp_connection_unittest.cc | 7 |
11 files changed, 47 insertions, 42 deletions
diff --git a/jingle/notifier/base/mock_task.cc b/jingle/glue/mock_task.cc index 0c398cd..8894fbe 100644 --- a/jingle/notifier/base/mock_task.cc +++ b/jingle/glue/mock_task.cc @@ -1,13 +1,13 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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/mock_task.h" +#include "jingle/glue/mock_task.h" -namespace notifier { +namespace jingle_glue { MockTask::MockTask(TaskParent* parent) : talk_base::Task(parent) {} MockTask::~MockTask() {} -} // namespace notifier +} // namespace jingle_glue diff --git a/jingle/notifier/base/mock_task.h b/jingle/glue/mock_task.h index af9b0bb..7fdaddf 100644 --- a/jingle/notifier/base/mock_task.h +++ b/jingle/glue/mock_task.h @@ -4,13 +4,13 @@ // // A mock of talk_base::Task. -#ifndef JINGLE_NOTIFIER_MOCK_TASK_H_ -#define JINGLE_NOTIFIER_MOCK_TASK_H_ +#ifndef JINGLE_GLUE_MOCK_TASK_H_ +#define JINGLE_GLUE_MOCK_TASK_H_ -#include "talk/base/task.h" #include "testing/gmock/include/gmock/gmock.h" +#include "third_party/libjingle/source/talk/base/task.h" -namespace notifier { +namespace jingle_glue { class MockTask : public talk_base::Task { public: @@ -21,6 +21,6 @@ class MockTask : public talk_base::Task { MOCK_METHOD0(ProcessStart, int()); }; -} // namespace notifier +} // namespace jingle_glue -#endif // JINGLE_NOTIFIER_MOCK_TASK_H_ +#endif // JINGLE_GLUE_MOCK_TASK_H_ diff --git a/jingle/notifier/base/task_pump.cc b/jingle/glue/task_pump.cc index a282478..e2c305b 100644 --- a/jingle/notifier/base/task_pump.cc +++ b/jingle/glue/task_pump.cc @@ -4,9 +4,9 @@ #include "base/bind.h" #include "base/message_loop.h" -#include "jingle/notifier/base/task_pump.h" +#include "jingle/glue/task_pump.h" -namespace notifier { +namespace jingle_glue { TaskPump::TaskPump() : ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)), @@ -56,4 +56,4 @@ void TaskPump::CheckAndRunTasks() { RunTasks(); } -} // namespace notifier +} // namespace jingle_glue diff --git a/jingle/notifier/base/task_pump.h b/jingle/glue/task_pump.h index ee18fbe..17ce689 100644 --- a/jingle/notifier/base/task_pump.h +++ b/jingle/glue/task_pump.h @@ -2,16 +2,17 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef JINGLE_NOTIFIER_BASE_TASK_PUMP_H_ -#define JINGLE_NOTIFIER_BASE_TASK_PUMP_H_ +#ifndef JINGLE_GLUE_TASK_PUMP_H_ +#define JINGLE_GLUE_TASK_PUMP_H_ #include "base/compiler_specific.h" #include "base/memory/weak_ptr.h" #include "base/threading/non_thread_safe.h" -#include "talk/base/taskrunner.h" +#include "third_party/libjingle/source/talk/base/taskrunner.h" -namespace notifier { +namespace jingle_glue { +// talk_base::TaskRunner implementation that works on chromium threads. class TaskPump : public talk_base::TaskRunner, public base::NonThreadSafe { public: TaskPump(); @@ -36,6 +37,6 @@ class TaskPump : public talk_base::TaskRunner, public base::NonThreadSafe { DISALLOW_COPY_AND_ASSIGN(TaskPump); }; -} // namespace notifier +} // namespace jingle_glue -#endif // JINGLE_NOTIFIER_BASE_TASK_PUMP_H_ +#endif // JINGLE_GLUE_TASK_PUMP_H_ diff --git a/jingle/notifier/base/task_pump_unittest.cc b/jingle/glue/task_pump_unittest.cc index 0f4e1f4..416ce4d 100644 --- a/jingle/notifier/base/task_pump_unittest.cc +++ b/jingle/glue/task_pump_unittest.cc @@ -1,14 +1,14 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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/task_pump.h" +#include "jingle/glue/task_pump.h" #include "base/message_loop.h" -#include "jingle/notifier/base/mock_task.h" +#include "jingle/glue/mock_task.h" #include "testing/gtest/include/gtest/gtest.h" -namespace notifier { +namespace jingle_glue { namespace { @@ -47,4 +47,4 @@ TEST_F(TaskPumpTest, Stop) { } // namespace -} // namespace notifier +} // namespace jingle_glue diff --git a/jingle/jingle.gyp b/jingle/jingle.gyp index c245432..7902678 100644 --- a/jingle/jingle.gyp +++ b/jingle/jingle.gyp @@ -23,6 +23,8 @@ 'glue/pseudotcp_adapter.cc', 'glue/pseudotcp_adapter.h', 'glue/resolving_client_socket_factory.h', + 'glue/task_pump.cc', + 'glue/task_pump.h', 'glue/thread_wrapper.cc', 'glue/thread_wrapper.h', 'glue/utils.cc', @@ -61,8 +63,6 @@ 'notifier/base/notifier_options_util.h', 'notifier/base/server_information.cc', 'notifier/base/server_information.h', - 'notifier/base/task_pump.cc', - 'notifier/base/task_pump.h', 'notifier/base/weak_xmpp_client.cc', 'notifier/base/weak_xmpp_client.h', 'notifier/base/xmpp_connection.cc', @@ -124,8 +124,6 @@ 'sources': [ 'notifier/base/fake_base_task.cc', 'notifier/base/fake_base_task.h', - 'notifier/base/mock_task.cc', - 'notifier/base/mock_task.h', 'notifier/listener/fake_push_client.cc', 'notifier/listener/fake_push_client.h', 'notifier/listener/fake_push_client_observer.cc', @@ -161,10 +159,12 @@ 'glue/jingle_glue_mock_objects.cc', 'glue/jingle_glue_mock_objects.h', 'glue/logging_unittest.cc', + 'glue/mock_task.cc', + 'glue/mock_task.h', 'glue/proxy_resolving_client_socket_unittest.cc', 'glue/pseudotcp_adapter_unittest.cc', + 'glue/task_pump_unittest.cc', 'glue/thread_wrapper_unittest.cc', - 'notifier/base/task_pump_unittest.cc', 'notifier/base/weak_xmpp_client_unittest.cc', 'notifier/base/xmpp_connection_unittest.cc', 'notifier/communicator/connection_settings_unittest.cc', diff --git a/jingle/notifier/base/fake_base_task.h b/jingle/notifier/base/fake_base_task.h index 6470e5a..2cb6d77 100644 --- a/jingle/notifier/base/fake_base_task.h +++ b/jingle/notifier/base/fake_base_task.h @@ -10,7 +10,7 @@ #include "base/basictypes.h" #include "base/memory/weak_ptr.h" -#include "jingle/notifier/base/task_pump.h" +#include "jingle/glue/task_pump.h" namespace buzz { class XmppTaskParentInterface; @@ -26,7 +26,7 @@ class FakeBaseTask { base::WeakPtr<buzz::XmppTaskParentInterface> AsWeakPtr(); private: - notifier::TaskPump task_pump_; + jingle_glue::TaskPump task_pump_; base::WeakPtr<buzz::XmppTaskParentInterface> base_task_; DISALLOW_COPY_AND_ASSIGN(FakeBaseTask); diff --git a/jingle/notifier/base/weak_xmpp_client_unittest.cc b/jingle/notifier/base/weak_xmpp_client_unittest.cc index fa833fe9..d4d5043 100644 --- a/jingle/notifier/base/weak_xmpp_client_unittest.cc +++ b/jingle/notifier/base/weak_xmpp_client_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -8,7 +8,7 @@ #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" #include "base/message_loop.h" -#include "jingle/notifier/base/task_pump.h" +#include "jingle/glue/task_pump.h" #include "talk/base/sigslot.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -32,7 +32,7 @@ const char kOutputLog[] = "output log"; class WeakXmppClientTest : public testing::Test { protected: - WeakXmppClientTest() : task_pump_(new TaskPump()) {} + WeakXmppClientTest() : task_pump_(new jingle_glue::TaskPump()) {} virtual ~WeakXmppClientTest() {} @@ -62,7 +62,7 @@ class WeakXmppClientTest : public testing::Test { // Needed by TaskPump. MessageLoop message_loop_; - scoped_ptr<TaskPump> task_pump_; + scoped_ptr<jingle_glue::TaskPump> task_pump_; MockXmppDelegate mock_xmpp_delegate_; }; diff --git a/jingle/notifier/base/xmpp_connection.cc b/jingle/notifier/base/xmpp_connection.cc index f8f83fd..2284c7f 100644 --- a/jingle/notifier/base/xmpp_connection.cc +++ b/jingle/notifier/base/xmpp_connection.cc @@ -9,8 +9,8 @@ #include "base/message_loop.h" #include "base/string_piece.h" #include "jingle/glue/chrome_async_socket.h" +#include "jingle/glue/task_pump.h" #include "jingle/glue/xmpp_client_socket_factory.h" -#include "jingle/notifier/base/task_pump.h" #include "jingle/notifier/base/weak_xmpp_client.h" #include "net/base/ssl_config_service.h" #include "net/socket/client_socket_factory.h" @@ -51,7 +51,7 @@ XmppConnection::XmppConnection( const scoped_refptr<net::URLRequestContextGetter>& request_context_getter, Delegate* delegate, buzz::PreXmppAuth* pre_xmpp_auth) - : task_pump_(new TaskPump()), + : task_pump_(new jingle_glue::TaskPump()), on_connect_called_(false), delegate_(delegate) { DCHECK(delegate_); diff --git a/jingle/notifier/base/xmpp_connection.h b/jingle/notifier/base/xmpp_connection.h index d009c6d..b783764 100644 --- a/jingle/notifier/base/xmpp_connection.h +++ b/jingle/notifier/base/xmpp_connection.h @@ -24,9 +24,12 @@ class XmppClientSettings; class XmppTaskParentInterface; } // namespace +namespace jingle_glue { +class TaskPump; +} // namespace jingle_glue + namespace notifier { -class TaskPump; class WeakXmppClient; class XmppConnection @@ -83,7 +86,7 @@ class XmppConnection void ClearClient(); - scoped_ptr<TaskPump> task_pump_; + scoped_ptr<jingle_glue::TaskPump> task_pump_; base::WeakPtr<WeakXmppClient> weak_xmpp_client_; bool on_connect_called_; Delegate* delegate_; diff --git a/jingle/notifier/base/xmpp_connection_unittest.cc b/jingle/notifier/base/xmpp_connection_unittest.cc index e410378..18c4837 100644 --- a/jingle/notifier/base/xmpp_connection_unittest.cc +++ b/jingle/notifier/base/xmpp_connection_unittest.cc @@ -11,8 +11,8 @@ #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" #include "base/message_loop.h" -#include "jingle/notifier/base/mock_task.h" -#include "jingle/notifier/base/task_pump.h" +#include "jingle/glue/mock_task.h" +#include "jingle/glue/task_pump.h" #include "jingle/notifier/base/weak_xmpp_client.h" #include "net/base/cert_verifier.h" #include "net/url_request/url_request_context_getter.h" @@ -231,7 +231,8 @@ TEST_F(XmppConnectionTest, TasksDontRunAfterXmppConnectionDestructor) { url_request_context_getter_, &mock_xmpp_connection_delegate_, NULL); - MockTask* task = new MockTask(xmpp_connection.task_pump_.get()); + jingle_glue::MockTask* task = + new jingle_glue::MockTask(xmpp_connection.task_pump_.get()); // We have to do this since the state enum is protected in // talk_base::Task. const int TASK_STATE_ERROR = 3; |