| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 // The main point of this class is to cache ARC proc nspid<->pid mapping | 5 // The main point of this class is to cache ARC proc nspid<->pid mapping |
| 6 // globally. Since the calculation is costly, a dedicated worker thread is | 6 // globally. Since the calculation is costly, a dedicated worker thread is |
| 7 // used. All read/write of its internal data structure (i.e., the mapping) | 7 // used. All read/write of its internal data structure (i.e., the mapping) |
| 8 // should be on this thread. | 8 // should be on this thread. |
| 9 | 9 |
| 10 #include "chrome/browser/chromeos/arc/arc_process_service.h" | 10 #include "chrome/browser/chromeos/arc/arc_process_service.h" |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 base::PostTaskAndReplyWithResult(GetTaskRunner().get(), FROM_HERE, | 238 base::PostTaskAndReplyWithResult(GetTaskRunner().get(), FROM_HERE, |
| 239 base::Bind(&GetArcSystemProcessList), | 239 base::Bind(&GetArcSystemProcessList), |
| 240 callback); | 240 callback); |
| 241 } | 241 } |
| 242 | 242 |
| 243 bool ArcProcessService::RequestAppProcessList( | 243 bool ArcProcessService::RequestAppProcessList( |
| 244 RequestProcessListCallback callback) { | 244 RequestProcessListCallback callback) { |
| 245 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 245 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 246 | 246 |
| 247 arc::mojom::ProcessInstance* process_instance = | 247 arc::mojom::ProcessInstance* process_instance = |
| 248 arc_bridge_service()->process()->instance(); | 248 arc_bridge_service()->process()->GetInstanceForMethod( |
| 249 "RequestProcessList"); |
| 249 if (!process_instance) { | 250 if (!process_instance) { |
| 250 return false; | 251 return false; |
| 251 } | 252 } |
| 252 process_instance->RequestProcessList( | 253 process_instance->RequestProcessList( |
| 253 base::Bind(&ArcProcessService::OnReceiveProcessList, | 254 base::Bind(&ArcProcessService::OnReceiveProcessList, |
| 254 weak_ptr_factory_.GetWeakPtr(), callback)); | 255 weak_ptr_factory_.GetWeakPtr(), callback)); |
| 255 return true; | 256 return true; |
| 256 } | 257 } |
| 257 | 258 |
| 258 void ArcProcessService::OnReceiveProcessList( | 259 void ArcProcessService::OnReceiveProcessList( |
| (...skipping 10 matching lines...) Expand all Loading... |
| 269 | 270 |
| 270 scoped_refptr<base::SingleThreadTaskRunner> ArcProcessService::GetTaskRunner() { | 271 scoped_refptr<base::SingleThreadTaskRunner> ArcProcessService::GetTaskRunner() { |
| 271 return heavy_task_thread_.task_runner(); | 272 return heavy_task_thread_.task_runner(); |
| 272 } | 273 } |
| 273 | 274 |
| 274 inline ArcProcessService::NSPidToPidMap::NSPidToPidMap() {} | 275 inline ArcProcessService::NSPidToPidMap::NSPidToPidMap() {} |
| 275 | 276 |
| 276 inline ArcProcessService::NSPidToPidMap::~NSPidToPidMap() {} | 277 inline ArcProcessService::NSPidToPidMap::~NSPidToPidMap() {} |
| 277 | 278 |
| 278 } // namespace arc | 279 } // namespace arc |
| OLD | NEW |