| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_PAGE_CYCLER_PAGE_CYCLER_H_ | 5 #ifndef CHROME_BROWSER_PAGE_CYCLER_PAGE_CYCLER_H_ |
| 6 #define CHROME_BROWSER_PAGE_CYCLER_PAGE_CYCLER_H_ | 6 #define CHROME_BROWSER_PAGE_CYCLER_PAGE_CYCLER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| 11 #include "chrome/browser/ui/browser.h" | 11 #include "chrome/browser/ui/browser_list_observer.h" |
| 12 #include "chrome/browser/ui/browser_list.h" | |
| 13 #include "content/public/browser/navigation_controller.h" | 12 #include "content/public/browser/navigation_controller.h" |
| 14 #include "content/public/browser/web_contents_observer.h" | 13 #include "content/public/browser/web_contents_observer.h" |
| 15 | 14 |
| 15 class Browser; |
| 16 |
| 16 namespace content { | 17 namespace content { |
| 17 class RenderViewHost; | 18 class RenderViewHost; |
| 18 } // namespace content | 19 } // namespace content |
| 19 | 20 |
| 20 namespace base { | 21 namespace base { |
| 21 class TimeTicks; | 22 class TimeTicks; |
| 22 } // namespace base | 23 } // namespace base |
| 23 | 24 |
| 24 // Performance test to track the resources used and speed with which chromium | 25 // Performance test to track the resources used and speed with which chromium |
| 25 // fully loads a given set of URLs. This class is created on the UI thread and | 26 // fully loads a given set of URLs. This class is created on the UI thread and |
| 26 // does most of its work there. However, some work happens on background threads | 27 // does most of its work there. However, some work happens on background threads |
| 27 // too; those are named with 'OnBackgroundThread'. | 28 // too; those are named with 'OnBackgroundThread'. |
| 28 class PageCycler : public base::RefCountedThreadSafe<PageCycler>, | 29 class PageCycler : public base::RefCountedThreadSafe<PageCycler>, |
| 29 public BrowserList::Observer, | 30 public chrome::BrowserListObserver, |
| 30 public content::WebContentsObserver { | 31 public content::WebContentsObserver { |
| 31 public: | 32 public: |
| 32 PageCycler(Browser* browser, const FilePath& urls_file); | 33 PageCycler(Browser* browser, const FilePath& urls_file); |
| 33 | 34 |
| 34 // Begin running the page cycler. | 35 // Begin running the page cycler. |
| 35 void Run(); | 36 void Run(); |
| 36 | 37 |
| 37 // content::WebContentsObserver | 38 // content::WebContentsObserver |
| 38 virtual void DidFinishLoad(int64 frame_id, | 39 virtual void DidFinishLoad(int64 frame_id, |
| 39 const GURL& validated_url, | 40 const GURL& validated_url, |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 void WriteResultsOnBackgroundThread(const std::string& output); | 96 void WriteResultsOnBackgroundThread(const std::string& output); |
| 96 | 97 |
| 97 // Perform any necessary cleanup and exit |browser_|; virtual since tests may | 98 // Perform any necessary cleanup and exit |browser_|; virtual since tests may |
| 98 // need to override this function. | 99 // need to override this function. |
| 99 virtual void Finish(); | 100 virtual void Finish(); |
| 100 | 101 |
| 101 // Called when the Browser to which |browser_| points is closed; exits | 102 // Called when the Browser to which |browser_| points is closed; exits |
| 102 // PageCycler. | 103 // PageCycler. |
| 103 void Abort(); | 104 void Abort(); |
| 104 | 105 |
| 105 // BrowserList::Observer | 106 // chrome::BrowserListObserver |
| 106 virtual void OnBrowserAdded(Browser* browser) OVERRIDE; | 107 virtual void OnBrowserAdded(Browser* browser) OVERRIDE; |
| 107 virtual void OnBrowserRemoved(Browser* browser) OVERRIDE; | 108 virtual void OnBrowserRemoved(Browser* browser) OVERRIDE; |
| 108 | 109 |
| 109 // The Browser context in which the page cycler is running. | 110 // The Browser context in which the page cycler is running. |
| 110 Browser* browser_; | 111 Browser* browser_; |
| 111 | 112 |
| 112 // The path to the file containing the list of urls to visit. | 113 // The path to the file containing the list of urls to visit. |
| 113 FilePath urls_file_; | 114 FilePath urls_file_; |
| 114 | 115 |
| 115 // The path to the file to which we write any errors encountered. | 116 // The path to the file to which we write any errors encountered. |
| (...skipping 25 matching lines...) Expand all Loading... |
| 141 | 142 |
| 142 // Indicates the abort status of the page cycler; true means aborted. | 143 // Indicates the abort status of the page cycler; true means aborted. |
| 143 bool aborted_; | 144 bool aborted_; |
| 144 | 145 |
| 145 string16 error_; | 146 string16 error_; |
| 146 | 147 |
| 147 DISALLOW_COPY_AND_ASSIGN(PageCycler); | 148 DISALLOW_COPY_AND_ASSIGN(PageCycler); |
| 148 }; | 149 }; |
| 149 | 150 |
| 150 #endif // CHROME_BROWSER_PAGE_CYCLER_PAGE_CYCLER_H_ | 151 #endif // CHROME_BROWSER_PAGE_CYCLER_PAGE_CYCLER_H_ |
| OLD | NEW |