Chromium Code Reviews| Index: media/capture/content/screen_capture_device_core.cc |
| diff --git a/media/capture/content/screen_capture_device_core.cc b/media/capture/content/screen_capture_device_core.cc |
| index d99ca5a29581d8dbee55f2b8712edbb05bba6875..d089eae597c7d7abdd4937b9e256c94af74c85bc 100644 |
| --- a/media/capture/content/screen_capture_device_core.cc |
| +++ b/media/capture/content/screen_capture_device_core.cc |
| @@ -46,11 +46,11 @@ void ScreenCaptureDeviceCore::AllocateAndStart( |
| params.requested_format.pixel_storage == PIXEL_STORAGE_CPU) && |
| !(params.requested_format.pixel_format == PIXEL_FORMAT_ARGB && |
| params.requested_format.pixel_storage == PIXEL_STORAGE_TEXTURE)) { |
| - const std::string error_msg = base::StringPrintf( |
| - "unsupported format: %s", |
| - VideoCaptureFormat::ToString(params.requested_format).c_str()); |
| - DVLOG(1) << error_msg; |
| - client->OnError(error_msg); |
| + client->OnError( |
| + FROM_HERE, |
| + base::StringPrintf( |
| + "unsupported format: %s", |
| + VideoCaptureFormat::ToString(params.requested_format).c_str())); |
| return; |
| } |
| @@ -80,11 +80,8 @@ void ScreenCaptureDeviceCore::StopAndDeAllocate() { |
| void ScreenCaptureDeviceCore::CaptureStarted(bool success) { |
| DCHECK(thread_checker_.CalledOnValidThread()); |
| - if (!success) { |
| - std::string reason("Failed to start capture machine."); |
| - DVLOG(1) << reason; |
| - Error(reason); |
| - } |
| + if (!success) |
| + Error(FROM_HERE, "Failed to start capture machine."); |
| } |
| ScreenCaptureDeviceCore::ScreenCaptureDeviceCore( |
| @@ -107,8 +104,9 @@ void ScreenCaptureDeviceCore::TransitionStateTo(State next_state) { |
| DCHECK(thread_checker_.CalledOnValidThread()); |
| #ifndef NDEBUG |
| - static const char* kStateNames[] = { |
| - "Idle", "Allocated", "Capturing", "Error"}; |
| + static const char* kStateNames[] = {"Idle", "Capturing", "Error"}; |
|
mcasas
2015/10/29 23:06:08
|State| had only 3 entries, so I guess l.111 was s
|
| + static_assert(arraysize(kStateNames) == kLastCaptureState, |
| + "Different number of states and textual descriptions"); |
| DVLOG(1) << "State change: " << kStateNames[state_] << " --> " |
| << kStateNames[next_state]; |
| #endif |
| @@ -116,14 +114,15 @@ void ScreenCaptureDeviceCore::TransitionStateTo(State next_state) { |
| state_ = next_state; |
| } |
| -void ScreenCaptureDeviceCore::Error(const std::string& reason) { |
| +void ScreenCaptureDeviceCore::Error(const tracked_objects::Location& from_here, |
| + const std::string& reason) { |
| DCHECK(thread_checker_.CalledOnValidThread()); |
| if (state_ == kIdle) |
| return; |
| if (oracle_proxy_.get()) |
| - oracle_proxy_->ReportError(reason); |
| + oracle_proxy_->ReportError(from_here, reason); |
| StopAndDeAllocate(); |
| TransitionStateTo(kError); |