| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chromeos/process_proxy/process_output_watcher.h" | 5 #include "chromeos/process_proxy/process_output_watcher.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| 11 #include <cstdio> | 11 #include <cstdio> |
| 12 #include <cstring> | 12 #include <cstring> |
| 13 #include "base/bind.h" | 13 #include "base/bind.h" |
| 14 #include "base/location.h" | 14 #include "base/location.h" |
| 15 #include "base/logging.h" | 15 #include "base/logging.h" |
| 16 #include "base/posix/eintr_wrapper.h" | 16 #include "base/posix/eintr_wrapper.h" |
| 17 #include "base/single_thread_task_runner.h" | 17 #include "base/single_thread_task_runner.h" |
| 18 #include "base/third_party/icu/icu_utf.h" | 18 #include "base/third_party/icu/icu_utf.h" |
| 19 #include "base/thread_task_runner_handle.h" | 19 #include "base/threading/thread_task_runner_handle.h" |
| 20 #include "base/time/time.h" | 20 #include "base/time/time.h" |
| 21 | 21 |
| 22 namespace { | 22 namespace { |
| 23 | 23 |
| 24 // Gets byte size for a UTF8 character given it's leading byte. The character | 24 // Gets byte size for a UTF8 character given it's leading byte. The character |
| 25 // size is encoded as number of leading '1' bits in the character's leading | 25 // size is encoded as number of leading '1' bits in the character's leading |
| 26 // byte. If the most significant bit is '0', the character is a valid ASCII | 26 // byte. If the most significant bit is '0', the character is a valid ASCII |
| 27 // and it's byte size is 1. | 27 // and it's byte size is 1. |
| 28 // The method returns 1 if the provided byte is invalid leading byte. | 28 // The method returns 1 if the provided byte is invalid leading byte. |
| 29 size_t UTF8SizeFromLeadingByte(uint8_t leading_byte) { | 29 size_t UTF8SizeFromLeadingByte(uint8_t leading_byte) { |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 // update the buffer size accordingly. | 163 // update the buffer size accordingly. |
| 164 if (output_to_report < read_buffer_size_) { | 164 if (output_to_report < read_buffer_size_) { |
| 165 for (size_t i = output_to_report; i < read_buffer_size_; ++i) { | 165 for (size_t i = output_to_report; i < read_buffer_size_; ++i) { |
| 166 read_buffer_[i - output_to_report] = read_buffer_[i]; | 166 read_buffer_[i - output_to_report] = read_buffer_[i]; |
| 167 } | 167 } |
| 168 } | 168 } |
| 169 read_buffer_size_ -= output_to_report; | 169 read_buffer_size_ -= output_to_report; |
| 170 } | 170 } |
| 171 | 171 |
| 172 } // namespace chromeos | 172 } // namespace chromeos |
| OLD | NEW |