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

Unified Diff: runtime/vm/zone_text_buffer.cc

Issue 2683033007: Revert "Reapply "Use CodeSourceMap for stack traces (still JIT only)."" (Closed)
Patch Set: Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/zone_text_buffer.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/zone_text_buffer.cc
diff --git a/runtime/vm/zone_text_buffer.cc b/runtime/vm/zone_text_buffer.cc
deleted file mode 100644
index 5825e2d7595585ff6c7d55024c04471afb4a5d03..0000000000000000000000000000000000000000
--- a/runtime/vm/zone_text_buffer.cc
+++ /dev/null
@@ -1,65 +0,0 @@
-// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-#include "vm/zone_text_buffer.h"
-
-#include "platform/assert.h"
-#include "platform/globals.h"
-#include "platform/utils.h"
-#include "vm/os.h"
-#include "vm/zone.h"
-
-namespace dart {
-
-ZoneTextBuffer::ZoneTextBuffer(Zone* zone, intptr_t initial_capacity)
- : zone_(zone), buffer_(NULL), length_(0), capacity_(0) {
- ASSERT(initial_capacity > 0);
- buffer_ = reinterpret_cast<char*>(zone->Alloc<char>(initial_capacity));
- capacity_ = initial_capacity;
-}
-
-
-intptr_t ZoneTextBuffer::Printf(const char* format, ...) {
- va_list args;
- va_start(args, format);
- intptr_t remaining = capacity_ - length_;
- ASSERT(remaining >= 0);
- intptr_t len = OS::VSNPrint(buffer_ + length_, remaining, format, args);
- va_end(args);
- if (len >= remaining) {
- EnsureCapacity(len);
- remaining = capacity_ - length_;
- ASSERT(remaining > len);
- va_list args2;
- va_start(args2, format);
- intptr_t len2 = OS::VSNPrint(buffer_ + length_, remaining, format, args2);
- va_end(args2);
- ASSERT(len == len2);
- }
- length_ += len;
- buffer_[length_] = '\0';
- return len;
-}
-
-
-void ZoneTextBuffer::AddString(const char* s) {
- Printf("%s", s);
-}
-
-
-void ZoneTextBuffer::EnsureCapacity(intptr_t len) {
- intptr_t remaining = capacity_ - length_;
- if (remaining <= len) {
- const int kBufferSpareCapacity = 64; // Somewhat arbitrary.
- // TODO(turnidge): do we need to guard against overflow or other
- // security issues here? Text buffers are used by the debugger
- // to send user-controlled data (e.g. values of string variables) to
- // the debugger front-end.
- intptr_t new_capacity = capacity_ + len + kBufferSpareCapacity;
- buffer_ = zone_->Realloc<char>(buffer_, capacity_, new_capacity);
- capacity_ = new_capacity;
- }
-}
-
-} // namespace dart
« no previous file with comments | « runtime/vm/zone_text_buffer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698