Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(958)

Unified Diff: remoting/protocol/protobuf_video_writer.cc

Issue 8573013: Add CancelChannelCreation() in protocol::Session interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: - Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/protocol/protobuf_video_writer.h ('k') | remoting/protocol/protocol_mock_objects.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/protocol/protobuf_video_writer.cc
diff --git a/remoting/protocol/protobuf_video_writer.cc b/remoting/protocol/protobuf_video_writer.cc
index 88941c42e6adb6572b7a67c3c8d0896c708fc89a..26b0f95314f974922e8a47609f78c16eac87fc7e 100644
--- a/remoting/protocol/protobuf_video_writer.cc
+++ b/remoting/protocol/protobuf_video_writer.cc
@@ -17,16 +17,20 @@ namespace remoting {
namespace protocol {
ProtobufVideoWriter::ProtobufVideoWriter(base::MessageLoopProxy* message_loop)
- : buffered_writer_(new BufferedSocketWriter(message_loop)) {
+ : session_(NULL),
+ buffered_writer_(new BufferedSocketWriter(message_loop)) {
}
-ProtobufVideoWriter::~ProtobufVideoWriter() { }
+ProtobufVideoWriter::~ProtobufVideoWriter() {
+ Close();
+}
void ProtobufVideoWriter::Init(protocol::Session* session,
const InitializedCallback& callback) {
+ session_ = session;
initialized_callback_ = callback;
- session->CreateStreamChannel(
+ session_->CreateStreamChannel(
kVideoChannelName,
base::Bind(&ProtobufVideoWriter::OnChannelReady, base::Unretained(this)));
}
@@ -48,6 +52,10 @@ void ProtobufVideoWriter::OnChannelReady(net::StreamSocket* socket) {
void ProtobufVideoWriter::Close() {
buffered_writer_->Close();
channel_.reset();
+ if (session_) {
+ session_->CancelChannelCreation(kVideoChannelName);
+ session_ = NULL;
+ }
}
void ProtobufVideoWriter::ProcessVideoPacket(const VideoPacket* packet,
« no previous file with comments | « remoting/protocol/protobuf_video_writer.h ('k') | remoting/protocol/protocol_mock_objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698