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/process/arc_process_service.h" | 10 #include "chrome/browser/chromeos/arc/process/arc_process_service.h" |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 RequestProcessListCallback callback) { | 240 RequestProcessListCallback callback) { |
241 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 241 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
242 | 242 |
243 // Since several services call this class to get information about the ARC | 243 // Since several services call this class to get information about the ARC |
244 // process list, it can produce a lot of logspam when the board is ARC-ready | 244 // process list, it can produce a lot of logspam when the board is ARC-ready |
245 // but the user has not opted into ARC. This redundant check avoids that | 245 // but the user has not opted into ARC. This redundant check avoids that |
246 // logspam. | 246 // logspam. |
247 if (!instance_ready_) | 247 if (!instance_ready_) |
248 return false; | 248 return false; |
249 | 249 |
250 mojom::ProcessInstance* process_instance = | 250 mojom::ProcessInstance* process_instance = ARC_GET_INSTANCE_FOR_METHOD( |
251 arc_bridge_service()->process()->GetInstanceForMethod( | 251 arc_bridge_service()->process(), RequestProcessList); |
252 "RequestProcessList"); | |
253 if (!process_instance) | 252 if (!process_instance) |
254 return false; | 253 return false; |
255 | 254 |
256 process_instance->RequestProcessList( | 255 process_instance->RequestProcessList( |
257 base::Bind(&ArcProcessService::OnReceiveProcessList, | 256 base::Bind(&ArcProcessService::OnReceiveProcessList, |
258 weak_ptr_factory_.GetWeakPtr(), callback)); | 257 weak_ptr_factory_.GetWeakPtr(), callback)); |
259 return true; | 258 return true; |
260 } | 259 } |
261 | 260 |
262 void ArcProcessService::OnReceiveProcessList( | 261 void ArcProcessService::OnReceiveProcessList( |
(...skipping 21 matching lines...) Expand all Loading... |
284 void ArcProcessService::OnInstanceClosed() { | 283 void ArcProcessService::OnInstanceClosed() { |
285 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 284 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
286 instance_ready_ = false; | 285 instance_ready_ = false; |
287 } | 286 } |
288 | 287 |
289 inline ArcProcessService::NSPidToPidMap::NSPidToPidMap() {} | 288 inline ArcProcessService::NSPidToPidMap::NSPidToPidMap() {} |
290 | 289 |
291 inline ArcProcessService::NSPidToPidMap::~NSPidToPidMap() {} | 290 inline ArcProcessService::NSPidToPidMap::~NSPidToPidMap() {} |
292 | 291 |
293 } // namespace arc | 292 } // namespace arc |
OLD | NEW |