Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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.h" | 5 #include "content/browser/media/capture/desktop_capture_device.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <string.h> | 9 #include <string.h> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 210 first_capture_returned_ = true; | 210 first_capture_returned_ = true; |
| 211 if (capturer_type_ == DesktopMediaID::TYPE_SCREEN) { | 211 if (capturer_type_ == DesktopMediaID::TYPE_SCREEN) { |
| 212 IncrementDesktopCaptureCounter(success ? FIRST_SCREEN_CAPTURE_SUCCEEDED | 212 IncrementDesktopCaptureCounter(success ? FIRST_SCREEN_CAPTURE_SUCCEEDED |
| 213 : FIRST_SCREEN_CAPTURE_FAILED); | 213 : FIRST_SCREEN_CAPTURE_FAILED); |
| 214 } else { | 214 } else { |
| 215 IncrementDesktopCaptureCounter(success ? FIRST_WINDOW_CAPTURE_SUCCEEDED | 215 IncrementDesktopCaptureCounter(success ? FIRST_WINDOW_CAPTURE_SUCCEEDED |
| 216 : FIRST_WINDOW_CAPTURE_FAILED); | 216 : FIRST_WINDOW_CAPTURE_FAILED); |
| 217 } | 217 } |
| 218 } | 218 } |
| 219 | 219 |
| 220 if (!client_) | |
|
Sergey Ulanov
2017/01/13 07:49:03
Why do we need this check? As far as I can tell cl
Hzj_jie
2017/01/13 22:10:23
No, as I mentioned in the code review, this change
| |
| 221 return; | |
| 222 | |
| 220 if (!success) { | 223 if (!success) { |
| 221 if (result == webrtc::DesktopCapturer::Result::ERROR_PERMANENT) | 224 if (result == webrtc::DesktopCapturer::Result::ERROR_PERMANENT) |
| 222 client_->OnError(FROM_HERE, "The desktop capturer has failed."); | 225 client_->OnError(FROM_HERE, "The desktop capturer has failed."); |
| 223 return; | 226 return; |
| 224 } | 227 } |
| 225 DCHECK(frame); | 228 DCHECK(frame); |
| 226 | 229 |
| 227 if (!client_) | |
| 228 return; | |
| 229 | |
| 230 base::TimeDelta capture_time( | 230 base::TimeDelta capture_time( |
| 231 base::TimeDelta::FromMilliseconds(frame->capture_time_ms())); | 231 base::TimeDelta::FromMilliseconds(frame->capture_time_ms())); |
| 232 | 232 |
| 233 // The two UMA_ blocks must be put in its own scope since it creates a static | 233 // The two UMA_ blocks must be put in its own scope since it creates a static |
| 234 // variable which expected constant histogram name. | 234 // variable which expected constant histogram name. |
| 235 if (capturer_type_ == DesktopMediaID::TYPE_SCREEN) { | 235 if (capturer_type_ == DesktopMediaID::TYPE_SCREEN) { |
| 236 UMA_HISTOGRAM_TIMES(kUmaScreenCaptureTime, capture_time); | 236 UMA_HISTOGRAM_TIMES(kUmaScreenCaptureTime, capture_time); |
| 237 } else { | 237 } else { |
| 238 UMA_HISTOGRAM_TIMES(kUmaWindowCaptureTime, capture_time); | 238 UMA_HISTOGRAM_TIMES(kUmaWindowCaptureTime, capture_time); |
| 239 } | 239 } |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 462 #else | 462 #else |
| 463 base::MessageLoop::Type thread_type = base::MessageLoop::TYPE_DEFAULT; | 463 base::MessageLoop::Type thread_type = base::MessageLoop::TYPE_DEFAULT; |
| 464 #endif | 464 #endif |
| 465 | 465 |
| 466 thread_.StartWithOptions(base::Thread::Options(thread_type, 0)); | 466 thread_.StartWithOptions(base::Thread::Options(thread_type, 0)); |
| 467 | 467 |
| 468 core_.reset(new Core(thread_.task_runner(), std::move(capturer), type)); | 468 core_.reset(new Core(thread_.task_runner(), std::move(capturer), type)); |
| 469 } | 469 } |
| 470 | 470 |
| 471 } // namespace content | 471 } // namespace content |
| OLD | NEW |