Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Side by Side Diff: chrome/browser/media_galleries/fileapi/safe_audio_video_checker.cc

Issue 1130993002: [chrome/browser/media_galleries/fileapi] Use ThreadTaskRunnerHandle instead of MessageLoopProxy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed Build Break Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/process/process_handle.h" 11 #include "base/process/process_handle.h"
12 #include "base/single_thread_task_runner.h"
13 #include "base/thread_task_runner_handle.h"
12 #include "chrome/common/chrome_utility_messages.h" 14 #include "chrome/common/chrome_utility_messages.h"
13 #include "chrome/common/extensions/chrome_utility_extensions_messages.h" 15 #include "chrome/common/extensions/chrome_utility_extensions_messages.h"
14 #include "chrome/grit/generated_resources.h" 16 #include "chrome/grit/generated_resources.h"
15 #include "content/public/browser/child_process_data.h" 17 #include "content/public/browser/child_process_data.h"
16 #include "content/public/browser/utility_process_host.h" 18 #include "content/public/browser/utility_process_host.h"
17 #include "content/public/browser/browser_thread.h" 19 #include "content/public/browser/browser_thread.h"
18 #include "ipc/ipc_message_macros.h" 20 #include "ipc/ipc_message_macros.h"
19 #include "ipc/ipc_platform_file.h" 21 #include "ipc/ipc_platform_file.h"
20 #include "ui/base/l10n/l10n_util.h" 22 #include "ui/base/l10n/l10n_util.h"
21 23
(...skipping 10 matching lines...) Expand all
32 return; 34 return;
33 state_ = PINGED_STATE; 35 state_ = PINGED_STATE;
34 36
35 if (!file_.IsValid()) { 37 if (!file_.IsValid()) {
36 callback_.Run(base::File::FILE_ERROR_SECURITY); 38 callback_.Run(base::File::FILE_ERROR_SECURITY);
37 state_ = FINISHED_STATE; 39 state_ = FINISHED_STATE;
38 return; 40 return;
39 } 41 }
40 42
41 utility_process_host_ = content::UtilityProcessHost::Create( 43 utility_process_host_ = content::UtilityProcessHost::Create(
42 this, base::MessageLoopProxy::current())->AsWeakPtr(); 44 this, base::ThreadTaskRunnerHandle::Get())->AsWeakPtr();
43 utility_process_host_->SetName(l10n_util::GetStringUTF16( 45 utility_process_host_->SetName(l10n_util::GetStringUTF16(
44 IDS_UTILITY_PROCESS_MEDIA_FILE_CHECKER_NAME)); 46 IDS_UTILITY_PROCESS_MEDIA_FILE_CHECKER_NAME));
45 utility_process_host_->Send(new ChromeUtilityMsg_StartupPing); 47 utility_process_host_->Send(new ChromeUtilityMsg_StartupPing);
46 } 48 }
47 49
48 SafeAudioVideoChecker::~SafeAudioVideoChecker() {} 50 SafeAudioVideoChecker::~SafeAudioVideoChecker() {}
49 51
50 void SafeAudioVideoChecker::OnProcessStarted() { 52 void SafeAudioVideoChecker::OnProcessStarted() {
51 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); 53 DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
52 if (state_ != PINGED_STATE) 54 if (state_ != PINGED_STATE)
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 bool handled = true; 87 bool handled = true;
86 IPC_BEGIN_MESSAGE_MAP(SafeAudioVideoChecker, message) 88 IPC_BEGIN_MESSAGE_MAP(SafeAudioVideoChecker, message)
87 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_ProcessStarted, 89 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_ProcessStarted,
88 OnProcessStarted) 90 OnProcessStarted)
89 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_CheckMediaFile_Finished, 91 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_CheckMediaFile_Finished,
90 OnCheckingFinished) 92 OnCheckingFinished)
91 IPC_MESSAGE_UNHANDLED(handled = false) 93 IPC_MESSAGE_UNHANDLED(handled = false)
92 IPC_END_MESSAGE_MAP() 94 IPC_END_MESSAGE_MAP()
93 return handled; 95 return handled;
94 } 96 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698