| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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.h" | 5 #include "base/message_loop.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 524 | 524 |
| 525 // static | 525 // static |
| 526 void MessageLoop::EnableHistogrammer(bool enable) { | 526 void MessageLoop::EnableHistogrammer(bool enable) { |
| 527 enable_histogrammer_ = enable; | 527 enable_histogrammer_ = enable; |
| 528 } | 528 } |
| 529 | 529 |
| 530 void MessageLoop::StartHistogrammer() { | 530 void MessageLoop::StartHistogrammer() { |
| 531 if (enable_histogrammer_ && !message_histogram_.get() | 531 if (enable_histogrammer_ && !message_histogram_.get() |
| 532 && StatisticsRecorder::WasStarted()) { | 532 && StatisticsRecorder::WasStarted()) { |
| 533 DCHECK(!thread_name_.empty()); | 533 DCHECK(!thread_name_.empty()); |
| 534 message_histogram_.reset( | 534 message_histogram_ = |
| 535 new LinearHistogram(("MsgLoop:" + thread_name_).c_str(), | 535 LinearHistogram::LinearHistogramFactoryGet( |
| 536 ("MsgLoop:" + thread_name_), |
| 536 kLeastNonZeroMessageId, | 537 kLeastNonZeroMessageId, |
| 537 kMaxMessageId, | 538 kMaxMessageId, |
| 538 kNumberOfDistinctMessagesDisplayed)); | 539 kNumberOfDistinctMessagesDisplayed); |
| 539 message_histogram_->SetFlags(message_histogram_->kHexRangePrintingFlag); | 540 message_histogram_->SetFlags(message_histogram_->kHexRangePrintingFlag); |
| 540 message_histogram_->SetRangeDescriptions(event_descriptions_); | 541 message_histogram_->SetRangeDescriptions(event_descriptions_); |
| 541 } | 542 } |
| 542 } | 543 } |
| 543 | 544 |
| 544 void MessageLoop::HistogramEvent(int event) { | 545 void MessageLoop::HistogramEvent(int event) { |
| 545 if (message_histogram_.get()) | 546 if (message_histogram_.get()) |
| 546 message_histogram_->Add(event); | 547 message_histogram_->Add(event); |
| 547 } | 548 } |
| 548 | 549 |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 628 Watcher *delegate) { | 629 Watcher *delegate) { |
| 629 return pump_libevent()->WatchFileDescriptor( | 630 return pump_libevent()->WatchFileDescriptor( |
| 630 fd, | 631 fd, |
| 631 persistent, | 632 persistent, |
| 632 static_cast<base::MessagePumpLibevent::Mode>(mode), | 633 static_cast<base::MessagePumpLibevent::Mode>(mode), |
| 633 controller, | 634 controller, |
| 634 delegate); | 635 delegate); |
| 635 } | 636 } |
| 636 | 637 |
| 637 #endif | 638 #endif |
| OLD | NEW |