| // Copyright 2014 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| #include "services/tracing/trace_data_sink.h" |
| #include "base/logging.h" |
| #include "mojo/data_pipe_utils/data_pipe_utils.h" |
| using mojo::common::BlockingCopyFromString; |
| TraceDataSink::TraceDataSink(mojo::ScopedDataPipeProducerHandle pipe) |
| : pipe_(pipe.Pass()), empty_(true) { |
| TraceDataSink::~TraceDataSink() { |
| DCHECK(!pipe_.is_valid()); |
| void TraceDataSink::AddChunk(const std::string& json) { |
| BlockingCopyFromString(",", pipe_); |
| BlockingCopyFromString(json, pipe_); |