| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef PLATFORM_JSON_H_ | 5 #ifndef PLATFORM_JSON_H_ |
| 6 #define PLATFORM_JSON_H_ | 6 #define PLATFORM_JSON_H_ |
| 7 | 7 |
| 8 #include "vm/allocation.h" | 8 #include "vm/allocation.h" |
| 9 #include "vm/globals.h" | 9 #include "vm/globals.h" |
| 10 | 10 |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 void AddUTF8(uint32_t ch); | 129 void AddUTF8(uint32_t ch); |
| 130 void AddEscapedChar(uint32_t ch); | 130 void AddEscapedChar(uint32_t ch); |
| 131 void AddString(const char* s); | 131 void AddString(const char* s); |
| 132 void AddEscapedString(const char* s); | 132 void AddEscapedString(const char* s); |
| 133 | 133 |
| 134 void Clear(); | 134 void Clear(); |
| 135 | 135 |
| 136 char* buf() { return buf_; } | 136 char* buf() { return buf_; } |
| 137 intptr_t length() { return msg_len_; } | 137 intptr_t length() { return msg_len_; } |
| 138 | 138 |
| 139 // Steal ownership of the buffer pointer. |
| 140 // NOTE: TextBuffer is empty afterwards. |
| 141 const char* Steal(); |
| 142 |
| 139 private: | 143 private: |
| 140 void EnsureCapacity(intptr_t len); | 144 void EnsureCapacity(intptr_t len); |
| 141 char* buf_; | 145 char* buf_; |
| 142 intptr_t buf_size_; | 146 intptr_t buf_size_; |
| 143 intptr_t msg_len_; | 147 intptr_t msg_len_; |
| 144 }; | 148 }; |
| 145 | 149 |
| 146 } // namespace dart | 150 } // namespace dart |
| 147 | 151 |
| 148 #endif // PLATFORM_JSON_H_ | 152 #endif // PLATFORM_JSON_H_ |
| OLD | NEW |