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

Side by Side Diff: services/tracing/trace_data_sink.cc

Issue 1878893002: Move //mojo/services tracing & catalog to //services (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@63move
Patch Set: . Created 4 years, 8 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 | « services/tracing/trace_data_sink.h ('k') | services/tracing/trace_recorder_impl.h » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "mojo/services/tracing/trace_data_sink.h" 5 #include "services/tracing/trace_data_sink.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "mojo/common/data_pipe_utils.h" 10 #include "mojo/common/data_pipe_utils.h"
11 11
12 using mojo::common::BlockingCopyFromString; 12 using mojo::common::BlockingCopyFromString;
13 13
14 namespace tracing { 14 namespace tracing {
15 15
16 TraceDataSink::TraceDataSink(mojo::ScopedDataPipeProducerHandle pipe) 16 TraceDataSink::TraceDataSink(mojo::ScopedDataPipeProducerHandle pipe)
17 : pipe_(std::move(pipe)), empty_(true) {} 17 : pipe_(std::move(pipe)), empty_(true) {}
18 18
19 TraceDataSink::~TraceDataSink() { 19 TraceDataSink::~TraceDataSink() {
20 if (pipe_.is_valid()) 20 if (pipe_.is_valid())
21 pipe_.reset(); 21 pipe_.reset();
22 DCHECK(!pipe_.is_valid()); 22 DCHECK(!pipe_.is_valid());
23 } 23 }
24 24
25 void TraceDataSink::AddChunk(const std::string& json) { 25 void TraceDataSink::AddChunk(const std::string& json) {
26 if (!empty_) 26 if (!empty_)
27 BlockingCopyFromString(",", pipe_); 27 BlockingCopyFromString(",", pipe_);
28 empty_ = false; 28 empty_ = false;
29 BlockingCopyFromString(json, pipe_); 29 BlockingCopyFromString(json, pipe_);
30 } 30 }
31 31
32 } // namespace tracing 32 } // namespace tracing
OLDNEW
« no previous file with comments | « services/tracing/trace_data_sink.h ('k') | services/tracing/trace_recorder_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698