OLD | NEW |
---|---|
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/conflicts/module_database_win.h" | 5 #include "chrome/browser/conflicts/module_database_win.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <tuple> | 8 #include <tuple> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 13 matching lines...) Expand all Loading... | |
24 | 24 |
25 } // namespace | 25 } // namespace |
26 | 26 |
27 ModuleDatabase::ModuleDatabase( | 27 ModuleDatabase::ModuleDatabase( |
28 scoped_refptr<base::SequencedTaskRunner> task_runner) | 28 scoped_refptr<base::SequencedTaskRunner> task_runner) |
29 : task_runner_(std::move(task_runner)), | 29 : task_runner_(std::move(task_runner)), |
30 // ModuleDatabase owns |module_inspector_|, so it is safe to use | 30 // ModuleDatabase owns |module_inspector_|, so it is safe to use |
31 // base::Unretained(). | 31 // base::Unretained(). |
32 module_inspector_(base::Bind(&ModuleDatabase::OnModuleInspected, | 32 module_inspector_(base::Bind(&ModuleDatabase::OnModuleInspected, |
33 base::Unretained(this))), | 33 base::Unretained(this))), |
34 third_party_metrics_(this), | |
34 weak_ptr_factory_(this) {} | 35 weak_ptr_factory_(this) {} |
35 | 36 |
36 ModuleDatabase::~ModuleDatabase() { | 37 ModuleDatabase::~ModuleDatabase() { |
37 if (this == g_instance) | 38 if (this == g_instance) |
38 g_instance = nullptr; | 39 g_instance = nullptr; |
39 } | 40 } |
40 | 41 |
41 // static | 42 // static |
42 ModuleDatabase* ModuleDatabase::GetInstance() { | 43 ModuleDatabase* ModuleDatabase::GetInstance() { |
43 return g_instance; | 44 return g_instance; |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
369 creation_time(creation_time), | 370 creation_time(creation_time), |
370 process_type(process_type) {} | 371 process_type(process_type) {} |
371 | 372 |
372 ModuleDatabase::ProcessInfoKey::~ProcessInfoKey() = default; | 373 ModuleDatabase::ProcessInfoKey::~ProcessInfoKey() = default; |
373 | 374 |
374 bool ModuleDatabase::ProcessInfoKey::operator<( | 375 bool ModuleDatabase::ProcessInfoKey::operator<( |
375 const ProcessInfoKey& pik) const { | 376 const ProcessInfoKey& pik) const { |
376 // The key consists of the pair of (process_id, creation_time). | 377 // The key consists of the pair of (process_id, creation_time). |
377 // Use the std::tuple lexicographic comparison operator. | 378 // Use the std::tuple lexicographic comparison operator. |
378 return std::make_tuple(process_id, creation_time) < | 379 return std::make_tuple(process_id, creation_time) < |
379 std::make_tuple(pik.process_id, pik.creation_time); | 380 std::make_tuple(pik.process_id, pik.creation_time); |
chrisha
2017/05/30 19:30:03
Is there a reason why tie doesn't work here? (ie,
Patrick Monette
2017/05/31 18:52:20
I want to change it eventually but it seems too un
| |
380 } | 381 } |
381 | 382 |
382 // ModuleDatabase::ProcessInfoData --------------------------------------------- | 383 // ModuleDatabase::ProcessInfoData --------------------------------------------- |
383 | 384 |
384 ModuleDatabase::ProcessInfoData::ProcessInfoData() = default; | 385 ModuleDatabase::ProcessInfoData::ProcessInfoData() = default; |
385 | 386 |
386 ModuleDatabase::ProcessInfoData::ProcessInfoData(const ProcessInfoData& other) = | 387 ModuleDatabase::ProcessInfoData::ProcessInfoData(const ProcessInfoData& other) = |
387 default; | 388 default; |
388 | 389 |
389 ModuleDatabase::ProcessInfoData::~ProcessInfoData() = default; | 390 ModuleDatabase::ProcessInfoData::~ProcessInfoData() = default; |
OLD | NEW |