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

Side by Side Diff: runtime/platform/text_buffer.cc

Issue 1799933002: Ensure embedder timeline callbacks are called for service protocol requests (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 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
« no previous file with comments | « runtime/platform/text_buffer.h ('k') | runtime/vm/dart_api_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "platform/text_buffer.h" 5 #include "platform/text_buffer.h"
6 6
7 #include "platform/assert.h" 7 #include "platform/assert.h"
8 #include "platform/globals.h" 8 #include "platform/globals.h"
9 #include "platform/utils.h" 9 #include "platform/utils.h"
10 #include "vm/os.h" 10 #include "vm/os.h"
(...skipping 30 matching lines...) Expand all
41 41
42 42
43 void TextBuffer::AddChar(char ch) { 43 void TextBuffer::AddChar(char ch) {
44 EnsureCapacity(sizeof(ch)); 44 EnsureCapacity(sizeof(ch));
45 buf_[msg_len_] = ch; 45 buf_[msg_len_] = ch;
46 msg_len_++; 46 msg_len_++;
47 buf_[msg_len_] = '\0'; 47 buf_[msg_len_] = '\0';
48 } 48 }
49 49
50 50
51 void TextBuffer::AddRaw(const uint8_t* buffer,
52 intptr_t buffer_length) {
53 for (intptr_t i = 0; i < buffer_length; i++) {
rmacnak 2016/03/14 23:08:11 Why not EnsureCapacity(buffer_length) memmov(&buf
Cutch 2016/03/15 14:58:17 Done.
54 AddChar(buffer[i]);
55 }
56 }
57
51 intptr_t TextBuffer::Printf(const char* format, ...) { 58 intptr_t TextBuffer::Printf(const char* format, ...) {
52 va_list args; 59 va_list args;
53 va_start(args, format); 60 va_start(args, format);
54 intptr_t remaining = buf_size_ - msg_len_; 61 intptr_t remaining = buf_size_ - msg_len_;
55 ASSERT(remaining >= 0); 62 ASSERT(remaining >= 0);
56 intptr_t len = OS::VSNPrint(buf_ + msg_len_, remaining, format, args); 63 intptr_t len = OS::VSNPrint(buf_ + msg_len_, remaining, format, args);
57 va_end(args); 64 va_end(args);
58 if (len >= remaining) { 65 if (len >= remaining) {
59 EnsureCapacity(len); 66 EnsureCapacity(len);
60 remaining = buf_size_ - msg_len_; 67 remaining = buf_size_ - msg_len_;
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 // the debugger front-end. 155 // the debugger front-end.
149 intptr_t new_size = buf_size_ + len + kBufferSpareCapacity; 156 intptr_t new_size = buf_size_ + len + kBufferSpareCapacity;
150 char* new_buf = reinterpret_cast<char*>(realloc(buf_, new_size)); 157 char* new_buf = reinterpret_cast<char*>(realloc(buf_, new_size));
151 ASSERT(new_buf != NULL); 158 ASSERT(new_buf != NULL);
152 buf_ = new_buf; 159 buf_ = new_buf;
153 buf_size_ = new_size; 160 buf_size_ = new_size;
154 } 161 }
155 } 162 }
156 163
157 } // namespace dart 164 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/platform/text_buffer.h ('k') | runtime/vm/dart_api_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698