| 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 "content/browser/media/capture/desktop_capture_device_aura.h" | 5 #include "content/browser/media/capture/desktop_capture_device_aura.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
| 9 #include "base/timer/timer.h" | 9 #include "base/timer/timer.h" |
| 10 #include "cc/output/copy_output_request.h" | 10 #include "cc/output/copy_output_request.h" |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 scoped_refptr<media::VideoFrame> video_frame, | 308 scoped_refptr<media::VideoFrame> video_frame, |
| 309 base::TimeTicks start_time, | 309 base::TimeTicks start_time, |
| 310 const ThreadSafeCaptureOracle::CaptureFrameCallback& capture_frame_cb, | 310 const ThreadSafeCaptureOracle::CaptureFrameCallback& capture_frame_cb, |
| 311 scoped_ptr<cc::CopyOutputResult> result) { | 311 scoped_ptr<cc::CopyOutputResult> result) { |
| 312 static bool first_call = true; | 312 static bool first_call = true; |
| 313 | 313 |
| 314 bool succeeded = ProcessCopyOutputResponse( | 314 bool succeeded = ProcessCopyOutputResponse( |
| 315 video_frame, start_time, capture_frame_cb, result.Pass()); | 315 video_frame, start_time, capture_frame_cb, result.Pass()); |
| 316 | 316 |
| 317 base::TimeDelta capture_time = base::TimeTicks::Now() - start_time; | 317 base::TimeDelta capture_time = base::TimeTicks::Now() - start_time; |
| 318 UMA_HISTOGRAM_TIMES( | 318 |
| 319 window_id_.type == DesktopMediaID::TYPE_SCREEN ? kUmaScreenCaptureTime | 319 // The two UMA_ blocks must be put in its own scope since it creates a static |
| 320 : kUmaWindowCaptureTime, | 320 // variable which expected constant histogram name. |
| 321 capture_time); | 321 if (window_id_.type == DesktopMediaID::TYPE_SCREEN) { |
| 322 UMA_HISTOGRAM_TIMES(kUmaScreenCaptureTime, capture_time); |
| 323 } else { |
| 324 UMA_HISTOGRAM_TIMES(kUmaWindowCaptureTime, capture_time); |
| 325 } |
| 322 | 326 |
| 323 if (first_call) { | 327 if (first_call) { |
| 324 first_call = false; | 328 first_call = false; |
| 325 if (window_id_.type == DesktopMediaID::TYPE_SCREEN) { | 329 if (window_id_.type == DesktopMediaID::TYPE_SCREEN) { |
| 326 IncrementDesktopCaptureCounter(succeeded ? FIRST_SCREEN_CAPTURE_SUCCEEDED | 330 IncrementDesktopCaptureCounter(succeeded ? FIRST_SCREEN_CAPTURE_SUCCEEDED |
| 327 : FIRST_SCREEN_CAPTURE_FAILED); | 331 : FIRST_SCREEN_CAPTURE_FAILED); |
| 328 } else { | 332 } else { |
| 329 IncrementDesktopCaptureCounter(succeeded | 333 IncrementDesktopCaptureCounter(succeeded |
| 330 ? FIRST_WINDOW_CAPTURE_SUCCEEDED | 334 ? FIRST_WINDOW_CAPTURE_SUCCEEDED |
| 331 : FIRST_WINDOW_CAPTURE_FAILED); | 335 : FIRST_WINDOW_CAPTURE_FAILED); |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 529 scoped_ptr<Client> client) { | 533 scoped_ptr<Client> client) { |
| 530 DVLOG(1) << "Allocating " << params.requested_format.frame_size.ToString(); | 534 DVLOG(1) << "Allocating " << params.requested_format.frame_size.ToString(); |
| 531 core_->AllocateAndStart(params, client.Pass()); | 535 core_->AllocateAndStart(params, client.Pass()); |
| 532 } | 536 } |
| 533 | 537 |
| 534 void DesktopCaptureDeviceAura::StopAndDeAllocate() { | 538 void DesktopCaptureDeviceAura::StopAndDeAllocate() { |
| 535 core_->StopAndDeAllocate(); | 539 core_->StopAndDeAllocate(); |
| 536 } | 540 } |
| 537 | 541 |
| 538 } // namespace content | 542 } // namespace content |
| OLD | NEW |