OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/browser/api/cast_channel/logger.h" | 5 #include "extensions/browser/api/cast_channel/logger.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "base/time/tick_clock.h" | 10 #include "base/time/tick_clock.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 Z_DEFLATED, | 69 Z_DEFLATED, |
70 // 16 is added to produce a gzip header + trailer. | 70 // 16 is added to produce a gzip header + trailer. |
71 MAX_WBITS + 16, | 71 MAX_WBITS + 16, |
72 8, // memLevel = 8 is default. | 72 8, // memLevel = 8 is default. |
73 Z_DEFAULT_STRATEGY); | 73 Z_DEFAULT_STRATEGY); |
74 DCHECK_EQ(Z_OK, result); | 74 DCHECK_EQ(Z_OK, result); |
75 | 75 |
76 size_t out_size = deflateBound(&stream, input.size()); | 76 size_t out_size = deflateBound(&stream, input.size()); |
77 scoped_ptr<char[]> out(new char[out_size]); | 77 scoped_ptr<char[]> out(new char[out_size]); |
78 | 78 |
79 COMPILE_ASSERT(sizeof(uint8) == sizeof(char), uint8_char_different_sizes); | 79 static_assert(sizeof(uint8) == sizeof(char), |
| 80 "uint8 char should be of different sizes"); |
80 | 81 |
81 stream.next_in = reinterpret_cast<uint8*>(const_cast<char*>(input.data())); | 82 stream.next_in = reinterpret_cast<uint8*>(const_cast<char*>(input.data())); |
82 stream.avail_in = input.size(); | 83 stream.avail_in = input.size(); |
83 stream.next_out = reinterpret_cast<uint8*>(out.get()); | 84 stream.next_out = reinterpret_cast<uint8*>(out.get()); |
84 stream.avail_out = out_size; | 85 stream.avail_out = out_size; |
85 | 86 |
86 // Do a one-shot compression. This will return Z_STREAM_END only if |output| | 87 // Do a one-shot compression. This will return Z_STREAM_END only if |output| |
87 // is large enough to hold all compressed data. | 88 // is large enough to hold all compressed data. |
88 result = deflate(&stream, Z_FINISH); | 89 result = deflate(&stream, Z_FINISH); |
89 | 90 |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 if (it != aggregated_socket_events_.end()) { | 363 if (it != aggregated_socket_events_.end()) { |
363 return it->second->last_errors; | 364 return it->second->last_errors; |
364 } else { | 365 } else { |
365 return LastErrors(); | 366 return LastErrors(); |
366 } | 367 } |
367 } | 368 } |
368 | 369 |
369 } // namespace cast_channel | 370 } // namespace cast_channel |
370 } // namespace core_api | 371 } // namespace core_api |
371 } // namespace extensions | 372 } // namespace extensions |
OLD | NEW |