| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/browser_about_handler.h" | 5 #include "chrome/browser/browser_about_handler.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 877 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 888 // About handler processing. | 888 // About handler processing. |
| 889 // |query| is roughly the query string of the about:stats URL. | 889 // |query| is roughly the query string of the about:stats URL. |
| 890 // Returns a string containing the HTML to render for the about:stats page. | 890 // Returns a string containing the HTML to render for the about:stats page. |
| 891 // Conditional Output: | 891 // Conditional Output: |
| 892 // if |query| is "json", returns a JSON format of all counters. | 892 // if |query| is "json", returns a JSON format of all counters. |
| 893 // if |query| is "raw", returns plain text of counter deltas. | 893 // if |query| is "raw", returns plain text of counter deltas. |
| 894 // otherwise, returns HTML with pretty JS/HTML to display the data. | 894 // otherwise, returns HTML with pretty JS/HTML to display the data. |
| 895 std::string AboutStats(const std::string& query) { | 895 std::string AboutStats(const std::string& query) { |
| 896 // We keep the DictionaryValue tree live so that we can do delta | 896 // We keep the DictionaryValue tree live so that we can do delta |
| 897 // stats computations across runs. | 897 // stats computations across runs. |
| 898 static DictionaryValue root; | 898 CR_DEFINE_STATIC_LOCAL(DictionaryValue, root, ()); |
| 899 static base::TimeTicks last_sample_time = base::TimeTicks::Now(); | 899 static base::TimeTicks last_sample_time = base::TimeTicks::Now(); |
| 900 | 900 |
| 901 base::TimeTicks now = base::TimeTicks::Now(); | 901 base::TimeTicks now = base::TimeTicks::Now(); |
| 902 base::TimeDelta time_since_last_sample = now - last_sample_time; | 902 base::TimeDelta time_since_last_sample = now - last_sample_time; |
| 903 last_sample_time = now; | 903 last_sample_time = now; |
| 904 | 904 |
| 905 base::StatsTable* table = base::StatsTable::current(); | 905 base::StatsTable* table = base::StatsTable::current(); |
| 906 if (!table) | 906 if (!table) |
| 907 return std::string(); | 907 return std::string(); |
| 908 | 908 |
| (...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1612 return false; | 1612 return false; |
| 1613 } | 1613 } |
| 1614 | 1614 |
| 1615 std::vector<std::string> ChromePaths() { | 1615 std::vector<std::string> ChromePaths() { |
| 1616 std::vector<std::string> paths; | 1616 std::vector<std::string> paths; |
| 1617 paths.reserve(arraysize(kChromePaths)); | 1617 paths.reserve(arraysize(kChromePaths)); |
| 1618 for (size_t i = 0; i < arraysize(kChromePaths); i++) | 1618 for (size_t i = 0; i < arraysize(kChromePaths); i++) |
| 1619 paths.push_back(kChromePaths[i]); | 1619 paths.push_back(kChromePaths[i]); |
| 1620 return paths; | 1620 return paths; |
| 1621 } | 1621 } |
| OLD | NEW |