OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "chrome/browser/debugger/debugger_io_socket.h" | 5 #include "chrome/browser/debugger/debugger_io_socket.h" |
6 | 6 |
7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
8 #include "base/thread.h" | 8 #include "base/thread.h" |
9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
10 #include "chrome/browser/debugger/debugger_shell.h" | 10 #include "chrome/browser/debugger/debugger_shell.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 void DebuggerInputOutputSocket::OutputLater(const std::wstring& out, bool lf) { | 85 void DebuggerInputOutputSocket::OutputLater(const std::wstring& out, bool lf) { |
86 std::string utf8 = WideToUTF8(out); | 86 std::string utf8 = WideToUTF8(out); |
87 OutputLater(utf8, lf); | 87 OutputLater(utf8, lf); |
88 } | 88 } |
89 | 89 |
90 void DebuggerInputOutputSocket::OutputLater(const std::string& out, bool lf) { | 90 void DebuggerInputOutputSocket::OutputLater(const std::string& out, bool lf) { |
91 io_loop_->PostTask(FROM_HERE, NewRunnableMethod( | 91 io_loop_->PostTask(FROM_HERE, NewRunnableMethod( |
92 this, &DebuggerInputOutputSocket::OutputToSocket, out, lf)); | 92 this, &DebuggerInputOutputSocket::OutputToSocket, out, lf)); |
93 } | 93 } |
94 | 94 |
95 void DebuggerInputOutputSocket::OutputToSocket(const std::string& out, bool lf)
{ | 95 void DebuggerInputOutputSocket::OutputToSocket(const std::string& out, |
| 96 bool lf) { |
96 DCHECK(MessageLoop::current() == io_loop_); | 97 DCHECK(MessageLoop::current() == io_loop_); |
97 if (connection_) { | 98 if (connection_) { |
98 if (out.length()) { | 99 if (out.length()) { |
99 connection_->Send(out, lf); | 100 connection_->Send(out, lf); |
100 } | 101 } |
101 } else { | 102 } else { |
102 logging::LogMessage("CONSOLE", 0).stream() << "V8 debugger: " << out; | 103 logging::LogMessage("CONSOLE", 0).stream() << "V8 debugger: " << out; |
103 } | 104 } |
104 } | 105 } |
105 | 106 |
(...skipping 13 matching lines...) Expand all Loading... |
119 DCHECK(MessageLoop::current() == io_loop_); | 120 DCHECK(MessageLoop::current() == io_loop_); |
120 if (connection_ == sock) { | 121 if (connection_ == sock) { |
121 connection_ = NULL; | 122 connection_ = NULL; |
122 sock->Release(); | 123 sock->Release(); |
123 } else { | 124 } else { |
124 // TODO(erikkay): assert? | 125 // TODO(erikkay): assert? |
125 } | 126 } |
126 } | 127 } |
127 | 128 |
128 | 129 |
OLD | NEW |