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

Unified Diff: runtime/vm/trace_buffer.cc

Issue 327803003: Provide the isolate with a trace buffer, but do not allocate one by default. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 6 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/trace_buffer.h ('k') | runtime/vm/trace_buffer_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/trace_buffer.cc
===================================================================
--- runtime/vm/trace_buffer.cc (revision 37183)
+++ runtime/vm/trace_buffer.cc (working copy)
@@ -2,15 +2,18 @@
// 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/isolate.h"
#include "vm/json_stream.h"
#include "vm/os.h"
#include "vm/trace_buffer.h"
namespace dart {
-TraceBuffer::TraceBuffer(intptr_t capacity) : ring_capacity_(capacity) {
+TraceBuffer::TraceBuffer(Isolate* isolate, intptr_t capacity)
+ : isolate_(isolate), ring_capacity_(capacity) {
ring_cursor_ = 0;
- Init();
+ ring_ = reinterpret_cast<TraceBufferEntry*>(
+ calloc(ring_capacity_, sizeof(TraceBufferEntry))); // NOLINT
}
@@ -18,12 +21,16 @@
ASSERT(ring_ != NULL);
Clear();
free(ring_);
+ if (isolate_ != NULL) {
+ isolate_->set_trace_buffer(NULL);
+ isolate_ = NULL;
+ }
}
-void TraceBuffer::Init() {
- ring_ = reinterpret_cast<TraceBufferEntry*>(
- calloc(ring_capacity_, sizeof(TraceBufferEntry))); // NOLINT
+void TraceBuffer::Init(Isolate* isolate, intptr_t capacity) {
+ TraceBuffer* trace_buffer = new TraceBuffer(isolate, capacity);
+ isolate->set_trace_buffer(trace_buffer);
}
« no previous file with comments | « runtime/vm/trace_buffer.h ('k') | runtime/vm/trace_buffer_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698