diff options
| author | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2015-06-18 14:10:49 +0200 |
|---|---|---|
| committer | Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> | 2015-06-18 13:53:24 +0000 |
| commit | 813fbf95af77a531c57a8c497345ad2c61d475b3 (patch) | |
| tree | 821b2c8de8365f21b6c9ba17a236fb3006a1d506 /chromium/jingle | |
| parent | af6588f8d723931a298c995fa97259bb7f7deb55 (diff) | |
| download | qtwebengine-chromium-813fbf95af77a531c57a8c497345ad2c61d475b3.tar.gz | |
BASELINE: Update chromium to 44.0.2403.47
Change-Id: Ie056fedba95cf5e5c76b30c4b2c80fca4764aa2f
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Diffstat (limited to 'chromium/jingle')
24 files changed, 154 insertions, 89 deletions
diff --git a/chromium/jingle/BUILD.gn b/chromium/jingle/BUILD.gn index 7822bae14f2..65ffd1ce216 100644 --- a/chromium/jingle/BUILD.gn +++ b/chromium/jingle/BUILD.gn @@ -3,6 +3,7 @@ # found in the LICENSE file. import("//build/config/features.gni") +import("//testing/test.gni") if (enable_webrtc || !is_android) { jingle_includes = exec_script("//build/gypi_to_gn.py", @@ -21,6 +22,8 @@ if (enable_webrtc || !is_android) { "//base/third_party/dynamic_annotations", "//net", ] + + configs += [ "//build/config/compiler:no_size_t_to_int_warning" ] } # A library for sending and receiving peer-issued notifications. @@ -32,8 +35,8 @@ if (enable_webrtc || !is_android) { "notifier/base/gaia_constants.h", "notifier/base/gaia_token_pre_xmpp_auth.cc", "notifier/base/gaia_token_pre_xmpp_auth.h", - "notifier/base/notification_method.h", "notifier/base/notification_method.cc", + "notifier/base/notification_method.h", "notifier/base/notifier_options.cc", "notifier/base/notifier_options.h", "notifier/base/notifier_options_util.cc", @@ -58,10 +61,10 @@ if (enable_webrtc || !is_android) { "notifier/listener/notification_constants.h", "notifier/listener/notification_defines.cc", "notifier/listener/notification_defines.h", - "notifier/listener/push_client_observer.cc", - "notifier/listener/push_client_observer.h", "notifier/listener/push_client.cc", "notifier/listener/push_client.h", + "notifier/listener/push_client_observer.cc", + "notifier/listener/push_client_observer.h", "notifier/listener/push_notifications_listen_task.cc", "notifier/listener/push_notifications_listen_task.h", "notifier/listener/push_notifications_send_update_task.cc", @@ -75,9 +78,7 @@ if (enable_webrtc || !is_android) { "notifier/listener/xmpp_push_client.cc", "notifier/listener/xmpp_push_client.h", ] - defines = [ - "_CRT_SECURE_NO_WARNINGS", - ] + defines = [ "_CRT_SECURE_NO_WARNINGS" ] public_deps = [ "//third_party/libjingle", @@ -110,9 +111,7 @@ if (enable_webrtc || !is_android) { } # GYP version: jingle/jingle.gyp:jingle_unittests - # TODO(GYP): Convert to executable when its dependencies are linkable. - source_set("jingle_unittests") { - testonly = true + test("jingle_unittests") { sources = [ "glue/channel_socket_adapter_unittest.cc", "glue/chrome_async_socket_unittest.cc", @@ -151,6 +150,8 @@ if (enable_webrtc || !is_android) { ] } + configs += [ "//build/config/compiler:no_size_t_to_int_warning" ] + public_deps = [ "//third_party/libjingle", ] @@ -170,25 +171,28 @@ if (enable_webrtc || !is_android) { } else { # !enable_webrtc and is_android # Stub targets as Android doesn't use libjingle when webrtc is disabled. - source_set("jingle_glue") { } + source_set("jingle_glue") { + } - source_set("jingle_glue_test_util") { } + source_set("jingle_glue_test_util") { + } # GYP version: jingle/jingle.gyp:notifier static_library("notifier") { sources = [ "notifier/base/gaia_constants.cc", "notifier/base/gaia_constants.h", - "notifier/base/notification_method.h", "notifier/base/notification_method.cc", + "notifier/base/notification_method.h", "notifier/base/notifier_options.cc", "notifier/base/notifier_options.h", ] deps = [ "//base", - "//net" + "//net", ] } - source_set("notifier_test_util") { } + source_set("notifier_test_util") { + } } diff --git a/chromium/jingle/OWNERS b/chromium/jingle/OWNERS index 56688d81cf2..d728905c047 100644 --- a/chromium/jingle/OWNERS +++ b/chromium/jingle/OWNERS @@ -1,4 +1,2 @@ -ajwong@chromium.org -hclam@chromium.org sergeyu@chromium.org zea@chromium.org diff --git a/chromium/jingle/glue/channel_socket_adapter_unittest.cc b/chromium/jingle/glue/channel_socket_adapter_unittest.cc index 7c12f0d9291..ef147823965 100644 --- a/chromium/jingle/glue/channel_socket_adapter_unittest.cc +++ b/chromium/jingle/glue/channel_socket_adapter_unittest.cc @@ -46,6 +46,7 @@ class MockTransportChannel : public cricket::TransportChannel { MOCK_CONST_METHOD1(GetSslRole, bool(rtc::SSLRole* role)); MOCK_METHOD1(SetSrtpCiphers, bool(const std::vector<std::string>& ciphers)); MOCK_METHOD1(GetSrtpCipher, bool(std::string* cipher)); + MOCK_METHOD1(GetSslCipher, bool(std::string* cipher)); MOCK_CONST_METHOD1(GetLocalIdentity, bool(rtc::SSLIdentity** identity)); MOCK_CONST_METHOD1(GetRemoteCertificate, bool(rtc::SSLCertificate** cert)); @@ -66,7 +67,7 @@ class TransportChannelSocketAdapterTest : public testing::Test { } protected: - virtual void SetUp() { + void SetUp() override { target_.reset(new TransportChannelSocketAdapter(&channel_)); } diff --git a/chromium/jingle/glue/chrome_async_socket_unittest.cc b/chromium/jingle/glue/chrome_async_socket_unittest.cc index 4449d382267..a7855533d2a 100644 --- a/chromium/jingle/glue/chrome_async_socket_unittest.cc +++ b/chromium/jingle/glue/chrome_async_socket_unittest.cc @@ -43,7 +43,7 @@ class AsyncSocketDataProvider : public net::SocketDataProvider { // If there's no read, sets the "has pending read" flag. Otherwise, // pops the next read. - net::MockRead GetNextRead() override { + net::MockRead OnRead() override { if (reads_.empty()) { DCHECK(!has_pending_read_); has_pending_read_ = true; @@ -93,6 +93,14 @@ class AsyncSocketDataProvider : public net::SocketDataProvider { writes_.push_back(mock_write); } + bool AllReadDataConsumed() const override { + return reads_.empty(); + } + + bool AllWriteDataConsumed() const override { + return writes_.empty(); + } + private: std::deque<net::MockRead> reads_; bool has_pending_read_; @@ -154,9 +162,9 @@ class ChromeAsyncSocketTest message_loop_.reset(new base::MessageLoop(pump.Pass())); } - virtual ~ChromeAsyncSocketTest() {} + ~ChromeAsyncSocketTest() override {} - virtual void SetUp() { + void SetUp() override { scoped_ptr<net::MockClientSocketFactory> mock_client_socket_factory( new net::MockClientSocketFactory()); mock_client_socket_factory->AddSocketDataProvider( @@ -189,7 +197,7 @@ class ChromeAsyncSocketTest this, &ChromeAsyncSocketTest::OnError); } - virtual void TearDown() { + void TearDown() override { // Run any tasks that we forgot to pump. message_loop_->RunUntilIdle(); ExpectClosed(); diff --git a/chromium/jingle/glue/fake_ssl_client_socket.cc b/chromium/jingle/glue/fake_ssl_client_socket.cc index 4cc68671824..657bd7625f2 100644 --- a/chromium/jingle/glue/fake_ssl_client_socket.cc +++ b/chromium/jingle/glue/fake_ssl_client_socket.cc @@ -344,4 +344,9 @@ bool FakeSSLClientSocket::GetSSLInfo(net::SSLInfo* ssl_info) { return transport_socket_->GetSSLInfo(ssl_info); } +void FakeSSLClientSocket::GetConnectionAttempts( + net::ConnectionAttempts* out) const { + out->clear(); +} + } // namespace jingle_glue diff --git a/chromium/jingle/glue/fake_ssl_client_socket.h b/chromium/jingle/glue/fake_ssl_client_socket.h index bf951d6dc77..8f904298de1 100644 --- a/chromium/jingle/glue/fake_ssl_client_socket.h +++ b/chromium/jingle/glue/fake_ssl_client_socket.h @@ -67,6 +67,10 @@ class FakeSSLClientSocket : public net::StreamSocket { bool WasNpnNegotiated() const override; net::NextProto GetNegotiatedProtocol() const override; bool GetSSLInfo(net::SSLInfo* ssl_info) override; + void GetConnectionAttempts(net::ConnectionAttempts* out) const override; + void ClearConnectionAttempts() override {} + void AddConnectionAttempts(const net::ConnectionAttempts& attempts) override { + } private: enum HandshakeState { diff --git a/chromium/jingle/glue/fake_ssl_client_socket_unittest.cc b/chromium/jingle/glue/fake_ssl_client_socket_unittest.cc index 3a9a5cf5e67..0f8112700fa 100644 --- a/chromium/jingle/glue/fake_ssl_client_socket_unittest.cc +++ b/chromium/jingle/glue/fake_ssl_client_socket_unittest.cc @@ -12,8 +12,8 @@ #include "base/memory/scoped_ptr.h" #include "base/message_loop/message_loop.h" #include "net/base/io_buffer.h" -#include "net/base/net_log.h" #include "net/base/test_completion_callback.h" +#include "net/log/net_log.h" #include "net/socket/socket_test_util.h" #include "net/socket/stream_socket.h" #include "testing/gmock/include/gmock/gmock.h" @@ -68,6 +68,9 @@ class MockClientSocket : public net::StreamSocket { MOCK_CONST_METHOD0(WasNpnNegotiated, bool()); MOCK_CONST_METHOD0(GetNegotiatedProtocol, net::NextProto()); MOCK_METHOD1(GetSSLInfo, bool(net::SSLInfo*)); + MOCK_CONST_METHOD1(GetConnectionAttempts, void(net::ConnectionAttempts*)); + MOCK_METHOD0(ClearConnectionAttempts, void()); + MOCK_METHOD1(AddConnectionAttempts, void(const net::ConnectionAttempts&)); }; // Break up |data| into a bunch of chunked MockReads/Writes and push @@ -89,7 +92,7 @@ class FakeSSLClientSocketTest : public testing::Test { protected: FakeSSLClientSocketTest() {} - virtual ~FakeSSLClientSocketTest() {} + ~FakeSSLClientSocketTest() override {} scoped_ptr<net::StreamSocket> MakeClientSocket() { return mock_client_socket_factory_.CreateTransportClientSocket( diff --git a/chromium/jingle/glue/logging_unittest.cc b/chromium/jingle/glue/logging_unittest.cc index e43efff49ec..96401784b97 100644 --- a/chromium/jingle/glue/logging_unittest.cc +++ b/chromium/jingle/glue/logging_unittest.cc @@ -7,16 +7,18 @@ // Also note that we are only allowed to call InitLogging() twice so the test // cases are more dense than normal. -// The following include must be first in this file. It ensures that +// We must include Chromium headers before including the overrides header +// since webrtc's logging.h file may conflict with chromium. +#include "base/command_line.h" +#include "base/files/file_util.h" +#include "testing/gtest/include/gtest/gtest.h" + +// The following include come before including logging.h. It ensures that // libjingle style logging is used. #define LOGGING_INSIDE_WEBRTC #include "third_party/webrtc/overrides/webrtc/base/logging.h" -#include "base/command_line.h" -#include "base/files/file_util.h" -#include "testing/gtest/include/gtest/gtest.h" - #if defined(OS_WIN) static const wchar_t* const log_file_name = L"libjingle_logging.log"; #else @@ -50,7 +52,7 @@ static bool ContainsString(const std::string& original, static bool Initialize(int verbosity_level) { if (verbosity_level != kDefaultVerbosity) { // Update the command line with specified verbosity level for this file. - CommandLine* command_line = CommandLine::ForCurrentProcess(); + base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); std::ostringstream value_stream; value_stream << "logging_unittest=" << verbosity_level; const std::string& value = value_stream.str(); @@ -74,7 +76,7 @@ static bool Initialize(int verbosity_level) { TEST(LibjingleLogTest, DefaultConfiguration) { ASSERT_TRUE(Initialize(kDefaultVerbosity)); - // In the default configuration nothing should be logged. + // In the default configuration only warnings and errors should be logged. LOG_V(rtc::LS_ERROR) << AsString(rtc::LS_ERROR); LOG_V(rtc::LS_WARNING) << AsString(rtc::LS_WARNING); LOG_V(rtc::LS_INFO) << AsString(rtc::LS_INFO); @@ -87,9 +89,8 @@ TEST(LibjingleLogTest, DefaultConfiguration) { base::ReadFileToString(file_path, &contents_of_file); // Make sure string contains the expected values. - EXPECT_FALSE(ContainsString(contents_of_file, AsString(rtc::LS_ERROR))); - EXPECT_FALSE(ContainsString(contents_of_file, - AsString(rtc::LS_WARNING))); + EXPECT_TRUE(ContainsString(contents_of_file, AsString(rtc::LS_ERROR))); + EXPECT_TRUE(ContainsString(contents_of_file, AsString(rtc::LS_WARNING))); EXPECT_FALSE(ContainsString(contents_of_file, AsString(rtc::LS_INFO))); EXPECT_FALSE(ContainsString(contents_of_file, AsString(rtc::LS_VERBOSE))); @@ -98,7 +99,7 @@ TEST(LibjingleLogTest, DefaultConfiguration) { } TEST(LibjingleLogTest, InfoConfiguration) { - ASSERT_TRUE(Initialize(rtc::LS_INFO)); + ASSERT_TRUE(Initialize(0)); // 0 == Chrome's 'info' level. // In this configuration everything lower or equal to LS_INFO should be // logged. @@ -117,7 +118,7 @@ TEST(LibjingleLogTest, InfoConfiguration) { EXPECT_TRUE(ContainsString(contents_of_file, AsString(rtc::LS_ERROR))); EXPECT_TRUE(ContainsString(contents_of_file, AsString(rtc::LS_WARNING))); - EXPECT_TRUE(ContainsString(contents_of_file, AsString(rtc::LS_INFO))); + EXPECT_FALSE(ContainsString(contents_of_file, AsString(rtc::LS_INFO))); EXPECT_FALSE(ContainsString(contents_of_file, AsString(rtc::LS_VERBOSE))); EXPECT_FALSE(ContainsString(contents_of_file, @@ -130,7 +131,7 @@ TEST(LibjingleLogTest, InfoConfiguration) { } TEST(LibjingleLogTest, LogEverythingConfiguration) { - ASSERT_TRUE(Initialize(rtc::LS_SENSITIVE)); + ASSERT_TRUE(Initialize(2)); // verbosity at level 2 allows LS_SENSITIVE. // In this configuration everything should be logged. LOG_V(rtc::LS_ERROR) << AsString(rtc::LS_ERROR); diff --git a/chromium/jingle/glue/proxy_resolving_client_socket.cc b/chromium/jingle/glue/proxy_resolving_client_socket.cc index 91eb5ae7d98..9eb2da36be2 100644 --- a/chromium/jingle/glue/proxy_resolving_client_socket.cc +++ b/chromium/jingle/glue/proxy_resolving_client_socket.cc @@ -84,8 +84,6 @@ ProxyResolvingClientSocket::ProxyResolvingClientSocket( reference_params->testing_fixed_https_port; session_params.next_protos = reference_params->next_protos; session_params.trusted_spdy_proxy = reference_params->trusted_spdy_proxy; - session_params.force_spdy_over_ssl = reference_params->force_spdy_over_ssl; - session_params.force_spdy_always = reference_params->force_spdy_always; session_params.forced_spdy_exclusions = reference_params->forced_spdy_exclusions; session_params.use_alternate_protocols = @@ -346,10 +344,22 @@ bool ProxyResolvingClientSocket::IsConnectedAndIdle() const { int ProxyResolvingClientSocket::GetPeerAddress( net::IPEndPoint* address) const { - if (transport_.get() && transport_->socket()) + if (!transport_.get() || !transport_->socket()) { + NOTREACHED(); + return net::ERR_SOCKET_NOT_CONNECTED; + } + + if (proxy_info_.is_direct()) return transport_->socket()->GetPeerAddress(address); - NOTREACHED(); - return net::ERR_SOCKET_NOT_CONNECTED; + + net::IPAddressNumber ip_number; + if (!net::ParseIPLiteralToNumber(dest_host_port_pair_.host(), &ip_number)) { + // Do not expose the proxy IP address to the caller. + return net::ERR_NAME_NOT_RESOLVED; + } + + *address = net::IPEndPoint(ip_number, dest_host_port_pair_.port()); + return net::OK; } int ProxyResolvingClientSocket::GetLocalAddress( @@ -410,6 +420,11 @@ bool ProxyResolvingClientSocket::GetSSLInfo(net::SSLInfo* ssl_info) { return false; } +void ProxyResolvingClientSocket::GetConnectionAttempts( + net::ConnectionAttempts* out) const { + out->clear(); +} + void ProxyResolvingClientSocket::CloseTransportSocket() { if (transport_.get() && transport_->socket()) transport_->socket()->Disconnect(); diff --git a/chromium/jingle/glue/proxy_resolving_client_socket.h b/chromium/jingle/glue/proxy_resolving_client_socket.h index 86b21a5e342..e8f22ceb687 100644 --- a/chromium/jingle/glue/proxy_resolving_client_socket.h +++ b/chromium/jingle/glue/proxy_resolving_client_socket.h @@ -15,7 +15,7 @@ #include "net/base/completion_callback.h" #include "net/base/host_port_pair.h" #include "net/base/net_errors.h" -#include "net/base/net_log.h" +#include "net/log/net_log.h" #include "net/proxy/proxy_info.h" #include "net/proxy/proxy_service.h" #include "net/socket/stream_socket.h" @@ -70,6 +70,10 @@ class ProxyResolvingClientSocket : public net::StreamSocket { bool WasNpnNegotiated() const override; net::NextProto GetNegotiatedProtocol() const override; bool GetSSLInfo(net::SSLInfo* ssl_info) override; + void GetConnectionAttempts(net::ConnectionAttempts* out) const override; + void ClearConnectionAttempts() override {} + void AddConnectionAttempts(const net::ConnectionAttempts& attempts) override { + } private: // Proxy resolution and connection functions. diff --git a/chromium/jingle/glue/proxy_resolving_client_socket_unittest.cc b/chromium/jingle/glue/proxy_resolving_client_socket_unittest.cc index 0fda0ff4d67..41c01d221b8 100644 --- a/chromium/jingle/glue/proxy_resolving_client_socket_unittest.cc +++ b/chromium/jingle/glue/proxy_resolving_client_socket_unittest.cc @@ -40,9 +40,9 @@ class ProxyResolvingClientSocketTest : public testing::Test { scoped_ptr<net::TestURLRequestContext>( new MyTestURLRequestContext))) {} - virtual ~ProxyResolvingClientSocketTest() {} + ~ProxyResolvingClientSocketTest() override {} - virtual void TearDown() { + void TearDown() override { // Clear out any messages posted by ProxyResolvingClientSocket's // destructor. message_loop_.RunUntilIdle(); @@ -84,7 +84,7 @@ TEST_F(ProxyResolvingClientSocketTest, ReportsBadProxies) { }; net::MockWrite writes[] = { net::MockWrite("CONNECT example.com:443 HTTP/1.1\r\n" - "Host: example.com:443\r\n" + "Host: example.com\r\n" "Proxy-Connection: keep-alive\r\n\r\n") }; net::StaticSocketDataProvider socket_data2(reads, arraysize(reads), diff --git a/chromium/jingle/glue/pseudotcp_adapter.cc b/chromium/jingle/glue/pseudotcp_adapter.cc index 5a26f7d6034..db275027d4b 100644 --- a/chromium/jingle/glue/pseudotcp_adapter.cc +++ b/chromium/jingle/glue/pseudotcp_adapter.cc @@ -582,6 +582,12 @@ bool PseudoTcpAdapter::GetSSLInfo(net::SSLInfo* ssl_info) { return false; } +void PseudoTcpAdapter::GetConnectionAttempts( + net::ConnectionAttempts* out) const { + DCHECK(CalledOnValidThread()); + out->clear(); +} + void PseudoTcpAdapter::SetAckDelay(int delay_ms) { DCHECK(CalledOnValidThread()); core_->SetAckDelay(delay_ms); diff --git a/chromium/jingle/glue/pseudotcp_adapter.h b/chromium/jingle/glue/pseudotcp_adapter.h index 790363321df..8b11e2ed5b5 100644 --- a/chromium/jingle/glue/pseudotcp_adapter.h +++ b/chromium/jingle/glue/pseudotcp_adapter.h @@ -10,7 +10,7 @@ #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" #include "base/threading/non_thread_safe.h" -#include "net/base/net_log.h" +#include "net/log/net_log.h" #include "net/socket/stream_socket.h" #include "third_party/webrtc/p2p/base/pseudotcp.h" @@ -53,6 +53,10 @@ class PseudoTcpAdapter : public net::StreamSocket, base::NonThreadSafe { bool WasNpnNegotiated() const override; net::NextProto GetNegotiatedProtocol() const override; bool GetSSLInfo(net::SSLInfo* ssl_info) override; + void GetConnectionAttempts(net::ConnectionAttempts* out) const override; + void ClearConnectionAttempts() override {} + void AddConnectionAttempts(const net::ConnectionAttempts& attempts) override { + } // Set the delay for sending ACK. void SetAckDelay(int delay_ms); diff --git a/chromium/jingle/glue/pseudotcp_adapter_unittest.cc b/chromium/jingle/glue/pseudotcp_adapter_unittest.cc index 1b2674f6789..212a2d06dd3 100644 --- a/chromium/jingle/glue/pseudotcp_adapter_unittest.cc +++ b/chromium/jingle/glue/pseudotcp_adapter_unittest.cc @@ -46,13 +46,13 @@ class LeakyBucket : public RateLimiter { : volume_(volume), rate_(rate), level_(0.0), - last_update_(base::TimeTicks::HighResNow()) { + last_update_(base::TimeTicks::Now()) { } ~LeakyBucket() override {} bool DropNextPacket() override { - base::TimeTicks now = base::TimeTicks::HighResNow(); + base::TimeTicks now = base::TimeTicks::Now(); double interval = (now - last_update_).InSecondsF(); last_update_ = now; level_ = level_ + 1.0 - interval * rate_; @@ -300,7 +300,7 @@ class TCPChannelTester : public base::RefCountedThreadSafe<TCPChannelTester> { class PseudoTcpAdapterTest : public testing::Test { protected: - virtual void SetUp() override { + void SetUp() override { JingleThreadWrapper::EnsureForCurrentMessageLoop(); host_socket_ = new FakeSocket(); diff --git a/chromium/jingle/glue/thread_wrapper.cc b/chromium/jingle/glue/thread_wrapper.cc index d07b7468c79..f74fbb378f4 100644 --- a/chromium/jingle/glue/thread_wrapper.cc +++ b/chromium/jingle/glue/thread_wrapper.cc @@ -30,16 +30,26 @@ base::LazyInstance<base::ThreadLocalPointer<JingleThreadWrapper> > // static void JingleThreadWrapper::EnsureForCurrentMessageLoop() { - if (JingleThreadWrapper::current() == NULL) { + if (JingleThreadWrapper::current() == nullptr) { base::MessageLoop* message_loop = base::MessageLoop::current(); - g_jingle_thread_wrapper.Get() - .Set(new JingleThreadWrapper(message_loop->message_loop_proxy())); - message_loop->AddDestructionObserver(current()); + scoped_ptr<JingleThreadWrapper> wrapper = + JingleThreadWrapper::WrapTaskRunner(message_loop->task_runner()); + message_loop->AddDestructionObserver(wrapper.release()); } DCHECK_EQ(rtc::Thread::Current(), current()); } +scoped_ptr<JingleThreadWrapper> JingleThreadWrapper::WrapTaskRunner( + scoped_refptr<base::SingleThreadTaskRunner> task_runner) { + DCHECK(!JingleThreadWrapper::current()); + DCHECK(task_runner->BelongsToCurrentThread()); + + scoped_ptr<JingleThreadWrapper> result(new JingleThreadWrapper(task_runner)); + g_jingle_thread_wrapper.Get().Set(result.get()); + return result.Pass(); +} + // static JingleThreadWrapper* JingleThreadWrapper::current() { return g_jingle_thread_wrapper.Get().Get(); @@ -47,8 +57,7 @@ JingleThreadWrapper* JingleThreadWrapper::current() { JingleThreadWrapper::JingleThreadWrapper( scoped_refptr<base::SingleThreadTaskRunner> task_runner) - : rtc::Thread(new rtc::NullSocketServer()), - task_runner_(task_runner), + : task_runner_(task_runner), send_allowed_(false), last_task_id_(0), pending_send_event_(true, false), @@ -61,18 +70,19 @@ JingleThreadWrapper::JingleThreadWrapper( } JingleThreadWrapper::~JingleThreadWrapper() { - Clear(NULL, rtc::MQID_ANY, NULL); -} + DCHECK_EQ(this, JingleThreadWrapper::current()); + DCHECK_EQ(this, rtc::Thread::Current()); -void JingleThreadWrapper::WillDestroyCurrentMessageLoop() { - DCHECK_EQ(rtc::Thread::Current(), current()); UnwrapCurrent(); - g_jingle_thread_wrapper.Get().Set(NULL); - rtc::ThreadManager::Instance()->SetCurrentThread(NULL); + rtc::ThreadManager::Instance()->SetCurrentThread(nullptr); rtc::MessageQueueManager::Remove(this); - rtc::SocketServer* ss = socketserver(); + g_jingle_thread_wrapper.Get().Set(nullptr); + + Clear(nullptr, rtc::MQID_ANY, nullptr); +} + +void JingleThreadWrapper::WillDestroyCurrentMessageLoop() { delete this; - delete ss; } void JingleThreadWrapper::Post( @@ -133,7 +143,7 @@ void JingleThreadWrapper::Send(rtc::MessageHandler *handler, uint32 id, return; JingleThreadWrapper* current_thread = JingleThreadWrapper::current(); - DCHECK(current_thread != NULL) << "Send() can be called only from a " + DCHECK(current_thread != nullptr) << "Send() can be called only from a " "thread that has JingleThreadWrapper."; rtc::Message message; @@ -180,7 +190,7 @@ void JingleThreadWrapper::Send(rtc::MessageHandler *handler, uint32 id, void JingleThreadWrapper::ProcessPendingSends() { while (true) { - PendingSend* pending_send = NULL; + PendingSend* pending_send = nullptr; { base::AutoLock auto_lock(lock_); if (!pending_send_messages_.empty()) { @@ -240,7 +250,7 @@ void JingleThreadWrapper::RunTask(int task_id) { if (have_message) { if (message.message_id == rtc::MQID_DISPOSE) { - DCHECK(message.phandler == NULL); + DCHECK(message.phandler == nullptr); delete message.pdata; } else { message.phandler->OnMessage(&message); diff --git a/chromium/jingle/glue/thread_wrapper.h b/chromium/jingle/glue/thread_wrapper.h index 6a045bf8a36..7969d2bc6af 100644 --- a/chromium/jingle/glue/thread_wrapper.h +++ b/chromium/jingle/glue/thread_wrapper.h @@ -35,13 +35,15 @@ class JingleThreadWrapper : public base::MessageLoop::DestructionObserver, // MessageLoop is destroyed. static void EnsureForCurrentMessageLoop(); - // Returns thread wrapper for the current thread. NULL is returned - // if EnsureForCurrentMessageLoop() has never been called for this - // thread. + // Creates JingleThreadWrapper for |task_runner| that runs tasks on the + // current thread. + static scoped_ptr<JingleThreadWrapper> WrapTaskRunner( + scoped_refptr<base::SingleThreadTaskRunner> task_runner); + + // Returns thread wrapper for the current thread or nullptr if it doesn't + // exist. static JingleThreadWrapper* current(); - explicit JingleThreadWrapper( - scoped_refptr<base::SingleThreadTaskRunner> task_runner); ~JingleThreadWrapper() override; // Sets whether the thread can be used to send messages @@ -95,6 +97,9 @@ class JingleThreadWrapper : public base::MessageLoop::DestructionObserver, typedef std::map<int, rtc::Message> MessagesQueue; struct PendingSend; + explicit JingleThreadWrapper( + scoped_refptr<base::SingleThreadTaskRunner> task_runner); + void PostTaskInternal( int delay_ms, rtc::MessageHandler* handler, uint32 message_id, rtc::MessageData* data); diff --git a/chromium/jingle/glue/thread_wrapper_unittest.cc b/chromium/jingle/glue/thread_wrapper_unittest.cc index bca6c64fc14..2aa7aca49f7 100644 --- a/chromium/jingle/glue/thread_wrapper_unittest.cc +++ b/chromium/jingle/glue/thread_wrapper_unittest.cc @@ -80,7 +80,7 @@ class ThreadWrapperTest : public testing::Test { : thread_(NULL) { } - virtual void SetUp() override { + void SetUp() override { JingleThreadWrapper::EnsureForCurrentMessageLoop(); thread_ = rtc::Thread::Current(); } diff --git a/chromium/jingle/jingle_nacl.gyp b/chromium/jingle/jingle_nacl.gyp index d622fbed502..b20f6414e3d 100644 --- a/chromium/jingle/jingle_nacl.gyp +++ b/chromium/jingle/jingle_nacl.gyp @@ -31,7 +31,6 @@ ], 'dependencies': [ '../base/base_nacl.gyp:base_nacl', - '../native_client/tools.gyp:prep_toolchain', '../net/net_nacl.gyp:net_nacl', '../third_party/libjingle/libjingle_nacl.gyp:libjingle_nacl', ], diff --git a/chromium/jingle/notifier/base/weak_xmpp_client_unittest.cc b/chromium/jingle/notifier/base/weak_xmpp_client_unittest.cc index a4c9c7b5ebe..a9bfd35b657 100644 --- a/chromium/jingle/notifier/base/weak_xmpp_client_unittest.cc +++ b/chromium/jingle/notifier/base/weak_xmpp_client_unittest.cc @@ -34,7 +34,7 @@ class WeakXmppClientTest : public testing::Test { protected: WeakXmppClientTest() : task_pump_(new jingle_glue::TaskPump()) {} - virtual ~WeakXmppClientTest() {} + ~WeakXmppClientTest() override {} void ConnectSignals(buzz::XmppClient* xmpp_client) { xmpp_client->SignalStateChange.connect( diff --git a/chromium/jingle/notifier/base/xmpp_connection_unittest.cc b/chromium/jingle/notifier/base/xmpp_connection_unittest.cc index 682c8d10d84..147edac22ac 100644 --- a/chromium/jingle/notifier/base/xmpp_connection_unittest.cc +++ b/chromium/jingle/notifier/base/xmpp_connection_unittest.cc @@ -83,9 +83,9 @@ class XmppConnectionTest : public testing::Test { message_loop_->message_loop_proxy()); } - virtual ~XmppConnectionTest() {} + ~XmppConnectionTest() override {} - virtual void TearDown() { + void TearDown() override { // Clear out any messages posted by XmppConnection's destructor. message_loop_->RunUntilIdle(); } @@ -103,7 +103,7 @@ TEST_F(XmppConnectionTest, CreateDestroy) { &mock_xmpp_connection_delegate_, NULL); } -#if !defined(_MSC_VER) || _MSC_VER < 1700 // http://crbug.com/158570 +#if !defined(_MSC_VER) // http://crbug.com/158570 TEST_F(XmppConnectionTest, ImmediateFailure) { // ChromeAsyncSocket::Connect() will always return false since we're // not setting a valid host, but this gets bubbled up as ERROR_NONE @@ -210,7 +210,7 @@ TEST_F(XmppConnectionTest, MultipleConnect) { }, "more than once"); } -#if !defined(_MSC_VER) || _MSC_VER < 1700 // http://crbug.com/158570 +#if !defined(_MSC_VER) // http://crbug.com/158570 TEST_F(XmppConnectionTest, ConnectThenError) { base::WeakPtr<rtc::Task> weak_ptr; EXPECT_CALL(mock_xmpp_connection_delegate_, OnConnect(_)). diff --git a/chromium/jingle/notifier/communicator/single_login_attempt_unittest.cc b/chromium/jingle/notifier/communicator/single_login_attempt_unittest.cc index d5b7418dc15..d791f4a7fe6 100644 --- a/chromium/jingle/notifier/communicator/single_login_attempt_unittest.cc +++ b/chromium/jingle/notifier/communicator/single_login_attempt_unittest.cc @@ -93,15 +93,13 @@ class SingleLoginAttemptTest : public ::testing::Test { "auth_mechanism"), attempt_(new SingleLoginAttempt(login_settings_, &fake_delegate_)) {} - virtual void TearDown() override { - message_loop_.RunUntilIdle(); - } + void TearDown() override { message_loop_.RunUntilIdle(); } void FireRedirect(buzz::XmlElement* redirect_error) { attempt_->OnError(buzz::XmppEngine::ERROR_STREAM, 0, redirect_error); } - virtual ~SingleLoginAttemptTest() { + ~SingleLoginAttemptTest() override { attempt_.reset(); message_loop_.RunUntilIdle(); } diff --git a/chromium/jingle/notifier/listener/non_blocking_push_client_unittest.cc b/chromium/jingle/notifier/listener/non_blocking_push_client_unittest.cc index 0066aa9b843..8b7dac52a8e 100644 --- a/chromium/jingle/notifier/listener/non_blocking_push_client_unittest.cc +++ b/chromium/jingle/notifier/listener/non_blocking_push_client_unittest.cc @@ -24,9 +24,9 @@ class NonBlockingPushClientTest : public testing::Test { protected: NonBlockingPushClientTest() : fake_push_client_(NULL) {} - virtual ~NonBlockingPushClientTest() {} + ~NonBlockingPushClientTest() override {} - virtual void SetUp() override { + void SetUp() override { push_client_.reset( new NonBlockingPushClient( base::MessageLoopProxy::current(), @@ -37,7 +37,7 @@ class NonBlockingPushClientTest : public testing::Test { message_loop_.RunUntilIdle(); } - virtual void TearDown() override { + void TearDown() override { // Clear out any pending notifications before removing observers. message_loop_.RunUntilIdle(); push_client_->RemoveObserver(&fake_observer_); diff --git a/chromium/jingle/notifier/listener/push_client_unittest.cc b/chromium/jingle/notifier/listener/push_client_unittest.cc index 0357cf260f4..5296663d3cf 100644 --- a/chromium/jingle/notifier/listener/push_client_unittest.cc +++ b/chromium/jingle/notifier/listener/push_client_unittest.cc @@ -26,7 +26,7 @@ class PushClientTest : public testing::Test { message_loop_.message_loop_proxy()); } - virtual ~PushClientTest() {} + ~PushClientTest() override {} // The sockets created by the XMPP code expect an IO loop. base::MessageLoopForIO message_loop_; diff --git a/chromium/jingle/notifier/listener/xmpp_push_client_unittest.cc b/chromium/jingle/notifier/listener/xmpp_push_client_unittest.cc index bd0b46de13c..abe6775b9a6 100644 --- a/chromium/jingle/notifier/listener/xmpp_push_client_unittest.cc +++ b/chromium/jingle/notifier/listener/xmpp_push_client_unittest.cc @@ -38,14 +38,14 @@ class XmppPushClientTest : public testing::Test { message_loop_.message_loop_proxy()); } - virtual ~XmppPushClientTest() {} + ~XmppPushClientTest() override {} - virtual void SetUp() override { + void SetUp() override { xmpp_push_client_.reset(new XmppPushClient(notifier_options_)); xmpp_push_client_->AddObserver(&mock_observer_); } - virtual void TearDown() override { + void TearDown() override { // Clear out any messages posted by XmppPushClient. message_loop_.RunUntilIdle(); xmpp_push_client_->RemoveObserver(&mock_observer_); |
