| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/common/trace_provider_impl.h" | 5 #include "mojo/common/trace_provider_impl.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 base::Callback<void(const scoped_refptr<base::RefCountedString>&, | 80 base::Callback<void(const scoped_refptr<base::RefCountedString>&, |
| 81 bool)>()); | 81 bool)>()); |
| 82 } | 82 } |
| 83 | 83 |
| 84 void TraceProviderImpl::SendChunk( | 84 void TraceProviderImpl::SendChunk( |
| 85 const scoped_refptr<base::RefCountedString>& events_str, | 85 const scoped_refptr<base::RefCountedString>& events_str, |
| 86 bool has_more_events) { | 86 bool has_more_events) { |
| 87 DCHECK(recorder_); | 87 DCHECK(recorder_); |
| 88 // The string will be empty if an error eccured or there were no trace | 88 // The string will be empty if an error eccured or there were no trace |
| 89 // events. Empty string is not a valid chunk to record so skip in this case. | 89 // events. Empty string is not a valid chunk to record so skip in this case. |
| 90 if (events_str->data().empty()) { | 90 if (!events_str->data().empty()) { |
| 91 recorder_->Record(mojo::String(events_str->data())); | 91 recorder_->Record(mojo::String(events_str->data())); |
| 92 } | 92 } |
| 93 if (!has_more_events) { | 93 if (!has_more_events) { |
| 94 recorder_.reset(); | 94 recorder_.reset(); |
| 95 } | 95 } |
| 96 } | 96 } |
| 97 | 97 |
| 98 } // namespace mojo | 98 } // namespace mojo |
| OLD | NEW |