Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(712)

Side by Side Diff: chrome/browser/automation/automation_provider_observers.cc

Issue 9582019: more logs for 26646 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix ifdef Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/automation/automation_provider.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "chrome/browser/automation/automation_provider_observers.h" 5 #include "chrome/browser/automation/automation_provider_observers.h"
6 6
7 #include <deque> 7 #include <deque>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 base::TimeTicks load_start_time_; 111 base::TimeTicks load_start_time_;
112 base::TimeTicks load_stop_time_; 112 base::TimeTicks load_stop_time_;
113 }; 113 };
114 114
115 InitialLoadObserver::InitialLoadObserver(size_t tab_count, 115 InitialLoadObserver::InitialLoadObserver(size_t tab_count,
116 AutomationProvider* automation) 116 AutomationProvider* automation)
117 : automation_(automation->AsWeakPtr()), 117 : automation_(automation->AsWeakPtr()),
118 crashed_tab_count_(0), 118 crashed_tab_count_(0),
119 outstanding_tab_count_(tab_count), 119 outstanding_tab_count_(tab_count),
120 init_time_(base::TimeTicks::Now()) { 120 init_time_(base::TimeTicks::Now()) {
121 #if defined(OS_CHROMEOS)
122 LOG(ERROR) << "InitialLoadObserver::Observe type=" << tab_count;
123 #endif
124
121 if (outstanding_tab_count_ > 0) { 125 if (outstanding_tab_count_ > 0) {
122 registrar_.Add(this, content::NOTIFICATION_LOAD_START, 126 registrar_.Add(this, content::NOTIFICATION_LOAD_START,
123 content::NotificationService::AllSources()); 127 content::NotificationService::AllSources());
124 registrar_.Add(this, content::NOTIFICATION_LOAD_STOP, 128 registrar_.Add(this, content::NOTIFICATION_LOAD_STOP,
125 content::NotificationService::AllSources()); 129 content::NotificationService::AllSources());
126 registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CLOSED, 130 registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CLOSED,
127 content::NotificationService::AllSources()); 131 content::NotificationService::AllSources());
128 } 132 }
129 } 133 }
130 134
131 InitialLoadObserver::~InitialLoadObserver() { 135 InitialLoadObserver::~InitialLoadObserver() {
132 } 136 }
133 137
134 void InitialLoadObserver::Observe(int type, 138 void InitialLoadObserver::Observe(int type,
135 const content::NotificationSource& source, 139 const content::NotificationSource& source,
136 const content::NotificationDetails& details) { 140 const content::NotificationDetails& details) {
141 #if defined(OS_CHROMEOS)
142 LOG(ERROR) << "InitialLoadObserver::Observe type=" << type;
143 #endif
144
137 if (type == content::NOTIFICATION_LOAD_START) { 145 if (type == content::NOTIFICATION_LOAD_START) {
138 if (outstanding_tab_count_ > loading_tabs_.size()) 146 if (outstanding_tab_count_ > loading_tabs_.size())
139 loading_tabs_.insert(TabTimeMap::value_type( 147 loading_tabs_.insert(TabTimeMap::value_type(
140 source.map_key(), 148 source.map_key(),
141 TabTime(base::TimeTicks::Now()))); 149 TabTime(base::TimeTicks::Now())));
142 } else if (type == content::NOTIFICATION_LOAD_STOP) { 150 } else if (type == content::NOTIFICATION_LOAD_STOP) {
143 if (outstanding_tab_count_ > finished_tabs_.size()) { 151 if (outstanding_tab_count_ > finished_tabs_.size()) {
144 TabTimeMap::iterator iter = loading_tabs_.find(source.map_key()); 152 TabTimeMap::iterator iter = loading_tabs_.find(source.map_key());
145 if (iter != loading_tabs_.end()) { 153 if (iter != loading_tabs_.end()) {
146 finished_tabs_.insert(source.map_key()); 154 finished_tabs_.insert(source.map_key());
(...skipping 22 matching lines...) Expand all
169 177
170 default: 178 default:
171 LOG(ERROR) << "Unhandled termination status " << status; 179 LOG(ERROR) << "Unhandled termination status " << status;
172 NOTREACHED(); 180 NOTREACHED();
173 break; 181 break;
174 } 182 }
175 } else { 183 } else {
176 NOTREACHED(); 184 NOTREACHED();
177 } 185 }
178 186
187 #if defined(OS_CHROMEOS)
188 LOG(ERROR) << "InitialLoadObserver::Observe type=" << type
189 << ", finished=" << finished_tabs_.size()
190 << ", crashed=" << crashed_tab_count_
191 << ", outstanding=" << outstanding_tab_count_;
192 #endif
193
179 if (finished_tabs_.size() + crashed_tab_count_ >= outstanding_tab_count_) 194 if (finished_tabs_.size() + crashed_tab_count_ >= outstanding_tab_count_)
180 ConditionMet(); 195 ConditionMet();
181 } 196 }
182 197
183 DictionaryValue* InitialLoadObserver::GetTimingInformation() const { 198 DictionaryValue* InitialLoadObserver::GetTimingInformation() const {
184 ListValue* items = new ListValue; 199 ListValue* items = new ListValue;
185 for (TabTimeMap::const_iterator it = loading_tabs_.begin(); 200 for (TabTimeMap::const_iterator it = loading_tabs_.begin();
186 it != loading_tabs_.end(); 201 it != loading_tabs_.end();
187 ++it) { 202 ++it) {
188 DictionaryValue* item = new DictionaryValue; 203 DictionaryValue* item = new DictionaryValue;
(...skipping 3004 matching lines...) Expand 10 before | Expand all | Expand 10 after
3193 } 3208 }
3194 3209
3195 ExtensionHost* host = content::Details<ExtensionHost>(details).ptr(); 3210 ExtensionHost* host = content::Details<ExtensionHost>(details).ptr();
3196 if (host->extension_id() == extension_id_ && 3211 if (host->extension_id() == extension_id_ &&
3197 host->extension_host_type() == chrome::VIEW_TYPE_EXTENSION_POPUP) { 3212 host->extension_host_type() == chrome::VIEW_TYPE_EXTENSION_POPUP) {
3198 AutomationJSONReply(automation_, reply_message_.release()) 3213 AutomationJSONReply(automation_, reply_message_.release())
3199 .SendSuccess(NULL); 3214 .SendSuccess(NULL);
3200 delete this; 3215 delete this;
3201 } 3216 }
3202 } 3217 }
OLDNEW
« no previous file with comments | « chrome/browser/automation/automation_provider.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698