| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "base/message_loop/message_loop.h" | 5 #include "base/message_loop/message_loop.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 556 } | 556 } |
| 557 | 557 |
| 558 //------------------------------------------------------------------------------ | 558 //------------------------------------------------------------------------------ |
| 559 // Method and data for histogramming events and actions taken by each instance | 559 // Method and data for histogramming events and actions taken by each instance |
| 560 // on each thread. | 560 // on each thread. |
| 561 | 561 |
| 562 void MessageLoop::StartHistogrammer() { | 562 void MessageLoop::StartHistogrammer() { |
| 563 #if !defined(OS_NACL) // NaCl build has no metrics code. | 563 #if !defined(OS_NACL) // NaCl build has no metrics code. |
| 564 if (enable_histogrammer_ && !message_histogram_ | 564 if (enable_histogrammer_ && !message_histogram_ |
| 565 && StatisticsRecorder::IsActive()) { | 565 && StatisticsRecorder::IsActive()) { |
| 566 DCHECK(!thread_name_.empty()); | 566 std::string thread_name = task_runner_->GetThreadName(); |
| 567 DCHECK(!thread_name.empty()); |
| 567 message_histogram_ = LinearHistogram::FactoryGetWithRangeDescription( | 568 message_histogram_ = LinearHistogram::FactoryGetWithRangeDescription( |
| 568 "MsgLoop:" + thread_name_, | 569 "MsgLoop:" + thread_name, kLeastNonZeroMessageId, kMaxMessageId, |
| 569 kLeastNonZeroMessageId, kMaxMessageId, | |
| 570 kNumberOfDistinctMessagesDisplayed, | 570 kNumberOfDistinctMessagesDisplayed, |
| 571 HistogramBase::kHexRangePrintingFlag, | 571 HistogramBase::kHexRangePrintingFlag, event_descriptions_); |
| 572 event_descriptions_); | |
| 573 } | 572 } |
| 574 #endif | 573 #endif |
| 575 } | 574 } |
| 576 | 575 |
| 577 void MessageLoop::HistogramEvent(int event) { | 576 void MessageLoop::HistogramEvent(int event) { |
| 578 #if !defined(OS_NACL) | 577 #if !defined(OS_NACL) |
| 579 if (message_histogram_) | 578 if (message_histogram_) |
| 580 message_histogram_->Add(event); | 579 message_histogram_->Add(event); |
| 581 #endif | 580 #endif |
| 582 } | 581 } |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 758 persistent, | 757 persistent, |
| 759 mode, | 758 mode, |
| 760 controller, | 759 controller, |
| 761 delegate); | 760 delegate); |
| 762 } | 761 } |
| 763 #endif | 762 #endif |
| 764 | 763 |
| 765 #endif // !defined(OS_NACL_SFI) | 764 #endif // !defined(OS_NACL_SFI) |
| 766 | 765 |
| 767 } // namespace base | 766 } // namespace base |
| OLD | NEW |