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

Side by Side Diff: chrome/browser/safe_browsing/sandboxed_dmg_analyzer_mac.cc

Issue 1885813002: Delete the utility process startup ping. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and remove unnecessary weak ptrs Created 4 years, 8 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/safe_browsing/sandboxed_dmg_analyzer_mac.h" 5 #include "chrome/browser/safe_browsing/sandboxed_dmg_analyzer_mac.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "chrome/common/chrome_utility_messages.h" 10 #include "chrome/common/chrome_utility_messages.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 } 51 }
52 52
53 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, 53 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
54 base::Bind(&SandboxedDMGAnalyzer::StartAnalysis, 54 base::Bind(&SandboxedDMGAnalyzer::StartAnalysis,
55 this)); 55 this));
56 } 56 }
57 57
58 void SandboxedDMGAnalyzer::StartAnalysis() { 58 void SandboxedDMGAnalyzer::StartAnalysis() {
59 DCHECK_CURRENTLY_ON(BrowserThread::IO); 59 DCHECK_CURRENTLY_ON(BrowserThread::IO);
60 60
61 utility_process_host_ = 61 content::UtilityProcessHost* utility_process_host_ =
Scott Hess - ex-Googler 2016/04/13 23:50:41 Also here.
Anand Mistry (off Chromium) 2016/04/14 00:00:07 Done.
62 content::UtilityProcessHost::Create(this, 62 content::UtilityProcessHost::Create(this,
63 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)) 63 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO));
64 ->AsWeakPtr();
65 64
66 utility_process_host_->SetName(l10n_util::GetStringUTF16( 65 utility_process_host_->SetName(l10n_util::GetStringUTF16(
67 IDS_UTILITY_PROCESS_SAFE_BROWSING_ZIP_FILE_ANALYZER_NAME)); 66 IDS_UTILITY_PROCESS_SAFE_BROWSING_ZIP_FILE_ANALYZER_NAME));
68 utility_process_host_->Send(new ChromeUtilityMsg_StartupPing); 67 utility_process_host_->Send(
68 new ChromeUtilityMsg_AnalyzeDmgFileForDownloadProtection(
69 IPC::TakePlatformFileForTransit(std::move(file_))));
69 } 70 }
70 71
71 void SandboxedDMGAnalyzer::OnProcessCrashed(int exit_code) { 72 void SandboxedDMGAnalyzer::OnProcessCrashed(int exit_code) {
72 OnAnalysisFinished(zip_analyzer::Results()); 73 OnAnalysisFinished(zip_analyzer::Results());
73 } 74 }
74 75
75 void SandboxedDMGAnalyzer::OnProcessLaunchFailed() { 76 void SandboxedDMGAnalyzer::OnProcessLaunchFailed() {
76 OnAnalysisFinished(zip_analyzer::Results()); 77 OnAnalysisFinished(zip_analyzer::Results());
77 } 78 }
78 79
79 bool SandboxedDMGAnalyzer::OnMessageReceived(const IPC::Message& message) { 80 bool SandboxedDMGAnalyzer::OnMessageReceived(const IPC::Message& message) {
80 bool handled = true; 81 bool handled = true;
81 IPC_BEGIN_MESSAGE_MAP(SandboxedDMGAnalyzer, message) 82 IPC_BEGIN_MESSAGE_MAP(SandboxedDMGAnalyzer, message)
82 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_ProcessStarted,
83 OnUtilityProcessStarted)
84 IPC_MESSAGE_HANDLER( 83 IPC_MESSAGE_HANDLER(
85 ChromeUtilityHostMsg_AnalyzeDmgFileForDownloadProtection_Finished, 84 ChromeUtilityHostMsg_AnalyzeDmgFileForDownloadProtection_Finished,
86 OnAnalysisFinished) 85 OnAnalysisFinished)
87 IPC_MESSAGE_UNHANDLED(handled = false) 86 IPC_MESSAGE_UNHANDLED(handled = false)
88 IPC_END_MESSAGE_MAP() 87 IPC_END_MESSAGE_MAP()
89 return handled; 88 return handled;
90 } 89 }
91 90
92 void SandboxedDMGAnalyzer::OnUtilityProcessStarted() {
93 DCHECK_CURRENTLY_ON(BrowserThread::IO);
94 utility_process_host_->Send(
95 new ChromeUtilityMsg_AnalyzeDmgFileForDownloadProtection(
96 IPC::TakePlatformFileForTransit(std::move(file_))));
97 }
98
99 void SandboxedDMGAnalyzer::OnAnalysisFinished( 91 void SandboxedDMGAnalyzer::OnAnalysisFinished(
100 const zip_analyzer::Results& results) { 92 const zip_analyzer::Results& results) {
101 DCHECK_CURRENTLY_ON(BrowserThread::IO); 93 DCHECK_CURRENTLY_ON(BrowserThread::IO);
102 if (callback_called_) 94 if (callback_called_)
103 return; 95 return;
104 96
105 callback_called_ = true; 97 callback_called_ = true;
106 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, 98 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
107 base::Bind(callback_, results)); 99 base::Bind(callback_, results));
108 } 100 }
109 101
110 } // namespace safe_browsing 102 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698