OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_CHROMEOS_MEMORY_OOM_MEMORY_DETAILS_H_ | |
6 #define CHROME_BROWSER_CHROMEOS_MEMORY_OOM_MEMORY_DETAILS_H_ | |
7 | |
8 #include <string> | |
9 | |
10 #include "base/callback.h" | |
11 #include "base/macros.h" | |
12 #include "base/time/time.h" | |
13 #include "chrome/browser/memory_details.h" | |
14 | |
15 namespace chromeos { | |
16 | |
17 //////////////////////////////////////////////////////////////////////////////// | |
18 // OomMemoryDetails logs details about all Chrome processes during an out-of- | |
19 // memory event in an attempt to identify the culprit. | |
20 class OomMemoryDetails : public MemoryDetails { | |
21 public: | |
22 // Logs the memory details asynchronously and then run |callback|. | |
23 // The |title| is printed at the beginning of the message. | |
24 static void Log(const std::string& title, const base::Closure& callback); | |
25 | |
26 private: | |
27 OomMemoryDetails(const std::string& title, const base::Closure& callback); | |
28 ~OomMemoryDetails() override; | |
29 | |
30 // MemoryDetails overrides: | |
31 void OnDetailsAvailable() override; | |
32 | |
33 std::string title_; | |
34 base::TimeTicks start_time_; | |
35 base::Closure callback_; | |
36 | |
37 DISALLOW_COPY_AND_ASSIGN(OomMemoryDetails); | |
38 }; | |
39 | |
40 } // namespace chromeos | |
41 | |
42 #endif // CHROME_BROWSER_CHROMEOS_MEMORY_OOM_MEMORY_DETAILS_H_ | |
OLD | NEW |