Chromium Code Reviews| 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 22 matching lines...) Expand all Loading... | |
| 33 using base::kNullProcessId; | 33 using base::kNullProcessId; |
| 34 using base::Process; | 34 using base::Process; |
| 35 using base::ProcessId; | 35 using base::ProcessId; |
| 36 using base::SequencedWorkerPool; | 36 using base::SequencedWorkerPool; |
| 37 using std::map; | 37 using std::map; |
| 38 using std::set; | 38 using std::set; |
| 39 using std::vector; | 39 using std::vector; |
| 40 | 40 |
| 41 ArcProcessService::ArcProcessService(ArcBridgeService* bridge_service) | 41 ArcProcessService::ArcProcessService(ArcBridgeService* bridge_service) |
| 42 : ArcService(bridge_service), | 42 : ArcService(bridge_service), |
| 43 worker_pool_(new SequencedWorkerPool(1, "arc_process_manager")), | 43 worker_pool_(new SequencedWorkerPool(1, |
| 44 "arc_process_manager", | |
| 45 base::TaskPriority::USER_BLOCKING)), | |
|
hidehiko
2016/08/09 05:59:36
This is ok for me, or can be USER_VISIBLE, to be c
cylee1
2016/08/09 08:35:41
USER_VISIBLe looks good to me.
BTW there's an ong
gab
2016/08/09 14:24:06
Done.
| |
| 44 weak_ptr_factory_(this) { | 46 weak_ptr_factory_(this) { |
| 45 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 47 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 46 arc_bridge_service()->process()->AddObserver(this); | 48 arc_bridge_service()->process()->AddObserver(this); |
| 47 DCHECK(!g_arc_process_service); | 49 DCHECK(!g_arc_process_service); |
| 48 g_arc_process_service = this; | 50 g_arc_process_service = this; |
| 49 // Not intended to be used from the creating thread. | 51 // Not intended to be used from the creating thread. |
| 50 thread_checker_.DetachFromThread(); | 52 thread_checker_.DetachFromThread(); |
| 51 } | 53 } |
| 52 | 54 |
| 53 ArcProcessService::~ArcProcessService() { | 55 ArcProcessService::~ArcProcessService() { |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 243 nspid_to_pid_.find(nspid) != nspid_to_pid_.end()) | 245 nspid_to_pid_.find(nspid) != nspid_to_pid_.end()) |
| 244 nspid_to_pid_[nspid] = pid; | 246 nspid_to_pid_[nspid] = pid; |
| 245 | 247 |
| 246 for (ProcessId child_pid : process_tree[pid]) | 248 for (ProcessId child_pid : process_tree[pid]) |
| 247 queue.push(child_pid); | 249 queue.push(child_pid); |
| 248 } | 250 } |
| 249 } | 251 } |
| 250 } | 252 } |
| 251 | 253 |
| 252 } // namespace arc | 254 } // namespace arc |
| OLD | NEW |