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