| 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 "chrome/browser/media_galleries/fileapi/safe_audio_video_checker.h" | 5 #include "chrome/browser/media_galleries/fileapi/safe_audio_video_checker.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 } | 51 } |
| 52 | 52 |
| 53 SafeAudioVideoChecker::~SafeAudioVideoChecker() {} | 53 SafeAudioVideoChecker::~SafeAudioVideoChecker() {} |
| 54 | 54 |
| 55 void SafeAudioVideoChecker::OnProcessStarted() { | 55 void SafeAudioVideoChecker::OnProcessStarted() { |
| 56 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); | 56 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
| 57 if (state_ != PINGED_STATE) | 57 if (state_ != PINGED_STATE) |
| 58 return; | 58 return; |
| 59 state_ = STARTED_STATE; | 59 state_ = STARTED_STATE; |
| 60 | 60 |
| 61 if (utility_process_host_->GetData().handle == base::kNullProcessHandle) | 61 IPC::PlatformFileForTransit file_for_transit = |
| 62 DLOG(ERROR) << "Child process handle is null"; | 62 IPC::TakePlatformFileForTransit(std::move(file_)); |
| 63 IPC::PlatformFileForTransit file_for_transit = IPC::TakeFileHandleForProcess( | |
| 64 std::move(file_), utility_process_host_->GetData().handle); | |
| 65 if (file_for_transit == IPC::InvalidPlatformFileForTransit()) { | 63 if (file_for_transit == IPC::InvalidPlatformFileForTransit()) { |
| 66 OnCheckingFinished(false /* valid? */); | 64 OnCheckingFinished(false /* valid? */); |
| 67 return; | 65 return; |
| 68 } | 66 } |
| 69 const int64_t kFileDecodeTimeInMS = 250; | 67 const int64_t kFileDecodeTimeInMS = 250; |
| 70 utility_process_host_->Send(new ChromeUtilityMsg_CheckMediaFile( | 68 utility_process_host_->Send(new ChromeUtilityMsg_CheckMediaFile( |
| 71 kFileDecodeTimeInMS, file_for_transit)); | 69 kFileDecodeTimeInMS, file_for_transit)); |
| 72 } | 70 } |
| 73 | 71 |
| 74 void SafeAudioVideoChecker::OnCheckingFinished(bool valid) { | 72 void SafeAudioVideoChecker::OnCheckingFinished(bool valid) { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 89 bool handled = true; | 87 bool handled = true; |
| 90 IPC_BEGIN_MESSAGE_MAP(SafeAudioVideoChecker, message) | 88 IPC_BEGIN_MESSAGE_MAP(SafeAudioVideoChecker, message) |
| 91 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_ProcessStarted, | 89 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_ProcessStarted, |
| 92 OnProcessStarted) | 90 OnProcessStarted) |
| 93 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_CheckMediaFile_Finished, | 91 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_CheckMediaFile_Finished, |
| 94 OnCheckingFinished) | 92 OnCheckingFinished) |
| 95 IPC_MESSAGE_UNHANDLED(handled = false) | 93 IPC_MESSAGE_UNHANDLED(handled = false) |
| 96 IPC_END_MESSAGE_MAP() | 94 IPC_END_MESSAGE_MAP() |
| 97 return handled; | 95 return handled; |
| 98 } | 96 } |
| OLD | NEW |