| 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 895 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 906 // About handler processing. | 906 // About handler processing. |
| 907 // |query| is roughly the query string of the about:stats URL. | 907 // |query| is roughly the query string of the about:stats URL. |
| 908 // Returns a string containing the HTML to render for the about:stats page. | 908 // Returns a string containing the HTML to render for the about:stats page. |
| 909 // Conditional Output: | 909 // Conditional Output: |
| 910 // if |query| is "json", returns a JSON format of all counters. | 910 // if |query| is "json", returns a JSON format of all counters. |
| 911 // if |query| is "raw", returns plain text of counter deltas. | 911 // if |query| is "raw", returns plain text of counter deltas. |
| 912 // otherwise, returns HTML with pretty JS/HTML to display the data. | 912 // otherwise, returns HTML with pretty JS/HTML to display the data. |
| 913 std::string AboutStats(const std::string& query) { | 913 std::string AboutStats(const std::string& query) { |
| 914 // We keep the DictionaryValue tree live so that we can do delta | 914 // We keep the DictionaryValue tree live so that we can do delta |
| 915 // stats computations across runs. | 915 // stats computations across runs. |
| 916 CR_DEFINE_STATIC_LOCAL(DictionaryValue, root, ()); | 916 static DictionaryValue root; |
| 917 static base::TimeTicks last_sample_time = base::TimeTicks::Now(); | 917 static base::TimeTicks last_sample_time = base::TimeTicks::Now(); |
| 918 | 918 |
| 919 base::TimeTicks now = base::TimeTicks::Now(); | 919 base::TimeTicks now = base::TimeTicks::Now(); |
| 920 base::TimeDelta time_since_last_sample = now - last_sample_time; | 920 base::TimeDelta time_since_last_sample = now - last_sample_time; |
| 921 last_sample_time = now; | 921 last_sample_time = now; |
| 922 | 922 |
| 923 base::StatsTable* table = base::StatsTable::current(); | 923 base::StatsTable* table = base::StatsTable::current(); |
| 924 if (!table) | 924 if (!table) |
| 925 return std::string(); | 925 return std::string(); |
| 926 | 926 |
| (...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1632 return false; | 1632 return false; |
| 1633 } | 1633 } |
| 1634 | 1634 |
| 1635 std::vector<std::string> ChromePaths() { | 1635 std::vector<std::string> ChromePaths() { |
| 1636 std::vector<std::string> paths; | 1636 std::vector<std::string> paths; |
| 1637 paths.reserve(arraysize(kChromePaths)); | 1637 paths.reserve(arraysize(kChromePaths)); |
| 1638 for (size_t i = 0; i < arraysize(kChromePaths); i++) | 1638 for (size_t i = 0; i < arraysize(kChromePaths); i++) |
| 1639 paths.push_back(kChromePaths[i]); | 1639 paths.push_back(kChromePaths[i]); |
| 1640 return paths; | 1640 return paths; |
| 1641 } | 1641 } |
| OLD | NEW |