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

Side by Side Diff: remoting/protocol/protobuf_video_writer.cc

Issue 8116021: Switch remoting/protocol to new callbacks (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: - Created 9 years, 2 months 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « remoting/protocol/protobuf_video_writer.h ('k') | remoting/protocol/protocol_mock_objects.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "remoting/protocol/protobuf_video_writer.h" 5 #include "remoting/protocol/protobuf_video_writer.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/task.h" 8 #include "base/task.h"
9 #include "net/socket/stream_socket.h" 9 #include "net/socket/stream_socket.h"
10 #include "remoting/base/constants.h" 10 #include "remoting/base/constants.h"
(...skipping 22 matching lines...) Expand all
33 33
34 void ProtobufVideoWriter::OnChannelReady(net::StreamSocket* socket) { 34 void ProtobufVideoWriter::OnChannelReady(net::StreamSocket* socket) {
35 if (!socket) { 35 if (!socket) {
36 initialized_callback_.Run(false); 36 initialized_callback_.Run(false);
37 return; 37 return;
38 } 38 }
39 39
40 DCHECK(!channel_.get()); 40 DCHECK(!channel_.get());
41 channel_.reset(socket); 41 channel_.reset(socket);
42 // TODO(sergeyu): Provide WriteFailedCallback for the buffered writer. 42 // TODO(sergeyu): Provide WriteFailedCallback for the buffered writer.
43 buffered_writer_->Init(socket, NULL); 43 buffered_writer_->Init(socket, BufferedSocketWriter::WriteFailedCallback());
44 44
45 initialized_callback_.Run(true); 45 initialized_callback_.Run(true);
46 } 46 }
47 47
48 void ProtobufVideoWriter::Close() { 48 void ProtobufVideoWriter::Close() {
49 buffered_writer_->Close(); 49 buffered_writer_->Close();
50 channel_.reset(); 50 channel_.reset();
51 } 51 }
52 52
53 void ProtobufVideoWriter::ProcessVideoPacket(const VideoPacket* packet, 53 void ProtobufVideoWriter::ProcessVideoPacket(const VideoPacket* packet,
54 Task* done) { 54 const base::Closure& done) {
55 buffered_writer_->Write(SerializeAndFrameMessage(*packet), done); 55 buffered_writer_->Write(SerializeAndFrameMessage(*packet), done);
56 } 56 }
57 57
58 int ProtobufVideoWriter::GetPendingPackets() { 58 int ProtobufVideoWriter::GetPendingPackets() {
59 return buffered_writer_->GetBufferChunks(); 59 return buffered_writer_->GetBufferChunks();
60 } 60 }
61 61
62 } // namespace protocol 62 } // namespace protocol
63 } // namespace remoting 63 } // namespace remoting
OLDNEW
« 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