OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_AUTOMATION_AUTOMATION_PROVIDER_OBSERVERS_H_ | 5 #ifndef CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_OBSERVERS_H_ |
6 #define CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_OBSERVERS_H_ | 6 #define CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_OBSERVERS_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 18 matching lines...) Expand all Loading... |
29 | 29 |
30 class InitialLoadObserver : public NotificationObserver { | 30 class InitialLoadObserver : public NotificationObserver { |
31 public: | 31 public: |
32 InitialLoadObserver(size_t tab_count, AutomationProvider* automation); | 32 InitialLoadObserver(size_t tab_count, AutomationProvider* automation); |
33 ~InitialLoadObserver(); | 33 ~InitialLoadObserver(); |
34 | 34 |
35 virtual void Observe(NotificationType type, | 35 virtual void Observe(NotificationType type, |
36 const NotificationSource& source, | 36 const NotificationSource& source, |
37 const NotificationDetails& details); | 37 const NotificationDetails& details); |
38 | 38 |
| 39 // Caller owns the return value and is responsible for deleting it. |
| 40 // Example return value: |
| 41 // {'tabs': [{'start_time_ms': 1, 'stop_time_ms': 2.5}, |
| 42 // {'start_time_ms': 0.5, 'stop_time_ms': 3}]} |
| 43 // stop_time_ms values may be null if WaitForInitialLoads has not finished. |
| 44 // Only includes entries for the |tab_count| tabs we are monitoring. |
| 45 // There is no defined ordering of the return value. |
| 46 DictionaryValue* GetTimingInformation() const; |
| 47 |
39 private: | 48 private: |
| 49 class TabTime; |
| 50 typedef std::map<uintptr_t, TabTime> TabTimeMap; |
40 typedef std::set<uintptr_t> TabSet; | 51 typedef std::set<uintptr_t> TabSet; |
41 | 52 |
42 void ConditionMet(); | 53 void ConditionMet(); |
43 | 54 |
44 NotificationRegistrar registrar_; | 55 NotificationRegistrar registrar_; |
45 | 56 |
46 AutomationProvider* automation_; | 57 AutomationProvider* automation_; |
47 size_t outstanding_tab_count_; | 58 size_t outstanding_tab_count_; |
48 TabSet loading_tabs_; | 59 base::TimeTicks init_time_; |
| 60 TabTimeMap loading_tabs_; |
49 TabSet finished_tabs_; | 61 TabSet finished_tabs_; |
50 | 62 |
51 DISALLOW_COPY_AND_ASSIGN(InitialLoadObserver); | 63 DISALLOW_COPY_AND_ASSIGN(InitialLoadObserver); |
52 }; | 64 }; |
53 | 65 |
54 // Watches for NewTabUI page loads for performance timing purposes. | 66 // Watches for NewTabUI page loads for performance timing purposes. |
55 class NewTabUILoadObserver : public NotificationObserver { | 67 class NewTabUILoadObserver : public NotificationObserver { |
56 public: | 68 public: |
57 explicit NewTabUILoadObserver(AutomationProvider* automation); | 69 explicit NewTabUILoadObserver(AutomationProvider* automation); |
58 ~NewTabUILoadObserver(); | 70 ~NewTabUILoadObserver(); |
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
614 private: | 626 private: |
615 NotificationRegistrar registrar_; | 627 NotificationRegistrar registrar_; |
616 AutomationProvider* automation_; | 628 AutomationProvider* automation_; |
617 IPC::Message* reply_message_; | 629 IPC::Message* reply_message_; |
618 NavigationController* controller_; | 630 NavigationController* controller_; |
619 | 631 |
620 DISALLOW_COPY_AND_ASSIGN(OmniboxAcceptNotificationObserver); | 632 DISALLOW_COPY_AND_ASSIGN(OmniboxAcceptNotificationObserver); |
621 }; | 633 }; |
622 | 634 |
623 #endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_OBSERVERS_H_ | 635 #endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_OBSERVERS_H_ |
OLD | NEW |