Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(242)

Side by Side Diff: runtime/platform/json.h

Issue 192443004: Complete the switch to ServiceObject (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 public: 123 public:
124 explicit TextBuffer(intptr_t buf_size); 124 explicit TextBuffer(intptr_t buf_size);
125 ~TextBuffer(); 125 ~TextBuffer();
126 126
127 intptr_t Printf(const char* format, ...) PRINTF_ATTRIBUTE(2, 3); 127 intptr_t Printf(const char* format, ...) PRINTF_ATTRIBUTE(2, 3);
128 void AddChar(char ch); 128 void AddChar(char ch);
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 void AddEscapedUTF8String(const char* s);
133 134
134 void Clear(); 135 void Clear();
135 136
136 char* buf() { return buf_; } 137 char* buf() { return buf_; }
137 intptr_t length() { return msg_len_; } 138 intptr_t length() { return msg_len_; }
138 139
139 // Steal ownership of the buffer pointer. 140 // Steal ownership of the buffer pointer.
140 // NOTE: TextBuffer is empty afterwards. 141 // NOTE: TextBuffer is empty afterwards.
141 const char* Steal(); 142 const char* Steal();
142 143
143 private: 144 private:
145 static uint32_t Utf8Decode(const uint8_t* s, intptr_t s_len, uint32_t* ch);
146
144 void EnsureCapacity(intptr_t len); 147 void EnsureCapacity(intptr_t len);
145 char* buf_; 148 char* buf_;
146 intptr_t buf_size_; 149 intptr_t buf_size_;
147 intptr_t msg_len_; 150 intptr_t msg_len_;
148 }; 151 };
149 152
150 } // namespace dart 153 } // namespace dart
151 154
152 #endif // PLATFORM_JSON_H_ 155 #endif // PLATFORM_JSON_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698