OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/jingle_glue/jingle_channel.h" | 5 #include "remoting/jingle_glue/jingle_channel.h" |
6 | 6 |
7 #include "base/lock.h" | 7 #include "base/lock.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/waitable_event.h" | 10 #include "base/waitable_event.h" |
11 #include "media/base/data_buffer.h" | 11 #include "media/base/data_buffer.h" |
12 #include "remoting/jingle_glue/jingle_thread.h" | 12 #include "remoting/jingle_glue/jingle_thread.h" |
13 #include "talk/base/stream.h" | 13 #include "talk/base/stream.h" |
14 | 14 |
15 using media::DataBuffer; | 15 using media::DataBuffer; |
16 | 16 |
17 namespace remoting { | 17 namespace remoting { |
18 | 18 |
19 const size_t kReadBufferSize = 4096; | 19 const size_t kReadBufferSize = 4096; |
20 | 20 |
21 JingleChannel::JingleChannel(Callback* callback) | 21 JingleChannel::JingleChannel(Callback* callback) |
22 : state_(INITIALIZING), | 22 : state_(INITIALIZING), |
| 23 callback_(callback), |
23 event_handler_(this), | 24 event_handler_(this), |
24 callback_(callback), | |
25 write_buffer_size_(0), | 25 write_buffer_size_(0), |
26 current_write_buf_pos_(0) { | 26 current_write_buf_pos_(0) { |
27 DCHECK(callback_ != NULL); | 27 DCHECK(callback_ != NULL); |
28 } | 28 } |
29 | 29 |
30 // This constructor is only used in unit test. | 30 // This constructor is only used in unit test. |
31 JingleChannel::JingleChannel() | 31 JingleChannel::JingleChannel() |
32 : state_(CLOSED), | 32 : state_(CLOSED), |
33 write_buffer_size_(0), | 33 write_buffer_size_(0), |
34 current_write_buf_pos_(0) { | 34 current_write_buf_pos_(0) { |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 SetState(CLOSED); | 201 SetState(CLOSED); |
202 done_event->Signal(); | 202 done_event->Signal(); |
203 } | 203 } |
204 | 204 |
205 size_t JingleChannel::write_buffer_size() { | 205 size_t JingleChannel::write_buffer_size() { |
206 AutoLock auto_lock(write_lock_); | 206 AutoLock auto_lock(write_lock_); |
207 return write_buffer_size_; | 207 return write_buffer_size_; |
208 } | 208 } |
209 | 209 |
210 } // namespace remoting | 210 } // namespace remoting |
OLD | NEW |