OLD | NEW |
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 "cc/scheduler/compositor_timing_history.h" | 5 #include "cc/scheduler/compositor_timing_history.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
| 10 #include "base/memory/ptr_util.h" |
10 #include "base/metrics/histogram.h" | 11 #include "base/metrics/histogram.h" |
11 #include "base/trace_event/trace_event.h" | 12 #include "base/trace_event/trace_event.h" |
12 #include "cc/debug/rendering_stats_instrumentation.h" | 13 #include "cc/debug/rendering_stats_instrumentation.h" |
13 | 14 |
14 namespace cc { | 15 namespace cc { |
15 | 16 |
16 class CompositorTimingHistory::UMAReporter { | 17 class CompositorTimingHistory::UMAReporter { |
17 public: | 18 public: |
18 virtual ~UMAReporter() {} | 19 virtual ~UMAReporter() {} |
19 | 20 |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 prepare_tiles_duration_history_(kDurationHistorySize), | 375 prepare_tiles_duration_history_(kDurationHistorySize), |
375 activate_duration_history_(kDurationHistorySize), | 376 activate_duration_history_(kDurationHistorySize), |
376 draw_duration_history_(kDurationHistorySize), | 377 draw_duration_history_(kDurationHistorySize), |
377 begin_main_frame_on_critical_path_(false), | 378 begin_main_frame_on_critical_path_(false), |
378 uma_reporter_(CreateUMAReporter(uma_category)), | 379 uma_reporter_(CreateUMAReporter(uma_category)), |
379 rendering_stats_instrumentation_(rendering_stats_instrumentation) {} | 380 rendering_stats_instrumentation_(rendering_stats_instrumentation) {} |
380 | 381 |
381 CompositorTimingHistory::~CompositorTimingHistory() { | 382 CompositorTimingHistory::~CompositorTimingHistory() { |
382 } | 383 } |
383 | 384 |
384 scoped_ptr<CompositorTimingHistory::UMAReporter> | 385 std::unique_ptr<CompositorTimingHistory::UMAReporter> |
385 CompositorTimingHistory::CreateUMAReporter(UMACategory category) { | 386 CompositorTimingHistory::CreateUMAReporter(UMACategory category) { |
386 switch (category) { | 387 switch (category) { |
387 case RENDERER_UMA: | 388 case RENDERER_UMA: |
388 return make_scoped_ptr(new RendererUMAReporter); | 389 return base::WrapUnique(new RendererUMAReporter); |
389 break; | 390 break; |
390 case BROWSER_UMA: | 391 case BROWSER_UMA: |
391 return make_scoped_ptr(new BrowserUMAReporter); | 392 return base::WrapUnique(new BrowserUMAReporter); |
392 break; | 393 break; |
393 case NULL_UMA: | 394 case NULL_UMA: |
394 return make_scoped_ptr(new NullUMAReporter); | 395 return base::WrapUnique(new NullUMAReporter); |
395 break; | 396 break; |
396 } | 397 } |
397 NOTREACHED(); | 398 NOTREACHED(); |
398 return make_scoped_ptr<CompositorTimingHistory::UMAReporter>(nullptr); | 399 return base::WrapUnique<CompositorTimingHistory::UMAReporter>(nullptr); |
399 } | 400 } |
400 | 401 |
401 void CompositorTimingHistory::AsValueInto( | 402 void CompositorTimingHistory::AsValueInto( |
402 base::trace_event::TracedValue* state) const { | 403 base::trace_event::TracedValue* state) const { |
403 state->SetDouble("begin_main_frame_to_commit_estimate_ms", | 404 state->SetDouble("begin_main_frame_to_commit_estimate_ms", |
404 BeginMainFrameToCommitDurationEstimate().InMillisecondsF()); | 405 BeginMainFrameToCommitDurationEstimate().InMillisecondsF()); |
405 state->SetDouble("commit_to_ready_to_activate_estimate_ms", | 406 state->SetDouble("commit_to_ready_to_activate_estimate_ms", |
406 CommitToReadyToActivateDurationEstimate().InMillisecondsF()); | 407 CommitToReadyToActivateDurationEstimate().InMillisecondsF()); |
407 state->SetDouble("prepare_tiles_estimate_ms", | 408 state->SetDouble("prepare_tiles_estimate_ms", |
408 PrepareTilesDurationEstimate().InMillisecondsF()); | 409 PrepareTilesDurationEstimate().InMillisecondsF()); |
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
796 uma_reporter_->AddSwapToAckLatency(swap_to_ack_duration); | 797 uma_reporter_->AddSwapToAckLatency(swap_to_ack_duration); |
797 } | 798 } |
798 swap_start_time_ = base::TimeTicks(); | 799 swap_start_time_ = base::TimeTicks(); |
799 } | 800 } |
800 | 801 |
801 bool CompositorTimingHistory::ShouldReportUma() const { | 802 bool CompositorTimingHistory::ShouldReportUma() const { |
802 return (draw_count_ % kUmaSamplingFrequency) == 0; | 803 return (draw_count_ % kUmaSamplingFrequency) == 0; |
803 } | 804 } |
804 | 805 |
805 } // namespace cc | 806 } // namespace cc |
OLD | NEW |