| 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 #include "chrome/browser/chromeos/memory/oom_memory_details.h" | 5 #include "chrome/browser/memory/oom_memory_details.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/process/process_metrics.h" | 8 #include "base/process/process_metrics.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "chrome/browser/chromeos/memory/oom_memory_details.h" | 10 #include "chrome/browser/memory/oom_memory_details.h" |
| 11 #include "ui/base/text/bytes_formatting.h" | 11 #include "ui/base/text/bytes_formatting.h" |
| 12 | 12 |
| 13 namespace chromeos { | 13 namespace memory { |
| 14 | 14 |
| 15 // static | 15 // static |
| 16 void OomMemoryDetails::Log(const std::string& title, | 16 void OomMemoryDetails::Log(const std::string& title, |
| 17 const base::Closure& callback) { | 17 const base::Closure& callback) { |
| 18 // Deletes itself upon completion. | 18 // Deletes itself upon completion. |
| 19 OomMemoryDetails* details = new OomMemoryDetails(title, callback); | 19 OomMemoryDetails* details = new OomMemoryDetails(title, callback); |
| 20 details->StartFetch(MemoryDetails::FROM_CHROME_ONLY); | 20 details->StartFetch(MemoryDetails::FROM_CHROME_ONLY); |
| 21 } | 21 } |
| 22 | 22 |
| 23 OomMemoryDetails::OomMemoryDetails(const std::string& title, | 23 OomMemoryDetails::OomMemoryDetails(const std::string& title, |
| (...skipping 18 matching lines...) Expand all Loading... |
| 42 } | 42 } |
| 43 LOG(WARNING) << title_ << " (" << delta.InMilliseconds() << " ms):\n" | 43 LOG(WARNING) << title_ << " (" << delta.InMilliseconds() << " ms):\n" |
| 44 << log_string; | 44 << log_string; |
| 45 if (!callback_.is_null()) | 45 if (!callback_.is_null()) |
| 46 callback_.Run(); | 46 callback_.Run(); |
| 47 // Delete ourselves so we don't have to worry about OomPriorityManager | 47 // Delete ourselves so we don't have to worry about OomPriorityManager |
| 48 // deleting us when we're still working. | 48 // deleting us when we're still working. |
| 49 Release(); | 49 Release(); |
| 50 } | 50 } |
| 51 | 51 |
| 52 } // namespace chromeos | 52 } // namespace memory |
| OLD | NEW |