diff options
author | sergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-21 21:20:02 +0000 |
---|---|---|
committer | sergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-21 21:20:02 +0000 |
commit | ad48b7fbd53d9180b5b917dbf9142b7bd6fa6fa6 (patch) | |
tree | 2b2574d7819dd56861f1eb4920c4dc9fca57b42a /jingle/glue | |
parent | c86455730ab8413c7b8b212228fc079e2cf904b0 (diff) | |
download | chromium_src-ad48b7fbd53d9180b5b917dbf9142b7bd6fa6fa6.zip chromium_src-ad48b7fbd53d9180b5b917dbf9142b7bd6fa6fa6.tar.gz chromium_src-ad48b7fbd53d9180b5b917dbf9142b7bd6fa6fa6.tar.bz2 |
Libjingle-based TransportFactory implementation.
The new TransportFactory will be used on the host side first and then
later on the client side too when we ready to switch to Pepper UDP APIs.
BUG=110485
Review URL: http://codereview.chromium.org/9365002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@122877 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'jingle/glue')
-rw-r--r-- | jingle/glue/channel_socket_adapter.cc | 10 | ||||
-rw-r--r-- | jingle/glue/channel_socket_adapter.h | 8 |
2 files changed, 16 insertions, 2 deletions
diff --git a/jingle/glue/channel_socket_adapter.cc b/jingle/glue/channel_socket_adapter.cc index ae7150a..19158a4 100644 --- a/jingle/glue/channel_socket_adapter.cc +++ b/jingle/glue/channel_socket_adapter.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. @@ -6,6 +6,7 @@ #include <limits> +#include "base/callback.h" #include "base/logging.h" #include "base/message_loop.h" #include "net/base/io_buffer.h" @@ -30,6 +31,13 @@ TransportChannelSocketAdapter::TransportChannelSocketAdapter( } TransportChannelSocketAdapter::~TransportChannelSocketAdapter() { + if (!destruction_callback_.is_null()) + destruction_callback_.Run(); +} + +void TransportChannelSocketAdapter::SetOnDestroyedCallback( + const base::Closure& callback) { + destruction_callback_ = callback; } int TransportChannelSocketAdapter::Read( diff --git a/jingle/glue/channel_socket_adapter.h b/jingle/glue/channel_socket_adapter.h index b90ad84..ab78c9c 100644 --- a/jingle/glue/channel_socket_adapter.h +++ b/jingle/glue/channel_socket_adapter.h @@ -1,10 +1,11 @@ -// 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. #ifndef JINGLE_GLUE_CHANNEL_SOCKET_ADAPTER_H_ #define JINGLE_GLUE_CHANNEL_SOCKET_ADAPTER_H_ +#include "base/callback_forward.h" #include "base/compiler_specific.h" #include "net/socket/socket.h" #include "third_party/libjingle/source/talk/base/socketaddress.h" @@ -28,6 +29,9 @@ class TransportChannelSocketAdapter : public net::Socket, explicit TransportChannelSocketAdapter(cricket::TransportChannel* channel); virtual ~TransportChannelSocketAdapter(); + // Sets callback that should be called when the adapter is being destroyed. + void SetOnDestroyedCallback(const base::Closure& callback); + // Closes the stream. |error_code| specifies error code that will // be returned by Read() and Write() after the stream is closed. // Must be called before the session and the channel are destroyed. @@ -52,6 +56,8 @@ class TransportChannelSocketAdapter : public net::Socket, cricket::TransportChannel* channel_; + base::Closure destruction_callback_; + net::CompletionCallback read_callback_; scoped_refptr<net::IOBuffer> read_buffer_; int read_buffer_size_; |