OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "content/browser/devtools/devtools_io_context.h" | 5 #include "content/browser/devtools/devtools_io_context.h" |
6 | 6 |
7 #include "base/files/file.h" | 7 #include "base/files/file.h" |
8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
11 #include "base/third_party/icu/icu_utf.h" | 11 #include "base/third_party/icu/icu_utf.h" |
12 #include "content/public/browser/browser_thread.h" | 12 #include "content/public/browser/browser_thread.h" |
13 | 13 |
14 namespace content { | 14 namespace content { |
15 namespace devtools { | 15 namespace devtools { |
16 | 16 |
17 namespace { | 17 namespace { |
18 unsigned s_last_stream_handle = 0; | 18 unsigned s_last_stream_handle = 0; |
19 } | 19 } |
20 | 20 |
21 using Stream = DevToolsIOContext::Stream; | 21 using Stream = DevToolsIOContext::Stream; |
22 | 22 |
23 Stream::Stream() | 23 Stream::Stream() |
24 : base::RefCountedDeleteOnMessageLoop<Stream>( | 24 : base::RefCountedDeleteOnMessageLoop<Stream>( |
25 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)), | 25 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE)), |
26 handle_(base::UintToString(++s_last_stream_handle)), | 26 handle_(base::UintToString(++s_last_stream_handle)), |
27 had_errors_(false), | 27 had_errors_(false), |
28 last_read_pos_(0) {} | 28 last_read_pos_(0) {} |
29 | 29 |
30 Stream::~Stream() { | 30 Stream::~Stream() { |
31 DCHECK_CURRENTLY_ON(BrowserThread::FILE); | 31 DCHECK_CURRENTLY_ON(BrowserThread::FILE); |
32 } | 32 } |
33 | 33 |
34 bool Stream::InitOnFileThreadIfNeeded() { | 34 bool Stream::InitOnFileThreadIfNeeded() { |
35 if (had_errors_) | 35 if (had_errors_) |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 bool DevToolsIOContext::Close(const std::string& handle) { | 136 bool DevToolsIOContext::Close(const std::string& handle) { |
137 return streams_.erase(handle) == 1; | 137 return streams_.erase(handle) == 1; |
138 } | 138 } |
139 | 139 |
140 void DevToolsIOContext::DiscardAllStreams() { | 140 void DevToolsIOContext::DiscardAllStreams() { |
141 return streams_.clear(); | 141 return streams_.clear(); |
142 } | 142 } |
143 | 143 |
144 } // namespace devtools | 144 } // namespace devtools |
145 } // namespace content | 145 } // namespace content |
OLD | NEW |